enable analyzer on CI
[liba.git] / test / poly.h
blob4f78abd47aca8218bfd627d9592ee672ab5920f1
1 #define MAIN(x) poly##x
2 #include "test.h"
3 #include "a/poly.h"
5 static void print_(a_float const *a, a_size n)
7 putchar('{');
8 a_forenum(a_size, i, n)
10 printf(A_FLOAT_PRI("", "g"), a[i]);
11 if (i < n - 1) { putchar(','); }
13 putchar('}');
16 int main(int argc, char *argv[]) // NOLINT(misc-definitions-in-headers)
18 (void)(argc);
19 (void)(argv);
20 a_float x = 2;
21 a_float x4[] = {A_FLOAT_C(1.0), A_FLOAT_C(2.0), A_FLOAT_C(3.0), A_FLOAT_C(4.0)};
22 print_(x4, 4);
23 printf("=" A_FLOAT_PRI("", "g") "\n", a_poly_eval(x4, 4, x));
24 a_poly_swap(x4, 4);
25 print_(x4, 4);
26 printf("=" A_FLOAT_PRI("", "g") "\n", a_poly_eval(x4, 4, x));
27 print_(x4, 4);
28 a_poly_swap(x4, 4);
29 printf("=" A_FLOAT_PRI("", "g") "\n", a_poly_evar(x4, 4, x));
30 print_(x4, 3);
31 printf("=" A_FLOAT_PRI("", "g") "\n", a_poly_eval(x4, 3, x));
32 a_poly_swap(x4, 3);
33 print_(x4, 3);
34 printf("=" A_FLOAT_PRI("", "g") "\n", a_poly_eval(x4, 3, x));
35 print_(x4, 3);
36 printf("=" A_FLOAT_PRI("", "g") "\n", a_poly_evar(x4, 3, x));
37 a_poly_swap(x4, 3);
38 return 0;