mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-17 16:32:11 +01:00
Rename test/c test_cases loop variable
This commit is contained in:
1 parent
2278a47cc6
commit
1da8110462
3 files changed
+22
-22
No files matched your search
@@ -131,12 +131,12 @@ test_wuffs_adler32_golden() {
|
||||
},
|
||||
};
|
||||
|
||||
int i;
|
||||
for (i = 0; i < WUFFS_TESTLIB_ARRAY_SIZE(test_cases); i++) {
|
||||
int tc;
|
||||
for (tc = 0; tc < WUFFS_TESTLIB_ARRAY_SIZE(test_cases); tc++) {
|
||||
wuffs_base__io_buffer src = ((wuffs_base__io_buffer){
|
||||
.data = global_src_slice,
|
||||
});
|
||||
CHECK_STRING(read_file(&src, test_cases[i].filename));
|
||||
CHECK_STRING(read_file(&src, test_cases[tc].filename));
|
||||
|
||||
int j;
|
||||
for (j = 0; j < 2; j++) {
|
||||
@@ -163,10 +163,10 @@ test_wuffs_adler32_golden() {
|
||||
num_bytes += data.len;
|
||||
} while (num_bytes < src.meta.wi);
|
||||
|
||||
if (have != test_cases[i].want) {
|
||||
RETURN_FAIL("i=%d, j=%d, filename=\"%s\": have 0x%08" PRIX32
|
||||
if (have != test_cases[tc].want) {
|
||||
RETURN_FAIL("tc=%d, j=%d, filename=\"%s\": have 0x%08" PRIX32
|
||||
", want 0x%08" PRIX32 "\n",
|
||||
i, j, test_cases[i].filename, have, test_cases[i].want);
|
||||
tc, j, test_cases[tc].filename, have, test_cases[tc].want);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -131,12 +131,12 @@ test_wuffs_crc32_ieee_golden() {
|
||||
},
|
||||
};
|
||||
|
||||
int i;
|
||||
for (i = 0; i < WUFFS_TESTLIB_ARRAY_SIZE(test_cases); i++) {
|
||||
int tc;
|
||||
for (tc = 0; tc < WUFFS_TESTLIB_ARRAY_SIZE(test_cases); tc++) {
|
||||
wuffs_base__io_buffer src = ((wuffs_base__io_buffer){
|
||||
.data = global_src_slice,
|
||||
});
|
||||
CHECK_STRING(read_file(&src, test_cases[i].filename));
|
||||
CHECK_STRING(read_file(&src, test_cases[tc].filename));
|
||||
|
||||
int j;
|
||||
for (j = 0; j < 2; j++) {
|
||||
@@ -163,10 +163,10 @@ test_wuffs_crc32_ieee_golden() {
|
||||
num_bytes += data.len;
|
||||
} while (num_bytes < src.meta.wi);
|
||||
|
||||
if (have != test_cases[i].want) {
|
||||
RETURN_FAIL("i=%d, j=%d, filename=\"%s\": have 0x%08" PRIX32
|
||||
if (have != test_cases[tc].want) {
|
||||
RETURN_FAIL("tc=%d, j=%d, filename=\"%s\": have 0x%08" PRIX32
|
||||
", want 0x%08" PRIX32,
|
||||
i, j, test_cases[i].filename, have, test_cases[i].want);
|
||||
tc, j, test_cases[tc].filename, have, test_cases[tc].want);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+10
-10
@@ -103,15 +103,15 @@ test_strconv_parse_number_i64() {
|
||||
{.want = fail, .str = "9223372036854775808"}, // 1 << 63.
|
||||
};
|
||||
|
||||
int i;
|
||||
for (i = 0; i < WUFFS_TESTLIB_ARRAY_SIZE(test_cases); i++) {
|
||||
int tc;
|
||||
for (tc = 0; tc < WUFFS_TESTLIB_ARRAY_SIZE(test_cases); tc++) {
|
||||
wuffs_base__result_i64 r =
|
||||
wuffs_base__parse_number_i64(wuffs_base__make_slice_u8(
|
||||
(void*)test_cases[i].str, strlen(test_cases[i].str)));
|
||||
(void*)test_cases[tc].str, strlen(test_cases[tc].str)));
|
||||
int64_t have = (r.status.repr == NULL) ? r.value : fail;
|
||||
if (have != test_cases[i].want) {
|
||||
if (have != test_cases[tc].want) {
|
||||
RETURN_FAIL("\"%s\": have 0x%" PRIX64 ", want 0x%" PRIX64,
|
||||
test_cases[i].str, have, test_cases[i].want);
|
||||
test_cases[tc].str, have, test_cases[tc].want);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,15 +183,15 @@ test_strconv_parse_number_u64() {
|
||||
{.want = fail, .str = "x"},
|
||||
};
|
||||
|
||||
int i;
|
||||
for (i = 0; i < WUFFS_TESTLIB_ARRAY_SIZE(test_cases); i++) {
|
||||
int tc;
|
||||
for (tc = 0; tc < WUFFS_TESTLIB_ARRAY_SIZE(test_cases); tc++) {
|
||||
wuffs_base__result_u64 r =
|
||||
wuffs_base__parse_number_u64(wuffs_base__make_slice_u8(
|
||||
(void*)test_cases[i].str, strlen(test_cases[i].str)));
|
||||
(void*)test_cases[tc].str, strlen(test_cases[tc].str)));
|
||||
uint64_t have = (r.status.repr == NULL) ? r.value : fail;
|
||||
if (have != test_cases[i].want) {
|
||||
if (have != test_cases[tc].want) {
|
||||
RETURN_FAIL("\"%s\": have 0x%" PRIX64 ", want 0x%" PRIX64,
|
||||
test_cases[i].str, have, test_cases[i].want);
|
||||
test_cases[tc].str, have, test_cases[tc].want);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user