diff options
author | David Robillard <d@drobilla.net> | 2022-08-09 09:38:11 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-08-09 09:38:11 -0400 |
commit | 1b32cb74f84178d0a5ff6068d800c82318e55ec6 (patch) | |
tree | df2914df4e28548a323d740b8388e6ec8e4b7751 | |
parent | 14f422f6355aaa109d030b81203eb090ad7d2663 (diff) | |
download | serd-1b32cb74f84178d0a5ff6068d800c82318e55ec6.tar.gz serd-1b32cb74f84178d0a5ff6068d800c82318e55ec6.tar.bz2 serd-1b32cb74f84178d0a5ff6068d800c82318e55ec6.zip |
Fix array size warning
-rw-r--r-- | test/test_node.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/test/test_node.c b/test/test_node.c index 9a2db562..fab1c3e9 100644 --- a/test/test_node.c +++ b/test/test_node.c @@ -107,18 +107,22 @@ test_double_to_node(void) static void test_integer_to_node(void) { - const long int_test_nums[] = {0, -0, -23, 23, -12340, 1000, -1000}; +#define N_TEST_NUMS 7U - const char* int_test_strs[] = { + const long int_test_nums[N_TEST_NUMS] = {0, -0, -23, 23, -12340, 1000, -1000}; + + const char* int_test_strs[N_TEST_NUMS] = { "0", "0", "-23", "23", "-12340", "1000", "-1000"}; - for (size_t i = 0; i < sizeof(int_test_nums) / sizeof(double); ++i) { + for (size_t i = 0; i < N_TEST_NUMS; ++i) { 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); serd_node_free(&node); } + +#undef N_TEST_NUMS } static void |