diff options
author | David Robillard <d@drobilla.net> | 2016-03-15 23:37:09 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-12-02 16:27:02 -0500 |
commit | d107eb486f24c0e68eff4e1b622850fca5f75d77 (patch) | |
tree | d8c2678be2739467005f5807f331ad4bcfa9790a /test | |
parent | 1c59b863d8c2c2d7b5531866586baf232c0047a2 (diff) | |
download | serd-d107eb486f24c0e68eff4e1b622850fca5f75d77.tar.gz serd-d107eb486f24c0e68eff4e1b622850fca5f75d77.tar.bz2 serd-d107eb486f24c0e68eff4e1b622850fca5f75d77.zip |
Remove useless character counting
Diffstat (limited to 'test')
-rw-r--r-- | test/test_node.c | 15 | ||||
-rw-r--r-- | test/test_string.c | 11 |
2 files changed, 9 insertions, 17 deletions
diff --git a/test/test_node.c b/test/test_node.c index 67958cc5..1fc7f0bd 100644 --- a/test/test_node.c +++ b/test/test_node.c @@ -86,7 +86,7 @@ test_double_to_node(void) : ((const char*)node.buf == dbl_test_strs[i]); assert(pass); const size_t len = node.buf ? strlen((const char*)node.buf) : 0; - assert(node.n_bytes == len && node.n_chars == len); + assert(node.n_bytes == len); serd_node_free(&node); } } @@ -105,7 +105,7 @@ test_integer_to_node(void) SerdNode node = serd_node_new_integer(int_test_nums[i]); assert(!strcmp((const char*)node.buf, (const char*)int_test_strs[i])); const size_t len = strlen((const char*)node.buf); - assert(node.n_bytes == len && node.n_chars == len); + assert(node.n_bytes == len); serd_node_free(&node); } @@ -123,7 +123,6 @@ test_blob_to_node(void) SerdNode blob = serd_node_new_blob(data, size, size % 5); - assert(blob.n_bytes == blob.n_chars); assert(blob.n_bytes == strlen((const char*)blob.buf)); size_t out_size = 0; @@ -163,8 +162,7 @@ test_node_from_string(void) SerdNode node = serd_node_from_string(SERD_LITERAL, (const uint8_t*)"hello\""); - assert(node.n_bytes == 6 && node.n_chars == 6 && - node.flags == SERD_HAS_QUOTE && + assert(node.n_bytes == 6 && node.flags == SERD_HAS_QUOTE && !strcmp((const char*)node.buf, "hello\"")); node = serd_node_from_string(SERD_URI, NULL); @@ -175,15 +173,14 @@ static void test_node_from_substring(void) { SerdNode empty = serd_node_from_substring(SERD_LITERAL, NULL, 32); - assert(!empty.buf && !empty.n_bytes && !empty.n_chars && !empty.flags && - !empty.type); + assert(!empty.buf && !empty.n_bytes && !empty.flags && !empty.type); SerdNode a_b = serd_node_from_substring(SERD_LITERAL, USTR("a\"bc"), 3); - assert(a_b.n_bytes == 3 && a_b.n_chars == 3 && a_b.flags == SERD_HAS_QUOTE && + assert(a_b.n_bytes == 3 && a_b.flags == SERD_HAS_QUOTE && !strncmp((const char*)a_b.buf, "a\"b", 3)); a_b = serd_node_from_substring(SERD_LITERAL, USTR("a\"bc"), 10); - assert(a_b.n_bytes == 4 && a_b.n_chars == 4 && a_b.flags == SERD_HAS_QUOTE && + assert(a_b.n_bytes == 4 && a_b.flags == SERD_HAS_QUOTE && !strncmp((const char*)a_b.buf, "a\"bc", 4)); } diff --git a/test/test_string.c b/test/test_string.c index 6767e5ae..85dccd62 100644 --- a/test/test_string.c +++ b/test/test_string.c @@ -15,15 +15,10 @@ test_strlen(void) { const uint8_t str[] = {'"', '5', 0xE2, 0x82, 0xAC, '"', '\n', 0}; - size_t n_bytes = 0; SerdNodeFlags flags = 0; - size_t len = serd_strlen(str, &n_bytes, &flags); - assert(len == 5 && n_bytes == 7 && - flags == (SERD_HAS_QUOTE | SERD_HAS_NEWLINE)); - len = serd_strlen(str, NULL, &flags); - assert(len == 5); - - assert(serd_strlen(str, &n_bytes, NULL) == 5); + size_t n_bytes = serd_strlen(str, &flags); + assert(n_bytes == 7 && flags == (SERD_HAS_QUOTE | SERD_HAS_NEWLINE)); + assert(serd_strlen(str, NULL) == 7); } static void |