diff --git a/src/cmc/intervalheap.h b/src/cmc/intervalheap.h index 2c02201..e5d9b1b 100644 --- a/src/cmc/intervalheap.h +++ b/src/cmc/intervalheap.h @@ -798,11 +798,11 @@ struct cmc_callbacks_intervalheap V element1 = _heap1_->buffer[i / 2].data[i % 2]; \ V element2 = _heap2_->buffer[i / 2].data[i % 2]; \ \ - if (_heap1_->f_val->cmp(element1, element2) == 0) \ - return true; \ + if (_heap1_->f_val->cmp(element1, element2) != 0) \ + return false; \ } \ \ - return false; \ + return true; \ } \ \ struct cmc_string PFX##_to_string(struct SNAME *_heap_) \ diff --git a/src/cmc/list.h b/src/cmc/list.h index 2662686..560e1a8 100644 --- a/src/cmc/list.h +++ b/src/cmc/list.h @@ -867,7 +867,7 @@ struct cmc_callbacks_list return false; \ } \ \ - return false; \ + return true; \ } \ \ struct cmc_string PFX##_to_string(struct SNAME *_list_) \ diff --git a/tests/main/unt/list.c b/tests/main/unt/list.c index 53e51c3..0628512 100644 --- a/tests/main/unt/list.c +++ b/tests/main/unt/list.c @@ -485,7 +485,15 @@ CMC_CREATE_UNIT(list_test, true, { cmc_assert_equals(int32_t, cmc_flags.OK, l_flag(l)); cmc_assert_equals(int32_t, cmc_flags.OK, l_flag(l3)); + // equals + l->flag = cmc_flags.ERROR; + l3->flag = cmc_flags.ERROR; + cmc_assert(l_equals(l, l3)); + cmc_assert_equals(int32_t, cmc_flags.OK, l_flag(l)); + cmc_assert_equals(int32_t, cmc_flags.OK, l_flag(l3)); + l_free(l); l_free(l2); + l_free(l3); }); })