Skip to content

Commit 99d24d4

Browse files
committed
various bug fixes and tweaks to the tests
1 parent c29eb97 commit 99d24d4

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

src/lib/util/test/dbuff_tests.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ static void test_dbuff_out(void)
472472
TEST_CHECK(fr_dbuff_in(&dbuff2, *(uint64_t *)&dval1) == 8);
473473
fr_dbuff_set_to_start(&dbuff2);
474474
TEST_CHECK(fr_dbuff_out(&dval2, &dbuff2) == 8);
475-
TEST_CHECK(memcmp(&fval1, &fval2, sizeof(fval1)) == 0);
475+
TEST_CHECK(memcmp(&dval1, &dval2, sizeof(dval1)) == 0);
476476

477477
TEST_CASE("Check variable length uint64_t read");
478478
fr_dbuff_set_to_start(&dbuff1);

src/lib/util/test/lst_tests.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ static void lst_iter(void)
397397
fr_lst_foreach(lst, lst_thing, item) {
398398
total += item->data;
399399
}}
400-
TEST_CHECK(total = 190);
400+
TEST_CHECK(total == 190);
401401

402402
talloc_free(lst);
403403
}

src/lib/util/test/minmax_heap_tests.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ static void populate_values(minmax_heap_thing values[], unsigned int len)
7777
#define NVALUES 20
7878
static void minmax_heap_test_basic(void)
7979
{
80+
unsigned int i;
8081
fr_minmax_heap_t *hp;
8182
minmax_heap_thing values[NVALUES];
8283

@@ -88,12 +89,12 @@ static void minmax_heap_test_basic(void)
8889
/*
8990
* minmax heaps can get the minimum value...
9091
*/
91-
for (unsigned int i = 0; i < NVALUES; i++) {
92+
for (i = 0; i < NVALUES; i++) {
9293
TEST_CHECK(fr_minmax_heap_insert(hp, &values[i]) >= 0);
9394
TEST_CHECK(fr_minmax_heap_entry_inserted(values[i].idx));
9495
}
9596

96-
for (unsigned int i = 0; i < NVALUES; i++) {
97+
for (i = 0; i < NVALUES; i++) {
9798
minmax_heap_thing *value = fr_minmax_heap_min_pop(hp);
9899

99100
TEST_CHECK(value != NULL);
@@ -105,12 +106,12 @@ static void minmax_heap_test_basic(void)
105106
/*
106107
* ...or the maximum value.
107108
*/
108-
for (unsigned int i = 0; i < NVALUES; i++) {
109+
for (i = 0; i < NVALUES; i++) {
109110
TEST_CHECK(fr_minmax_heap_insert(hp, &values[i]) >= 0);
110111
TEST_CHECK(fr_minmax_heap_entry_inserted(values[i].idx));
111112
}
112113

113-
for (unsigned int i = NVALUES; --i > 0; ) {
114+
for (i = NVALUES; i-- > 0; ) {
114115
minmax_heap_thing *value = fr_minmax_heap_max_pop(hp);
115116

116117
TEST_CHECK(value != NULL);
@@ -626,7 +627,7 @@ static void minmax_heap_iter(void)
626627
fr_minmax_heap_foreach(hp, minmax_heap_thing, item) {
627628
total += item->data;
628629
}}
629-
TEST_CHECK(total = 190);
630+
TEST_CHECK(total == 190);
630631

631632
talloc_free(hp);
632633
}

0 commit comments

Comments
 (0)