release 0.1.15
[liba.git] / test / regress.h
blobb1ba6e60fb540174aaae7668a222620fce94f28f
2 #define MAIN(x) regress##x
3 #include "test.h"
4 #include "a/regress.h"
6 static void test_odm(int argc, char *argv[])
8 a_size const n = a_cast_s(a_size, argc);
9 a_float *p = a_new(a_float, A_NULL, n);
10 for (a_size i = 0; i < n; ++i)
12 char *endptr;
13 p[i] = strtonum(argv[i], &endptr);
16 a_float *odm = a_new(a_float, A_NULL, n);
17 debug("{");
18 for (a_size i = 0; i < n; ++i)
20 debug("%c" A_FLOAT_PRI("", "g"), i ? ',' : 0, p[i]);
22 debug("}:" A_FLOAT_PRI("", "g\n{"), a_regress_odm(n, p, odm));
23 for (a_size i = 0; i < n; ++i)
25 debug("%c" A_FLOAT_PRI("", "g"), i ? ',' : 0, odm[i]);
27 debug("}\n");
29 a_die(odm);
30 a_die(p);
33 int main(int argc, char *argv[]) // NOLINT(misc-definitions-in-headers)
35 if (argc < 2)
37 test_odm(argc - 1, argv + 1);
38 return 0;
41 switch (a_hash_bkdr(argv[1], 0))
43 case 0x001D4480: // odm
44 test_odm(argc - 2, argv + 2);
45 break;
46 default:
47 debug("odm\n");
50 return 0;