Browse Source

tests: unit: Fix zassert string

Fix wrong parameter used in zassert macros.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
pull/90362/head
Krzysztof Chruściński 2 months ago committed by Benjamin Cabé
parent
commit
eafe83d3f2
  1. 7
      tests/unit/cbprintf/main.c
  2. 18
      tests/unit/crc/main.c
  3. 6
      tests/unit/math_extras/tests.inc
  4. 12
      tests/unit/timeutil/test_sync.c

7
tests/unit/cbprintf/main.c

@ -358,9 +358,7 @@ static inline bool prf_check(const char *expected, @@ -358,9 +358,7 @@ static inline bool prf_check(const char *expected,
return true;
}
#define PRF_CHECK(expected, rv) \
zassert_true(prf_check(expected, rv, __FILE__, __LINE__), \
NULL)
#define PRF_CHECK(expected, rv) zassert_true(prf_check(expected, rv, __FILE__, __LINE__))
ZTEST(prf, test_pct)
{
@ -574,8 +572,7 @@ ZTEST(prf, test_d_flags) @@ -574,8 +572,7 @@ ZTEST(prf, test_d_flags)
reset_out();
rc = rawprf("/%#d/% +d/%-04d/%06.4d/", sv, sv, sv, sv);
zassert_equal(rc, 22, "rc %d", rc);
zassert_equal(strncmp("/123/+123/123 / 0123/",
buf, rc), 0, NULL);
zassert_equal(strncmp("/123/+123/123 / 0123/", buf, rc), 0);
}
ZTEST(prf, test_x_length)

18
tests/unit/crc/main.c

@ -43,11 +43,11 @@ ZTEST(crc, test_crc32c) @@ -43,11 +43,11 @@ ZTEST(crc, test_crc32c)
/* Single streams */
zassert_equal(crc32_c(0, test1, sizeof(test1), true, true),
0xE16DCDEE, NULL);
0xE16DCDEE);
zassert_equal(crc32_c(0, test2, sizeof(test2), true, true),
0xE3069283, NULL);
0xE3069283);
zassert_equal(crc32_c(0, test3, sizeof(test3), true, true),
0xFCDEB58D, NULL);
0xFCDEB58D);
/* Continuous streams - test1, test2 and test3 are considered part
* of one big stream whose CRC needs to be calculated. Note that the
@ -55,11 +55,11 @@ ZTEST(crc, test_crc32c) @@ -55,11 +55,11 @@ ZTEST(crc, test_crc32c)
* second to third and so on.
*/
zassert_equal(crc32_c(0, test1, sizeof(test1), true, false),
0x1E923211, NULL);
0x1E923211);
zassert_equal(crc32_c(0x1E923211, test2, sizeof(test2), false, false),
0xB2983B83, NULL);
0xB2983B83);
zassert_equal(crc32_c(0xB2983B83, test3, sizeof(test3), false, true),
0x7D4F9D21, NULL);
0x7D4F9D21);
}
ZTEST(crc, test_crc32_ieee)
@ -142,7 +142,7 @@ ZTEST(crc, test_crc16_ccitt) @@ -142,7 +142,7 @@ ZTEST(crc, test_crc16_ccitt)
* check=0x906e
*/
zassert_equal(crc16_ccitt(0xffff, test2, sizeof(test2)) ^ 0xffff,
0x906e, NULL);
0x906e);
/* Appending the CRC to a buffer and computing the CRC over
* the extended buffer leaves a residual of zero.
@ -168,9 +168,9 @@ ZTEST(crc, test_crc16_ccitt_for_ppp) @@ -168,9 +168,9 @@ ZTEST(crc, test_crc16_ccitt_for_ppp)
uint8_t test2[] = { '1', '2', '3', '4', '5', '6', '7', '8', '9' };
zassert_equal(crc16_ccitt(0xffff, test0, sizeof(test0)),
0xf0b8, NULL);
0xf0b8);
zassert_equal(crc16_ccitt(0xffff, test2, sizeof(test2)) ^ 0xFFFF,
0x906e, NULL);
0x906e);
}
ZTEST(crc, test_crc16_itu_t)

6
tests/unit/math_extras/tests.inc

@ -174,8 +174,6 @@ static void VNAME(u64_ctz)(void) @@ -174,8 +174,6 @@ static void VNAME(u64_ctz)(void)
zassert_equal(u64_count_trailing_zeros(0x00f00f00), 8);
zassert_equal(u64_count_trailing_zeros(0xf00ffc00), 10);
zassert_equal(u64_count_trailing_zeros(0xffffffffffffffffull), 0);
zassert_equal(u64_count_trailing_zeros(0x8000000080000000ull), 31,
NULL);
zassert_equal(u64_count_trailing_zeros(0xc000000000000000ull), 62,
NULL);
zassert_equal(u64_count_trailing_zeros(0x8000000080000000ull), 31);
zassert_equal(u64_count_trailing_zeros(0xc000000000000000ull), 62);
}

12
tests/unit/timeutil/test_sync.c

@ -233,7 +233,7 @@ static void tref_from_local(const char *tag, @@ -233,7 +233,7 @@ static void tref_from_local(const char *tag,
zassert_equal(rv, 0,
"%s: unexpected init: %d", tag, rv);
zassert_equal(ss.skew, 1.0,
"%s: unexpected skew");
"%s: unexpected skew", tag);
rv = timeutil_sync_ref_from_local(&ss, ss.base.local, NULL);
zassert_equal(rv, -EINVAL,
@ -241,19 +241,19 @@ static void tref_from_local(const char *tag, @@ -241,19 +241,19 @@ static void tref_from_local(const char *tag,
rv = timeutil_sync_ref_from_local(&ss, ss.base.local, &ref);
zassert_equal(rv, 0,
"%s: unexpected fail", tag, rv);
"%s: unexpected fail %d", tag, rv);
zassert_equal(ref, ss.base.ref,
"%s: unexpected base convert", tag);
rv = timeutil_sync_ref_from_local(&ss, 0, &ref);
zassert_equal(rv, 0,
"%s: unexpected local=0 fail", tag, rv);
"%s: unexpected local=0 fail %d", tag, rv);
zassert_equal(ref, scale_ref(5, cfg),
"%s: unexpected local=0 ref", tag);
rv = timeutil_sync_ref_from_local(&ss, ss.base.local, &ref);
zassert_equal(rv, 0,
"%s: unexpected local=base fail", tag, rv);
"%s: unexpected local=base fail, %d", tag, rv);
zassert_equal(ref, ss.base.ref,
"%s: unexpected local=base ref", tag);
@ -314,11 +314,11 @@ static void tlocal_from_ref(const char *tag, @@ -314,11 +314,11 @@ static void tlocal_from_ref(const char *tag,
rv = timeutil_sync_local_from_ref(&ss, ss.base.ref, NULL);
zassert_equal(rv, -EINVAL,
"%s: unexpected missing dest", tag, rv);
"%s: unexpected missing dest %d", tag, rv);
rv = timeutil_sync_local_from_ref(&ss, ss.base.ref, &local);
zassert_equal(rv, 0,
"%s: unexpected fail", tag, rv);
"%s: unexpected fail %d", tag, rv);
zassert_equal(local, ss.base.local,
"%s: unexpected base convert", tag);

Loading…
Cancel
Save