diff options
author | David Robillard <d@drobilla.net> | 2024-11-13 12:00:12 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2024-11-13 12:00:12 -0500 |
commit | 5b48aea9d55b062fb26825a0ab905cfbe3a77f23 (patch) | |
tree | 84a2bda24f2eed318ea5a91343e956735148e07a /test | |
parent | 7f760acfdfa228f090332230f119072fb95c1aa4 (diff) | |
download | sord-5b48aea9d55b062fb26825a0ab905cfbe3a77f23.tar.gz sord-5b48aea9d55b062fb26825a0ab905cfbe3a77f23.tar.bz2 sord-5b48aea9d55b062fb26825a0ab905cfbe3a77f23.zip |
Fix "suspicious" string comparisons
I think this one is a bit silly and amateurish, but whatever.
Diffstat (limited to 'test')
-rw-r--r-- | test/test_sord.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/test/test_sord.c b/test/test_sord.c index 9c4b3c7..7ad9da7 100644 --- a/test/test_sord.c +++ b/test/test_sord.c @@ -531,7 +531,7 @@ main(void) size_t n_bytes = 0U; size_t n_chars = 0U; const uint8_t* str = sord_node_get_string_counted(lit_id2, &n_bytes); - if (strcmp((const char*)str, "hello")) { + if (!!strcmp((const char*)str, "hello")) { return test_fail("Literal node corrupt\n"); } else if (n_bytes != strlen("hello")) { return test_fail("ASCII literal byte count incorrect\n"); @@ -540,7 +540,7 @@ main(void) str = sord_node_get_string_measured(lit_id2, &n_bytes, &n_chars); if (n_bytes != strlen("hello") || n_chars != strlen("hello")) { return test_fail("ASCII literal measured length incorrect\n"); - } else if (strcmp((const char*)str, "hello")) { + } else if (!!strcmp((const char*)str, "hello")) { return test_fail("ASCII literal string incorrect\n"); } @@ -549,7 +549,7 @@ main(void) return test_fail("Multi-byte literal byte count incorrect\n"); } else if (n_chars != 2) { return test_fail("Multi-byte literal character count incorrect\n"); - } else if (strcmp((const char*)str, (const char*)ni_hao)) { + } else if (!!strcmp((const char*)str, (const char*)ni_hao)) { return test_fail("Multi-byte literal string incorrect\n"); } @@ -582,8 +582,8 @@ main(void) // Check relative URI construction SordNode* reluri = sord_new_relative_uri(world, USTR("a/b"), USTR("http://example.org/")); - if (strcmp((const char*)sord_node_get_string(reluri), - "http://example.org/a/b")) { + if (!!strcmp((const char*)sord_node_get_string(reluri), + "http://example.org/a/b")) { fprintf(stderr, "Fail: Bad relative URI constructed: <%s>\n", sord_node_get_string(reluri)); @@ -591,8 +591,8 @@ main(void) } SordNode* reluri2 = sord_new_relative_uri( world, USTR("http://drobilla.net/"), USTR("http://example.org/")); - if (strcmp((const char*)sord_node_get_string(reluri2), - "http://drobilla.net/")) { + if (!!strcmp((const char*)sord_node_get_string(reluri2), + "http://drobilla.net/")) { fprintf(stderr, "Fail: Bad relative URI constructed: <%s>\n", sord_node_get_string(reluri)); |