From 437904198ecabb9291a86ab75448c4088b679a7b Mon Sep 17 00:00:00 2001 From: Mike Gelfand Date: Mon, 29 May 2017 23:39:51 +0300 Subject: [PATCH] Transform `check_uint_eq` into generic `check_uint` (libtest) --- libtransmission/crypto-test.c | 20 ++++---- libtransmission/file-test.c | 64 +++++++++++++------------- libtransmission/json-test.c | 2 +- libtransmission/libtransmission-test.c | 15 ++---- libtransmission/libtransmission-test.h | 11 +++-- libtransmission/move-test.c | 8 ++-- libtransmission/quark-test.c | 2 +- libtransmission/rename-test.c | 48 +++++++++---------- libtransmission/rpc-test.c | 2 +- libtransmission/variant-test.c | 22 ++++----- 10 files changed, 96 insertions(+), 98 deletions(-) diff --git a/libtransmission/crypto-test.c b/libtransmission/crypto-test.c index 3c90d50e7..e60f43b58 100644 --- a/libtransmission/crypto-test.c +++ b/libtransmission/crypto-test.c @@ -236,28 +236,28 @@ static int test_base64(void) char* out; out = tr_base64_encode_str("YOYO!", &len); - check_uint_eq(strlen(out), len); + check_uint(len, ==, strlen(out)); check(base64_eq("WU9ZTyE=", out)); in = tr_base64_decode_str(out, &len); - check_uint_eq(5, len); + check_uint(len, ==, 5); check_str(in, ==, "YOYO!"); tr_free(in); tr_free(out); out = tr_base64_encode("", 0, &len); - check_uint_eq(0, len); + check_uint(len, ==, 0); check_str(out, ==, ""); tr_free(out); out = tr_base64_decode("", 0, &len); - check_uint_eq(0, len); + check_uint(len, ==, 0); check_str(out, ==, ""); tr_free(out); out = tr_base64_encode(NULL, 0, &len); - check_uint_eq(0, len); + check_uint(len, ==, 0); check(out == NULL); out = tr_base64_decode(NULL, 0, &len); - check_uint_eq(0, len); + check_uint(len, ==, 0); check(out == NULL); #define MAX_BUF_SIZE 1024 @@ -272,9 +272,9 @@ static int test_base64(void) } out = tr_base64_encode(buf, i, &len); - check_uint_eq(strlen(out), len); + check_uint(len, ==, strlen(out)); in = tr_base64_decode(out, len, &len); - check_uint_eq(i, len); + check_uint(len, ==, i); check(memcmp(in, buf, len) == 0); tr_free(in); tr_free(out); @@ -287,9 +287,9 @@ static int test_base64(void) buf[i] = '\0'; out = tr_base64_encode_str(buf, &len); - check_uint_eq(strlen(out), len); + check_uint(len, ==, strlen(out)); in = tr_base64_decode_str(out, &len); - check_uint_eq(i, len); + check_uint(len, ==, i); check_str(buf, ==, in); tr_free(in); tr_free(out); diff --git a/libtransmission/file-test.c b/libtransmission/file-test.c index 7cd8229b2..15752c533 100644 --- a/libtransmission/file-test.c +++ b/libtransmission/file-test.c @@ -183,7 +183,7 @@ static int test_get_info(void) check(tr_sys_path_get_info(path1, 0, &info, &err)); check(err == NULL); check_int(info.type, ==, TR_SYS_PATH_IS_FILE); - check_uint_eq(4, info.size); + check_uint(info.size, ==, 4); check(info.last_modified_at >= t && info.last_modified_at <= time(NULL)); /* Good file info (by handle) */ @@ -192,7 +192,7 @@ static int test_get_info(void) check(tr_sys_file_get_info(fd, &info, &err)); check(err == NULL); check_int(info.type, ==, TR_SYS_PATH_IS_FILE); - check_uint_eq(4, info.size); + check_uint(info.size, ==, 4); check(info.last_modified_at >= t && info.last_modified_at <= time(NULL)); tr_sys_file_close(fd, NULL); @@ -224,7 +224,7 @@ static int test_get_info(void) check(tr_sys_path_get_info(path1, 0, &info, &err)); check(err == NULL); check_int(info.type, ==, TR_SYS_PATH_IS_FILE); - check_uint_eq(4, info.size); + check_uint(info.size, ==, 4); check(info.last_modified_at >= t && info.last_modified_at <= time(NULL)); /* Good file info (by handle) */ @@ -233,7 +233,7 @@ static int test_get_info(void) check(tr_sys_file_get_info(fd, &info, &err)); check(err == NULL); check_int(info.type, ==, TR_SYS_PATH_IS_FILE); - check_uint_eq(4, info.size); + check_uint(info.size, ==, 4); check(info.last_modified_at >= t && info.last_modified_at <= time(NULL)); tr_sys_file_close(fd, NULL); @@ -1017,30 +1017,30 @@ static int test_file_open(void) check(err != NULL); tr_error_clear(&err); tr_sys_path_get_info(path1, TR_SYS_PATH_NO_FOLLOW, &info, NULL); - check_uint_eq(4, info.size); + check_uint(info.size, ==, 4); /* Pointer is at the end of file */ tr_sys_path_get_info(path1, TR_SYS_PATH_NO_FOLLOW, &info, NULL); - check_uint_eq(4, info.size); + check_uint(info.size, ==, 4); fd = tr_sys_file_open(path1, TR_SYS_FILE_WRITE | TR_SYS_FILE_APPEND, 0600, &err); check(fd != TR_BAD_SYS_FILE); check(err == NULL); tr_sys_file_write(fd, "s", 1, NULL, NULL); /* On *NIX, pointer is positioned on each write but not initially */ tr_sys_file_seek(fd, 0, TR_SEEK_CUR, &n, NULL); - check_uint_eq(5, n); + check_uint(n, ==, 5); tr_sys_file_close(fd, NULL); /* File gets truncated */ tr_sys_path_get_info(path1, TR_SYS_PATH_NO_FOLLOW, &info, NULL); - check_uint_eq(5, info.size); + check_uint(info.size, ==, 5); fd = tr_sys_file_open(path1, TR_SYS_FILE_WRITE | TR_SYS_FILE_TRUNCATE, 0600, &err); check(fd != TR_BAD_SYS_FILE); check(err == NULL); tr_sys_file_get_info(fd, &info, NULL); - check_uint_eq(0, info.size); + check_uint(info.size, ==, 0); tr_sys_file_close(fd, NULL); tr_sys_path_get_info(path1, TR_SYS_PATH_NO_FOLLOW, &info, NULL); - check_uint_eq(0, info.size); + check_uint(info.size, ==, 0); /* TODO: symlink and hardlink tests */ @@ -1067,69 +1067,69 @@ static int test_file_read_write_seek(void) check(tr_sys_file_seek(fd, 0, TR_SEEK_CUR, &n, &err)); check(err == NULL); - check_uint_eq(0, n); + check_uint(n, ==, 0); check(tr_sys_file_write(fd, "test", 4, &n, &err)); check(err == NULL); - check_uint_eq(4, n); + check_uint(n, ==, 4); check(tr_sys_file_seek(fd, 0, TR_SEEK_CUR, &n, &err)); check(err == NULL); - check_uint_eq(4, n); + check_uint(n, ==, 4); check(tr_sys_file_seek(fd, 0, TR_SEEK_SET, &n, &err)); check(err == NULL); - check_uint_eq(0, n); + check_uint(n, ==, 0); check(tr_sys_file_read(fd, buf, sizeof(buf), &n, &err)); check(err == NULL); - check_uint_eq(4, n); + check_uint(n, ==, 4); check_int(memcmp(buf, "test", 4), ==, 0); check(tr_sys_file_seek(fd, -3, TR_SEEK_CUR, &n, &err)); check(err == NULL); - check_uint_eq(1, n); + check_uint(n, ==, 1); check(tr_sys_file_write(fd, "E", 1, &n, &err)); check(err == NULL); - check_uint_eq(1, n); + check_uint(n, ==, 1); check(tr_sys_file_seek(fd, -2, TR_SEEK_CUR, &n, &err)); check(err == NULL); - check_uint_eq(0, n); + check_uint(n, ==, 0); check(tr_sys_file_read(fd, buf, sizeof(buf), &n, &err)); check(err == NULL); - check_uint_eq(4, n); + check_uint(n, ==, 4); check_int(memcmp(buf, "tEst", 4), ==, 0); check(tr_sys_file_seek(fd, 0, TR_SEEK_END, &n, &err)); check(err == NULL); - check_uint_eq(4, n); + check_uint(n, ==, 4); check(tr_sys_file_write(fd, " ok", 3, &n, &err)); check(err == NULL); - check_uint_eq(3, n); + check_uint(n, ==, 3); check(tr_sys_file_seek(fd, 0, TR_SEEK_SET, &n, &err)); check(err == NULL); - check_uint_eq(0, n); + check_uint(n, ==, 0); check(tr_sys_file_read(fd, buf, sizeof(buf), &n, &err)); check(err == NULL); - check_uint_eq(7, n); + check_uint(n, ==, 7); check_int(memcmp(buf, "tEst ok", 7), ==, 0); check(tr_sys_file_write_at(fd, "-", 1, 4, &n, &err)); check(err == NULL); - check_uint_eq(1, n); + check_uint(n, ==, 1); check(tr_sys_file_read_at(fd, buf, 5, 2, &n, &err)); check(err == NULL); - check_uint_eq(5, n); + check_uint(n, ==, 5); check_int(memcmp(buf, "st-ok", 5), ==, 0); @@ -1158,17 +1158,17 @@ static int test_file_truncate(void) check(tr_sys_file_truncate(fd, 10, &err)); check(err == NULL); tr_sys_file_get_info(fd, &info, NULL); - check_uint_eq(10, info.size); + check_uint(info.size, ==, 10); check(tr_sys_file_truncate(fd, 20, &err)); check(err == NULL); tr_sys_file_get_info(fd, &info, NULL); - check_uint_eq(20, info.size); + check_uint(info.size, ==, 20); check(tr_sys_file_truncate(fd, 0, &err)); check(err == NULL); tr_sys_file_get_info(fd, &info, NULL); - check_uint_eq(0, info.size); + check_uint(info.size, ==, 0); check(tr_sys_file_truncate(fd, 50, &err)); check(err == NULL); @@ -1176,7 +1176,7 @@ static int test_file_truncate(void) tr_sys_file_close(fd, NULL); tr_sys_path_get_info(path1, 0, &info, NULL); - check_uint_eq(50, info.size); + check_uint(info.size, ==, 50); fd = tr_sys_file_open(path1, TR_SYS_FILE_WRITE | TR_SYS_FILE_CREATE, 0600, NULL); @@ -1186,7 +1186,7 @@ static int test_file_truncate(void) tr_sys_file_close(fd, NULL); tr_sys_path_get_info(path1, 0, &info, NULL); - check_uint_eq(25, info.size); + check_uint(info.size, ==, 25); tr_sys_path_remove(path1, NULL); @@ -1212,7 +1212,7 @@ static int test_file_preallocate(void) { check(err == NULL); tr_sys_file_get_info(fd, &info, NULL); - check_uint_eq(50, info.size); + check_uint(info.size, ==, 50); } else { @@ -1231,7 +1231,7 @@ static int test_file_preallocate(void) { check(err == NULL); tr_sys_file_get_info(fd, &info, NULL); - check_uint_eq(500 * 1024 * 1024, info.size); + check_uint(info.size, ==, 500 * 1024 * 1024); } else { diff --git a/libtransmission/json-test.c b/libtransmission/json-test.c index c946d6c13..960aab5a8 100644 --- a/libtransmission/json-test.c +++ b/libtransmission/json-test.c @@ -179,7 +179,7 @@ static int test1(void) check(tr_variantIsDict(args)); check((ids = tr_variantDictFind(args, TR_KEY_ids)) != NULL); check(tr_variantIsList(ids)); - check_uint_eq(2, tr_variantListSize(ids)); + check_uint(tr_variantListSize(ids), ==, 2); check(tr_variantGetInt(tr_variantListChild(ids, 0), &i)); check_int(i, ==, 7); check(tr_variantGetInt(tr_variantListChild(ids, 1), &i)); diff --git a/libtransmission/libtransmission-test.c b/libtransmission/libtransmission-test.c index 2fc852c39..8fa990f66 100644 --- a/libtransmission/libtransmission-test.c +++ b/libtransmission/libtransmission-test.c @@ -89,20 +89,13 @@ bool libtest_check_int(char const* file, int line, bool pass, intmax_t lhs, intm return pass; } -bool check_uint_eq_impl(char const* file, int line, uintmax_t expected, uintmax_t actual) +bool libtest_check_uint(char const* file, int line, bool pass, uintmax_t lhs, uintmax_t rhs, char const* lhs_str, + char const* op_str, char const* rhs_str) { - bool const pass = expected == actual; - if (should_print(pass)) { - if (pass) - { - fprintf(stderr, "PASS %s:%d\n", file, line); - } - else - { - fprintf(stderr, "FAIL %s:%d, expected \"%ju\", got \"%ju\"\n", file, line, expected, actual); - } + fprintf(stderr, "%s %s:%d: %s %s %s (%ju %s %ju)\n", pass ? "PASS" : "FAIL", file, line, lhs_str, op_str, rhs_str, lhs, + op_str, rhs); } return pass; diff --git a/libtransmission/libtransmission-test.h b/libtransmission/libtransmission-test.h index 1554b2b32..3a9e02875 100644 --- a/libtransmission/libtransmission-test.h +++ b/libtransmission/libtransmission-test.h @@ -23,13 +23,14 @@ extern bool verbose; bool should_print(bool pass); bool check_condition_impl(char const* file, int line, bool condition); -bool check_uint_eq_impl(char const* file, int line, uintmax_t expected, uintmax_t actual); bool check_ptr_eq_impl(char const* file, int line, void const* expected, void const* actual); bool libtest_check_str(char const* file, int line, bool pass, char const* lhs, char const* rhs, char const* lhs_str, char const* op_str, char const* rhs_str); bool libtest_check_int(char const* file, int line, bool pass, intmax_t lhs, intmax_t rhs, char const* lhs_str, char const* op_str, char const* rhs_str); +bool libtest_check_uint(char const* file, int line, bool pass, uintmax_t lhs, uintmax_t rhs, char const* lhs_str, + char const* op_str, char const* rhs_str); /*** **** @@ -79,12 +80,16 @@ bool libtest_check_int(char const* file, int line, bool pass, intmax_t lhs, intm } \ while (0) -#define check_uint_eq(expected, actual) \ +#define check_uint(lhs, op, rhs) \ do \ { \ ++current_test; \ \ - if (!check_uint_eq_impl(__FILE__, __LINE__, (expected), (actual))) \ + uintmax_t const check_uint_lhs = (lhs); \ + uintmax_t const check_uint_rhs = (rhs); \ + \ + if (!libtest_check_uint(__FILE__, __LINE__, check_uint_lhs op check_uint_rhs, check_uint_lhs, check_uint_rhs, #lhs, \ + #op, #rhs)) \ { \ return current_test; \ } \ diff --git a/libtransmission/move-test.c b/libtransmission/move-test.c index 2e7d37411..c4b51654a 100644 --- a/libtransmission/move-test.c +++ b/libtransmission/move-test.c @@ -88,7 +88,7 @@ static int test_incomplete_dir_impl(char const* incomplete_dir, char const* down check(tr_torrentStat(tor)->leftUntilDone == tor->info.pieceSize); check_file_location(tor, 0, tr_strdup_printf("%s/%s.part", incomplete_dir, tor->info.files[0].name)); check_file_location(tor, 1, tr_buildPath(incomplete_dir, tor->info.files[1].name, NULL)); - check_uint_eq(tor->info.pieceSize, tr_torrentStat(tor)->leftUntilDone); + check_uint(tr_torrentStat(tor)->leftUntilDone, ==, tor->info.pieceSize); completeness = completeness_unset; tr_torrentSetCompletenessCallback(tor, zeroes_completeness_func, &completeness); @@ -127,7 +127,7 @@ static int test_incomplete_dir_impl(char const* incomplete_dir, char const* down } libttest_blockingTorrentVerify(tor); - check_uint_eq(0, tr_torrentStat(tor)->leftUntilDone); + check_uint(tr_torrentStat(tor)->leftUntilDone, ==, 0); while (completeness == completeness_unset && time(NULL) <= deadline) { @@ -193,7 +193,7 @@ static int test_set_location(void) tor = libttest_zero_torrent_init(session); libttest_zero_torrent_populate(tor, true); libttest_blockingTorrentVerify(tor); - check_uint_eq(0, tr_torrentStat(tor)->leftUntilDone); + check_uint(tr_torrentStat(tor)->leftUntilDone, ==, 0); /* now move it */ state = -1; @@ -208,7 +208,7 @@ static int test_set_location(void) /* confirm the torrent is still complete after being moved */ libttest_blockingTorrentVerify(tor); - check_uint_eq(0, tr_torrentStat(tor)->leftUntilDone); + check_uint(tr_torrentStat(tor)->leftUntilDone, ==, 0); /* confirm the filest really got moved */ libttest_sync(); diff --git a/libtransmission/quark-test.c b/libtransmission/quark-test.c index 34cf781b3..e26236513 100644 --- a/libtransmission/quark-test.c +++ b/libtransmission/quark-test.c @@ -21,7 +21,7 @@ static int test_static_quarks(void) char const* str; str = tr_quark_get_string((tr_quark)i, &len); - check_uint_eq(strlen(str), len); + check_uint(len, ==, strlen(str)); check(tr_quark_lookup(str, len, &q)); check_int((int)q, ==, i); } diff --git a/libtransmission/rename-test.c b/libtransmission/rename-test.c index 31a931b22..9184ebb08 100644 --- a/libtransmission/rename-test.c +++ b/libtransmission/rename-test.c @@ -32,10 +32,10 @@ static tr_session* session = NULL; tr_stat const* tst = tr_torrentStat(tor); \ check_int(tst->activity, ==, TR_STATUS_STOPPED); \ check_int(tst->error, ==, TR_STAT_OK); \ - check_uint_eq(totalSize, tst->sizeWhenDone); \ - check_uint_eq(totalSize, tst->leftUntilDone); \ - check_uint_eq(totalSize, tor->info.totalSize); \ - check_uint_eq(0, tst->haveValid); \ + check_uint(tst->sizeWhenDone, ==, totalSize); \ + check_uint(tst->leftUntilDone, ==, totalSize); \ + check_uint(tor->info.totalSize, ==, totalSize); \ + check_uint(tst->haveValid, ==, 0); \ } \ while (0) @@ -164,11 +164,11 @@ static int test_single_filename_torrent(void) st = tr_torrentStat(tor); check_int(st->activity, ==, TR_STATUS_STOPPED); check_int(st->error, ==, TR_STAT_OK); - check_uint_eq(0, st->leftUntilDone); - check_uint_eq(0, st->haveUnchecked); - check_uint_eq(0, st->desiredAvailable); - check_uint_eq(totalSize, st->sizeWhenDone); - check_uint_eq(totalSize, st->haveValid); + check_uint(st->leftUntilDone, ==, 0); + check_uint(st->haveUnchecked, ==, 0); + check_uint(st->desiredAvailable, ==, 0); + check_uint(st->sizeWhenDone, ==, totalSize); + check_uint(st->haveValid, ==, totalSize); /** *** okay! we've finally put together all the scaffolding to test @@ -303,8 +303,8 @@ static int test_multifile_torrent(void) /* sanity check the info */ check_str(tor->info.name, ==, "Felidae"); - check_uint_eq(totalSize, tor->info.totalSize); - check_uint_eq(4, tor->info.fileCount); + check_uint(tor->info.totalSize, ==, totalSize); + check_uint(tor->info.fileCount, ==, 4); for (tr_file_index_t i = 0; i < 4; ++i) { @@ -323,11 +323,11 @@ static int test_multifile_torrent(void) st = tr_torrentStat(tor); check_int(st->activity, ==, TR_STATUS_STOPPED); check_int(st->error, ==, TR_STAT_OK); - check_uint_eq(0, st->leftUntilDone); - check_uint_eq(0, st->haveUnchecked); - check_uint_eq(0, st->desiredAvailable); - check_uint_eq(totalSize, st->sizeWhenDone); - check_uint_eq(totalSize, st->haveValid); + check_uint(st->leftUntilDone, ==, 0); + check_uint(st->haveUnchecked, ==, 0); + check_uint(st->desiredAvailable, ==, 0); + check_uint(st->sizeWhenDone, ==, totalSize); + check_uint(st->haveValid, ==, totalSize); /** *** okay! let's test renaming. @@ -519,22 +519,22 @@ static int test_partial_file(void) ***/ tor = libttest_zero_torrent_init(session); - check_uint_eq(totalSize, tor->info.totalSize); - check_uint_eq(pieceSize, tor->info.pieceSize); - check_uint_eq(pieceCount, tor->info.pieceCount); + check_uint(tor->info.totalSize, ==, totalSize); + check_uint(tor->info.pieceSize, ==, pieceSize); + check_uint(tor->info.pieceCount, ==, pieceCount); check_str(tor->info.files[0].name, ==, "files-filled-with-zeroes/1048576"); check_str(tor->info.files[1].name, ==, "files-filled-with-zeroes/4096"); check_str(tor->info.files[2].name, ==, "files-filled-with-zeroes/512"); libttest_zero_torrent_populate(tor, false); fst = tr_torrentFiles(tor, NULL); - check_uint_eq(length[0] - pieceSize, fst[0].bytesCompleted); - check_uint_eq(length[1], fst[1].bytesCompleted); - check_uint_eq(length[2], fst[2].bytesCompleted); + check_uint(fst[0].bytesCompleted, ==, length[0] - pieceSize); + check_uint(fst[1].bytesCompleted, ==, length[1]); + check_uint(fst[2].bytesCompleted, ==, length[2]); tr_torrentFilesFree(fst, tor->info.fileCount); st = tr_torrentStat(tor); - check_uint_eq(totalSize, st->sizeWhenDone); - check_uint_eq(pieceSize, st->leftUntilDone); + check_uint(st->sizeWhenDone, ==, totalSize); + check_uint(st->leftUntilDone, ==, pieceSize); /*** **** diff --git a/libtransmission/rpc-test.c b/libtransmission/rpc-test.c index 9a2f0cbe7..712d00744 100644 --- a/libtransmission/rpc-test.c +++ b/libtransmission/rpc-test.c @@ -44,7 +44,7 @@ static int test_list(void) tr_rpc_parse_list_str(&top, "asdf", TR_BAD_SIZE); check(tr_variantIsString(&top)); check(tr_variantGetStr(&top, &str, &len)); - check_uint_eq(4, len); + check_uint(len, ==, 4); check_str(str, ==, "asdf"); tr_variantFree(&top); diff --git a/libtransmission/variant-test.c b/libtransmission/variant-test.c index 15f9734d5..3e675823c 100644 --- a/libtransmission/variant-test.c +++ b/libtransmission/variant-test.c @@ -100,7 +100,7 @@ static int testStr(void) n = tr_snprintf((char*)buf, sizeof(buf), "%zu:boat", (size_t)(SIZE_MAX - 2)); err = tr_bencParseStr(buf, buf + n, &end, &str, &len); check_int(err, ==, EILSEQ); - check_uint_eq(0, len); + check_uint(len, ==, 0); check(str == NULL); check(end == NULL); check(len == 0); @@ -109,7 +109,7 @@ static int testStr(void) n = tr_snprintf((char*)buf, sizeof(buf), "4:boat"); err = tr_bencParseStr(buf, buf + n, &end, &str, &len); check_int(err, ==, 0); - check_uint_eq(4, len); + check_uint(len, ==, 4); check(strncmp((char const*)str, "boat", len) == 0); check(end == buf + 6); str = NULL; @@ -119,7 +119,7 @@ static int testStr(void) /* string goes past end of buffer */ err = tr_bencParseStr(buf, buf + (n - 1), &end, &str, &len); check_int(err, ==, EILSEQ); - check_uint_eq(0, len); + check_uint(len, ==, 0); check(str == NULL); check(end == NULL); check(len == 0); @@ -128,7 +128,7 @@ static int testStr(void) n = tr_snprintf((char*)buf, sizeof(buf), "0:"); err = tr_bencParseStr(buf, buf + n, &end, &str, &len); check_int(err, ==, 0); - check_uint_eq(0, len); + check_uint(len, ==, 0); check(*str == '\0'); check(end == buf + 2); str = NULL; @@ -139,7 +139,7 @@ static int testStr(void) n = tr_snprintf((char*)buf, sizeof(buf), "3:boat"); err = tr_bencParseStr(buf, buf + n, &end, &str, &len); check_int(err, ==, 0); - check_uint_eq(3, len); + check_uint(len, ==, 3); check(strncmp((char const*)str, "boa", len) == 0); check(end == buf + 5); str = NULL; @@ -174,7 +174,7 @@ static int testString(char const* str, bool isGood) check(end == str + len); saved = tr_variantToStr(&val, TR_VARIANT_FMT_BENC, &savedLen); check_str(saved, ==, str); - check_uint_eq(savedLen, len); + check_uint(savedLen, ==, len); tr_free(saved); tr_variantFree(&val); } @@ -450,16 +450,16 @@ static int testMerge(void) check(tr_variantDictFindInt(&dest, i4, &i)); check_int(i, ==, -35); check(tr_variantDictFindStr(&dest, s5, &s, &len)); - check_uint_eq(3, len); + check_uint(len, ==, 3); check_str(s, ==, "abc"); check(tr_variantDictFindStr(&dest, s6, &s, &len)); - check_uint_eq(3, len); + check_uint(len, ==, 3); check_str(s, ==, "xyz"); check(tr_variantDictFindStr(&dest, s7, &s, &len)); - check_uint_eq(9, len); + check_uint(len, ==, 9); check_str(s, ==, "127.0.0.1"); check(tr_variantDictFindStr(&dest, s8, &s, &len)); - check_uint_eq(3, len); + check_uint(len, ==, 3); check_str(s, ==, "ghi"); tr_variantFree(&dest); @@ -569,7 +569,7 @@ static int testParse2(void) check(tr_variantDictFindBool(&top, key_bool, &boolVal)); check(boolVal == true); check(tr_variantDictFindStr(&top, key_str, &strVal, &strLen)); - check_uint_eq(16, strLen); + check_uint(strLen, ==, 16); check_str(strVal, ==, "this-is-a-string"); check(tr_variantDictFindReal(&top, key_real, &realVal)); check_int((int)(realVal * 100), ==, 50); -- 2.40.0