From 2929b1ba2015bbb62ae57f49a12f2575221753bf Mon Sep 17 00:00:00 2001 From: "Martine S. Lenders" Date: Tue, 25 Feb 2020 17:47:28 +0100 Subject: [PATCH] unittests: tests-sixlowpan_ctx: fix prefix check The result must be checked for being greater or equal to the targeted value. So for the [Yoda conditions] in those unittests the comparison mast be lesser or equal. [Yoda conditions]: https://en.wikipedia.org/wiki/Yoda_conditions --- tests/unittests/tests-sixlowpan_ctx/tests-sixlowpan_ctx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/unittests/tests-sixlowpan_ctx/tests-sixlowpan_ctx.c b/tests/unittests/tests-sixlowpan_ctx/tests-sixlowpan_ctx.c index 907f43e87b..e4dfb9d40f 100644 --- a/tests/unittests/tests-sixlowpan_ctx/tests-sixlowpan_ctx.c +++ b/tests/unittests/tests-sixlowpan_ctx/tests-sixlowpan_ctx.c @@ -129,7 +129,7 @@ static void test_sixlowpan_ctx_lookup_addr__same_addr(void) TEST_ASSERT_EQUAL_INT(GNRC_SIXLOWPAN_CTX_FLAGS_COMP | DEFAULT_TEST_ID, ctx->flags_id); TEST_ASSERT_EQUAL_INT(DEFAULT_TEST_PREFIX_LEN, ctx->prefix_len); TEST_ASSERT(TEST_UINT16 >= ctx->ltime); - TEST_ASSERT(DEFAULT_TEST_PREFIX_LEN >= ipv6_addr_match_prefix(&addr, &ctx->prefix)); + TEST_ASSERT(DEFAULT_TEST_PREFIX_LEN <= ipv6_addr_match_prefix(&addr, &ctx->prefix)); } static void test_sixlowpan_ctx_lookup_addr__other_addr_same_prefix(void) @@ -144,7 +144,7 @@ static void test_sixlowpan_ctx_lookup_addr__other_addr_same_prefix(void) TEST_ASSERT_EQUAL_INT(GNRC_SIXLOWPAN_CTX_FLAGS_COMP | DEFAULT_TEST_ID, ctx->flags_id); TEST_ASSERT_EQUAL_INT(DEFAULT_TEST_PREFIX_LEN, ctx->prefix_len); TEST_ASSERT(TEST_UINT16 >= ctx->ltime); - TEST_ASSERT(DEFAULT_TEST_PREFIX_LEN >= ipv6_addr_match_prefix(&addr1, &ctx->prefix)); + TEST_ASSERT(DEFAULT_TEST_PREFIX_LEN <= ipv6_addr_match_prefix(&addr1, &ctx->prefix)); } static void test_sixlowpan_ctx_lookup_addr__other_addr_other_prefix(void) @@ -179,7 +179,7 @@ static void test_sixlowpan_ctx_lookup_id__success(void) TEST_ASSERT_EQUAL_INT(GNRC_SIXLOWPAN_CTX_FLAGS_COMP | DEFAULT_TEST_ID, ctx->flags_id); TEST_ASSERT_EQUAL_INT(DEFAULT_TEST_PREFIX_LEN, ctx->prefix_len); TEST_ASSERT(TEST_UINT16 >= ctx->ltime); - TEST_ASSERT(DEFAULT_TEST_PREFIX_LEN >= ipv6_addr_match_prefix(&addr, &ctx->prefix)); + TEST_ASSERT(DEFAULT_TEST_PREFIX_LEN <= ipv6_addr_match_prefix(&addr, &ctx->prefix)); } static void test_sixlowpan_ctx_remove(void)