chiark / gitweb /
@@@ more mess
[mLib] / test / example / testex.c
index c8db11432cfe7edd056c04a99e79470f80daaf26..dd9fb9ee726a6c31d3a7c765d96086691276477b 100644 (file)
@@ -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 =