@@@ man wip
[mLib] / test / t / tvec-test.c
index b6ba605..04759cd 100644 (file)
@@ -190,7 +190,7 @@ static int common_setvar(struct tvec_state *tv, const char *var,
 
 static const struct tvec_vardef show_var =
   { sizeof(struct tvec_reg), common_setvar,
-    { "@show", -1, &tvty_ienum, 0, { &tvenum_bool } } };
+    { "@show", &tvty_ienum, -1, 0, { &tvenum_bool } } };
 
 static const struct tvec_vardef *common_findvar
   (struct tvec_state *tv, const char *var, void **ctx_out, void *ctx)
@@ -256,7 +256,7 @@ static void test_copy_buffer
 
 #define COPYREG(name, i, ty, argslot, argval)                          \
        static DSGINIT(const) struct tvec_regdef name##_copyregs[] = {  \
-         { #name, RVOUT, &tvty_##ty, 0, DSGINIT({ .argslot = argval }) }, \
+         { #name, &tvty_##ty, RVOUT, 0, DSGINIT({ .argslot = argval }) }, \
          { 0 }                                                         \
        };
 TYPEREGS(COPYREG)
@@ -314,16 +314,21 @@ static void test_single_deserialize
 
 #define SERREG(name, i, ty, argslot, argval)                           \
        static DSGINIT(const) struct tvec_regdef name##_serregs[] = {   \
-         { #name, RV,  &tvty_##ty, 0, DSGINIT({ .argslot = argval }) }, \
-         { "buf", RSEROUT, &tvty_bytes },                              \
-         { "rc", RRC,  &tvty_int,      TVRF_OPT,       { &tvrange_int } }, \
+         { #name,      &tvty_##ty,     RV,     0,                      \
+                                     DSGINIT({ .argslot = argval }) }, \
+         { "buf",      &tvty_bytes,    RSEROUT, 0 },                   \
+         { "rc",       &tvty_int,      RRC,    TVRF_OPT,               \
+                                                   { &tvrange_int } }, \
          TVEC_ENDREGS                                                  \
        };                                                              \
        static DSGINIT(const) struct tvec_regdef name##_deserregs[] = { \
-         { "buf", RSER, &tvty_bytes },                                 \
-         { #name, RVOUT, &tvty_##ty, 0, DSGINIT({ .argslot = argval }) }, \
-         { "left", RLEFT, &tvty_uint,  TVRF_OPT,      { &tvrange_size } }, \
-         { "rc", RRC,  &tvty_int,      TVRF_OPT,       { &tvrange_int } }, \
+         { "buf",      &tvty_bytes,    RSER,   0 },                    \
+         { #name,      &tvty_##ty,     RVOUT,  0,                      \
+                                     DSGINIT({ .argslot = argval }) }, \
+         { "left",     &tvty_uint,     RLEFT,  TVRF_OPT,               \
+                                                  { &tvrange_size } }, \
+         { "rc",       &tvty_int,      RRC,    TVRF_OPT,               \
+                                                   { &tvrange_int } }, \
          TVEC_ENDREGS                                                  \
        };
 TYPEREGS(SERREG)
@@ -423,14 +428,14 @@ static const struct tvec_ienuminfo reg_enum = { "reg", reg_assocs, 0 };
 
 static DSGINIT(const) struct tvec_regdef multi_serialize_regs[] = {
 #define DEFREG(name, i, ty, argslot, argval)                           \
-  { #name,     i,      &tvty_##ty,     TVRF_OPT,                       \
-                                           DSGINIT({ .argslot = argval }) },
+  { #name,     &tvty_##ty,     i,      TVRF_OPT,                       \
+                                     DSGINIT({ .argslot = argval }) },
   TYPEREGS(DEFREG)
 #undef DEFREG
 
-  { "rc",      RRC,    &tvty_int,      TVRF_OPT,       { &tvrange_int } },
-  { "serialized", RSEROUT, &tvty_bytes,        TVRF_OPT },
-  { "sabotage",        RSAB,   &tvty_ienum,    TVRF_OPT,       { &reg_enum } },
+  { "rc",      &tvty_int,      RRC,    TVRF_OPT,       { &tvrange_int } },
+  { "serialized", &tvty_bytes, RSEROUT, TVRF_OPT },
+  { "sabotage",        &tvty_ienum,    RSAB,   TVRF_OPT,       { &reg_enum } },
 
   TVEC_ENDREGS
 };
@@ -463,9 +468,9 @@ static const struct tvec_remotefork crash_testenv =
   { TVEC_REMOTEFORK(0, 0) };
 
 static const struct tvec_regdef crash_regs[] = {
-  { "crash",   RSAB,   &tvty_ienum,    0,              { &tvenum_bool } },
-  { "x",       RV,     &tvty_uint,     0,              { &tvrange_uint } },
-  { "z",       RVOUT,  &tvty_uint,     0,              { &tvrange_uint } },
+  { "crash",   &tvty_ienum,    RSAB,   0,              { &tvenum_bool } },
+  { "x",       &tvty_uint,     RV,     0,              { &tvrange_uint } },
+  { "z",       &tvty_uint,     RVOUT,  0,              { &tvrange_uint } },
   TVEC_ENDREGS
 };
 
@@ -496,8 +501,8 @@ static const struct tvec_remotefork sleep_testenv =
   { TVEC_REMOTEFORK(&sleep_subenv._env, 0) };
 
 static const struct tvec_regdef sleep_regs[] = {
-  { "time",    RV,     &tvty_duration, 0,              { &tvflt_nonneg } },
-  { "z",       RVOUT,  &tvty_float,    0,              { &tvflt_nonneg } },
+  { "time",    &tvty_duration, RV,     0,              { &tvflt_nonneg } },
+  { "z",       &tvty_float,    RVOUT,  0,              { &tvflt_nonneg } },
   TVEC_ENDREGS
 };