chiark / gitweb /
@@@ fltfmt mess
[mLib] / utils / t / versioncmp-test.c
index c9090a3899908269e6b5ff6b809882f6cd0b9c3f..f0df250ed6fa84be56020283ad7004b3beedeed4 100644 (file)
@@ -26,6 +26,8 @@
  */
 
 #include "tvec.h"
+#include "tvec-types.h"
+
 #include "versioncmp.h"
 
 enum {
@@ -33,9 +35,12 @@ enum {
   RV0 = NROUT, RV1, NREG
 };
 
-static void test_versioncmp(const struct tvec_reg *in, struct tvec_reg *out,
-                           void *ctx)
-  { out[RRC].v.i = versioncmp(in[RV0].v.text.p, in[RV1].v.text.p); }
+static const struct tvec_regdef versioncmp_regs[] = {
+  { "v0",      &tvty_text,     RV0,    0 },
+  { "v1",      &tvty_text,     RV1,    0 },
+  { "rc",      &tvty_ienum,    RRC,    0,              { &tvenum_cmp } },
+  TVEC_ENDREGS
+};
 
 static void swap_test(struct tvec_state *tv, tvec_testfn *fn, void *ctx)
 {
@@ -47,19 +52,16 @@ static void swap_test(struct tvec_state *tv, tvec_testfn *fn, void *ctx)
   tv->in[RRC].v.i = -tv->in[RRC].v.i;
   fn(tv->in, tv->out, 0); tvec_check(tv, "swapped");
 }
-static const struct tvec_env swap_testenv = { 0, 0, 0, 0, swap_test, 0, 0 };
 
-static const struct tvec_regdef versioncmp_regs[] = {
-  { "v0",      &tvty_text,     RV0,    0 },
-  { "v1",      &tvty_text,     RV1,    0 },
-  { "rc",      &tvty_ienum,    RRC,    0,              { &tvenum_cmp } },
-  TVEC_ENDREGS
-};
+static void test_versioncmp(const struct tvec_reg *in, struct tvec_reg *out,
+                           void *ctx)
+  { out[RRC].v.i = versioncmp(in[RV0].v.text.p, in[RV1].v.text.p); }
 
-static const struct tvec_test tests[] = {
-  { "versioncmp", versioncmp_regs, &swap_testenv, test_versioncmp },
-  TVEC_ENDTESTS
-};
+static const struct tvec_env swap_testenv = { 0, 0, 0, 0, swap_test, 0, 0 };
+static const struct tvec_test versioncmp_test =
+  { "versioncmp", versioncmp_regs, &swap_testenv, test_versioncmp };
+
+static const struct tvec_test *const tests[] = { &versioncmp_test, 0 };
 
 static const struct tvec_config testconfig =
   { tests, NROUT, NREG, sizeof(struct tvec_reg) };