aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Kramkowski <tk@the-tk.com>2020-09-10 19:12:35 +0100
committerTomasz Kramkowski <tk@the-tk.com>2020-09-10 19:12:35 +0100
commitec9cd80fa8d8e295fb2cabc0321df293b471c8be (patch)
tree149df88d73cc3cd2bee8a622d444f455e0f2ae15
parent1fc28bc0f254766730a97fe0ea3a10a4246e13fe (diff)
downloadpack-ec9cd80fa8d8e295fb2cabc0321df293b471c8be.tar.gz
pack-ec9cd80fa8d8e295fb2cabc0321df293b471c8be.tar.xz
pack-ec9cd80fa8d8e295fb2cabc0321df293b471c8be.zip
Stop naming variables after the format
This was stupid and unnecessary
-rw-r--r--test_gen.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/test_gen.c b/test_gen.c
index d4d32d9..ae796d9 100644
--- a/test_gen.c
+++ b/test_gen.c
@@ -115,21 +115,21 @@ static void generate_simple(FILE *out, enum fmt fmt)
fprintf(out, "TEST(%s)\n", cname(fi->type));
fprintf(out, "{\n");
- fprintf(out, "\t%s %c = __LINE__;\n", fi->type, fi->fmt);
+ fprintf(out, "\t%s v = __LINE__;\n", fi->type);
for (size_t e = 0; e < sizeof endian / sizeof endian[0]; e++) {
for (int i = sign ? -1 : 0; i <= 1; i++) {
- fprintf(out, "\tCHECK_UNPACK(DATA(%s), \"%s%c\", &%c);\n",
- i2bytes(endian[e].e, fi->size, i), endian[e].prefix, fi->fmt, fi->fmt);
- fprintf(out, "\tCHECK_EQUAL(PRIdMAX, (intmax_t)%c, INTMAX_C(%d));\n", fi->fmt, i);
+ fprintf(out, "\tCHECK_UNPACK(DATA(%s), \"%s%c\", &v);\n",
+ i2bytes(endian[e].e, fi->size, i), endian[e].prefix, fi->fmt);
+ fprintf(out, "\tCHECK_EQUAL(PRIdMAX, (intmax_t)v, INTMAX_C(%d));\n", i);
}
if (sign) {
- fprintf(out, "\tCHECK_UNPACK(DATA(%s), \"%s%c\", &%c);\n",
- i2bytes(endian[e].e, fi->size, fi->min), endian[e].prefix, fi->fmt, fi->fmt);
- fprintf(out, "\tCHECK_EQUAL(PRIdMAX, (intmax_t)%c, -INTMAX_C(%" PRIdMAX ")-1);\n", fi->fmt, -(fi->min + 1));
+ fprintf(out, "\tCHECK_UNPACK(DATA(%s), \"%s%c\", &v);\n",
+ i2bytes(endian[e].e, fi->size, fi->min), endian[e].prefix, fi->fmt);
+ fprintf(out, "\tCHECK_EQUAL(PRIdMAX, (intmax_t)v, -INTMAX_C(%" PRIdMAX ")-1);\n", -(fi->min + 1));
}
- fprintf(out, "\tCHECK_UNPACK(DATA(%s), \"%s%c\", &%c);\n",
- u2bytes(endian[e].e, fi->size, fi->max), endian[e].prefix, fi->fmt, fi->fmt);
- fprintf(out, "\tCHECK_EQUAL(PRIuMAX, (uintmax_t)%c, UINTMAX_C(%" PRIuMAX "));\n", fi->fmt, fi->max);
+ fprintf(out, "\tCHECK_UNPACK(DATA(%s), \"%s%c\", &v);\n",
+ u2bytes(endian[e].e, fi->size, fi->max), endian[e].prefix, fi->fmt);
+ fprintf(out, "\tCHECK_EQUAL(PRIuMAX, (uintmax_t)v, UINTMAX_C(%" PRIuMAX "));\n", fi->max);
}
fprintf(out, "\treturn true;\n");
fprintf(out, "}\n");