X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fdaemon%2Futils_heap_test.c;h=dec84f94bf0377b9b44118f47e54248db12eb590;hb=c7c89cc9618ef25cc9b0861ac2782cb1a5d6782d;hp=6ef80475c0bde77931173b0d50231561a84934af;hpb=6a1a62048b6d0d2ddf5c17295609d3ebf010f40b;p=collectd.git diff --git a/src/daemon/utils_heap_test.c b/src/daemon/utils_heap_test.c index 6ef80475..dec84f94 100644 --- a/src/daemon/utils_heap_test.c +++ b/src/daemon/utils_heap_test.c @@ -25,11 +25,11 @@ */ #include "collectd.h" + #include "testing.h" #include "utils_heap.h" -static int compare (void const *v0, void const *v1) -{ +static int compare(void const *v0, void const *v1) { int const *i0 = v0; int const *i1 = v1; @@ -41,31 +41,27 @@ static int compare (void const *v0, void const *v1) return 0; } -DEF_TEST(simple) -{ - int values[] = { 9, 5, 6, 1, 3, 4, 0, 8, 2, 7 }; - int i; +DEF_TEST(simple) { + int values[] = {9, 5, 6, 1, 3, 4, 0, 8, 2, 7}; c_heap_t *h; - CHECK_NOT_NULL(h = c_heap_create (compare)); - for (i = 0; i < 10; i++) - CHECK_ZERO(c_heap_insert (h, &values[i])); + CHECK_NOT_NULL(h = c_heap_create(compare)); + for (int i = 0; i < 10; i++) + CHECK_ZERO(c_heap_insert(h, &values[i])); - for (i = 0; i < 5; i++) - { + for (int i = 0; i < 5; i++) { int *ret = NULL; CHECK_NOT_NULL(ret = c_heap_get_root(h)); OK(*ret == i); } - CHECK_ZERO(c_heap_insert (h, &values[6] /* = 0 */)); - CHECK_ZERO(c_heap_insert (h, &values[3] /* = 1 */)); - CHECK_ZERO(c_heap_insert (h, &values[8] /* = 2 */)); - CHECK_ZERO(c_heap_insert (h, &values[4] /* = 3 */)); - CHECK_ZERO(c_heap_insert (h, &values[5] /* = 4 */)); + CHECK_ZERO(c_heap_insert(h, &values[6] /* = 0 */)); + CHECK_ZERO(c_heap_insert(h, &values[3] /* = 1 */)); + CHECK_ZERO(c_heap_insert(h, &values[8] /* = 2 */)); + CHECK_ZERO(c_heap_insert(h, &values[4] /* = 3 */)); + CHECK_ZERO(c_heap_insert(h, &values[5] /* = 4 */)); - for (i = 0; i < 10; i++) - { + for (int i = 0; i < 10; i++) { int *ret = NULL; CHECK_NOT_NULL(ret = c_heap_get_root(h)); OK(*ret == i); @@ -75,11 +71,8 @@ DEF_TEST(simple) return (0); } -int main (void) -{ +int main(void) { RUN_TEST(simple); END_TEST; } - -/* vim: set sw=2 sts=2 et : */