X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/mLib/blobdiff_plain/c4ccbbf992e1587ae316f66af6a28006780688d8..08bb7015a9e28c5c9d38fe05a6f6644bc21fa527:/test/example/testex.c?ds=sidebyside diff --git a/test/example/testex.c b/test/example/testex.c index c8db114..dd9fb9e 100644 --- a/test/example/testex.c +++ b/test/example/testex.c @@ -28,6 +28,7 @@ /*----- Header files ------------------------------------------------------*/ #include "tvec.h" +#include "tvec-types.h" #include "example.h" @@ -48,9 +49,6 @@ enum { /*----- Addition test -----------------------------------------------------*/ -void test_add(const struct tvec_reg *in, struct tvec_reg *out, void *ctx) - { out[RZ].v.i = add(in[RX].v.i, in[RY].v.i); } - static const struct tvec_regdef add_regs[] = { { "x", &tvty_int, RX, 0, { &tvrange_int } }, { "y", &tvty_int, RY, 0, { &tvrange_int } }, @@ -58,8 +56,11 @@ static const struct tvec_regdef add_regs[] = { TVEC_ENDREGS }; -#define ADD_TEST \ - { "add", add_regs, 0, test_add } +void test_add(const struct tvec_reg *in, struct tvec_reg *out, void *ctx) + { out[RZ].v.i = add(in[RX].v.i, in[RY].v.i); } + +static const struct tvec_test add_test = + { "add", add_regs, 0, test_add }; /*----- Greeting test -----------------------------------------------------*/ @@ -78,15 +79,15 @@ static const struct tvec_regdef greet_regs[] = { TVEC_ENDREGS }; -#define GREET_TEST \ - { "greet", greet_regs, 0, test_greet } +static const struct tvec_test greet_test = + { "greet", greet_regs, 0, test_greet }; /*----- Main program ------------------------------------------------------*/ -static const struct tvec_test tests[] = { - ADD_TEST, - GREET_TEST, - TVEC_ENDTESTS +static const struct tvec_test *const tests[] = { + &add_test, + &greet_test, + 0 }; static const struct tvec_config test_config =