Create userdata without user values in Lua 5.4
[liba.git] / test / polytraj7.h
blob9fcebeb1d434667c778802cef8a91ecacde8d7ea
1 #define MAIN_(x) A_CAST_2(x, _polytraj7)
2 #include "test.h"
3 #include "a/polytraj7.h"
5 int MAIN(int argc, char *argv[]) // NOLINT(misc-definitions-in-headers)
7 int start = 1;
8 if (argc > 1)
10 char *endptr = A_NULL;
11 #if A_FLOAT_TYPE + 0 == A_FLOAT_SINGLE
12 (void)strtof(argv[1], &endptr);
13 #elif A_FLOAT_TYPE + 0 == A_FLOAT_DOUBLE
14 (void)strtod(argv[1], &endptr);
15 #elif A_FLOAT_TYPE + 0 == A_FLOAT_EXTEND
16 (void)strtold(argv[1], &endptr);
17 #endif /* A_FLOAT_TYPE */
18 if (argv[1] == endptr)
20 test_init(argc, argv, 1);
21 ++start;
25 a_float_t arg[10] = {0};
26 for (int i = start; i < argc; ++i)
28 #if A_FLOAT_TYPE + 0 == A_FLOAT_SINGLE
29 arg[i - start] = strtof(argv[i], A_NULL);
30 #elif A_FLOAT_TYPE + 0 == A_FLOAT_DOUBLE
31 arg[i - start] = strtod(argv[i], A_NULL);
32 #elif A_FLOAT_TYPE + 0 == A_FLOAT_EXTEND
33 arg[i - start] = strtold(argv[i], A_NULL);
34 #endif /* A_FLOAT_TYPE */
36 a_polytraj7_s pt7;
37 a_polytraj7_gen(&pt7, arg[0], arg[1], arg[2], arg[3], arg[4], arg[5], arg[6], arg[7], arg[8], arg[9]);
38 for (a_float_t dt = arg[0], delta = (arg[1] - arg[0]) / 1000; dt < arg[1]; dt += delta) // NOLINT
40 debug(A_FLOAT_PRI("+", "f ") A_FLOAT_PRI("+", "f ") A_FLOAT_PRI("+", "f ") A_FLOAT_PRI("+", "f ") A_FLOAT_PRI("+", "f\n"),
41 dt, a_polytraj7_pos(&pt7, dt), a_polytraj7_vel(&pt7, dt), a_polytraj7_acc(&pt7, dt), a_polytraj7_jer(&pt7, dt));
44 return 0;