diff options
author | David Robillard <d@drobilla.net> | 2020-12-31 15:15:05 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-12-31 15:21:29 +0100 |
commit | 741c3349b09c8774fcd013e3bdd7d9e7f6b470ce (patch) | |
tree | a941f6567b85255570e5492f3c66a842704ba9f7 /test/strindex_test.c | |
parent | 841c766d86dc35ab37c4fef8ec866d06c41bc383 (diff) | |
download | zix-741c3349b09c8774fcd013e3bdd7d9e7f6b470ce.tar.gz zix-741c3349b09c8774fcd013e3bdd7d9e7f6b470ce.tar.bz2 zix-741c3349b09c8774fcd013e3bdd7d9e7f6b470ce.zip |
Format all code with clang-format
Diffstat (limited to 'test/strindex_test.c')
-rw-r--r-- | test/strindex_test.c | 54 |
1 files changed, 26 insertions, 28 deletions
diff --git a/test/strindex_test.c b/test/strindex_test.c index 1dcd062..d19d77e 100644 --- a/test/strindex_test.c +++ b/test/strindex_test.c @@ -25,37 +25,35 @@ ZIX_LOG_FUNC(1, 2) static int test_fail(const char* fmt, ...) { - va_list args; - va_start(args, fmt); - fprintf(stderr, "error: "); - vfprintf(stderr, fmt, args); - va_end(args); - return 1; + va_list args; + va_start(args, fmt); + fprintf(stderr, "error: "); + vfprintf(stderr, fmt, args); + va_end(args); + return 1; } int main(void) { - const char* str = "BANANA"; - const size_t str_len = strlen(str); - ZixStrindex* strindex = zix_strindex_new(str); - - for (size_t l = 1; l <= str_len; ++l) { - for (size_t i = 0; i < str_len - l; ++i) { - char* match = NULL; - ZixStatus ret = zix_strindex_find(strindex, str + i, &match); - if (ret) { - return test_fail("No match for substring at %zu length %zu\n", - i, l); - } - - if (strncmp(str + i, match, l)) { - return test_fail("Bad match for substring at %zu length %zu\n", - i, l); - } - } - } - - zix_strindex_free(strindex); - return 0; + const char* str = "BANANA"; + const size_t str_len = strlen(str); + ZixStrindex* strindex = zix_strindex_new(str); + + for (size_t l = 1; l <= str_len; ++l) { + for (size_t i = 0; i < str_len - l; ++i) { + char* match = NULL; + ZixStatus ret = zix_strindex_find(strindex, str + i, &match); + if (ret) { + return test_fail("No match for substring at %zu length %zu\n", i, l); + } + + if (strncmp(str + i, match, l)) { + return test_fail("Bad match for substring at %zu length %zu\n", i, l); + } + } + } + + zix_strindex_free(strindex); + return 0; } |