Skip to content

Commit eafe83d

Browse files
nordic-krchkartben
authored andcommitted
tests: unit: Fix zassert string
Fix wrong parameter used in zassert macros. Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
1 parent 6f4f72d commit eafe83d

File tree

4 files changed

+19
-24
lines changed

4 files changed

+19
-24
lines changed

tests/unit/cbprintf/main.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -358,9 +358,7 @@ static inline bool prf_check(const char *expected,
358358
return true;
359359
}
360360

361-
#define PRF_CHECK(expected, rv) \
362-
zassert_true(prf_check(expected, rv, __FILE__, __LINE__), \
363-
NULL)
361+
#define PRF_CHECK(expected, rv) zassert_true(prf_check(expected, rv, __FILE__, __LINE__))
364362

365363
ZTEST(prf, test_pct)
366364
{
@@ -574,8 +572,7 @@ ZTEST(prf, test_d_flags)
574572
reset_out();
575573
rc = rawprf("/%#d/% +d/%-04d/%06.4d/", sv, sv, sv, sv);
576574
zassert_equal(rc, 22, "rc %d", rc);
577-
zassert_equal(strncmp("/123/+123/123 / 0123/",
578-
buf, rc), 0, NULL);
575+
zassert_equal(strncmp("/123/+123/123 / 0123/", buf, rc), 0);
579576
}
580577

581578
ZTEST(prf, test_x_length)

tests/unit/crc/main.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,23 +43,23 @@ ZTEST(crc, test_crc32c)
4343

4444
/* Single streams */
4545
zassert_equal(crc32_c(0, test1, sizeof(test1), true, true),
46-
0xE16DCDEE, NULL);
46+
0xE16DCDEE);
4747
zassert_equal(crc32_c(0, test2, sizeof(test2), true, true),
48-
0xE3069283, NULL);
48+
0xE3069283);
4949
zassert_equal(crc32_c(0, test3, sizeof(test3), true, true),
50-
0xFCDEB58D, NULL);
50+
0xFCDEB58D);
5151

5252
/* Continuous streams - test1, test2 and test3 are considered part
5353
* of one big stream whose CRC needs to be calculated. Note that the
5454
* CRC of the first string is passed over to the second crc calculation,
5555
* second to third and so on.
5656
*/
5757
zassert_equal(crc32_c(0, test1, sizeof(test1), true, false),
58-
0x1E923211, NULL);
58+
0x1E923211);
5959
zassert_equal(crc32_c(0x1E923211, test2, sizeof(test2), false, false),
60-
0xB2983B83, NULL);
60+
0xB2983B83);
6161
zassert_equal(crc32_c(0xB2983B83, test3, sizeof(test3), false, true),
62-
0x7D4F9D21, NULL);
62+
0x7D4F9D21);
6363
}
6464

6565
ZTEST(crc, test_crc32_ieee)
@@ -142,7 +142,7 @@ ZTEST(crc, test_crc16_ccitt)
142142
* check=0x906e
143143
*/
144144
zassert_equal(crc16_ccitt(0xffff, test2, sizeof(test2)) ^ 0xffff,
145-
0x906e, NULL);
145+
0x906e);
146146

147147
/* Appending the CRC to a buffer and computing the CRC over
148148
* the extended buffer leaves a residual of zero.
@@ -168,9 +168,9 @@ ZTEST(crc, test_crc16_ccitt_for_ppp)
168168
uint8_t test2[] = { '1', '2', '3', '4', '5', '6', '7', '8', '9' };
169169

170170
zassert_equal(crc16_ccitt(0xffff, test0, sizeof(test0)),
171-
0xf0b8, NULL);
171+
0xf0b8);
172172
zassert_equal(crc16_ccitt(0xffff, test2, sizeof(test2)) ^ 0xFFFF,
173-
0x906e, NULL);
173+
0x906e);
174174
}
175175

176176
ZTEST(crc, test_crc16_itu_t)

tests/unit/math_extras/tests.inc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,6 @@ static void VNAME(u64_ctz)(void)
174174
zassert_equal(u64_count_trailing_zeros(0x00f00f00), 8);
175175
zassert_equal(u64_count_trailing_zeros(0xf00ffc00), 10);
176176
zassert_equal(u64_count_trailing_zeros(0xffffffffffffffffull), 0);
177-
zassert_equal(u64_count_trailing_zeros(0x8000000080000000ull), 31,
178-
NULL);
179-
zassert_equal(u64_count_trailing_zeros(0xc000000000000000ull), 62,
180-
NULL);
177+
zassert_equal(u64_count_trailing_zeros(0x8000000080000000ull), 31);
178+
zassert_equal(u64_count_trailing_zeros(0xc000000000000000ull), 62);
181179
}

tests/unit/timeutil/test_sync.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -233,27 +233,27 @@ static void tref_from_local(const char *tag,
233233
zassert_equal(rv, 0,
234234
"%s: unexpected init: %d", tag, rv);
235235
zassert_equal(ss.skew, 1.0,
236-
"%s: unexpected skew");
236+
"%s: unexpected skew", tag);
237237

238238
rv = timeutil_sync_ref_from_local(&ss, ss.base.local, NULL);
239239
zassert_equal(rv, -EINVAL,
240240
"%s: unexpected missing dest: %d", tag, rv);
241241

242242
rv = timeutil_sync_ref_from_local(&ss, ss.base.local, &ref);
243243
zassert_equal(rv, 0,
244-
"%s: unexpected fail", tag, rv);
244+
"%s: unexpected fail %d", tag, rv);
245245
zassert_equal(ref, ss.base.ref,
246246
"%s: unexpected base convert", tag);
247247

248248
rv = timeutil_sync_ref_from_local(&ss, 0, &ref);
249249
zassert_equal(rv, 0,
250-
"%s: unexpected local=0 fail", tag, rv);
250+
"%s: unexpected local=0 fail %d", tag, rv);
251251
zassert_equal(ref, scale_ref(5, cfg),
252252
"%s: unexpected local=0 ref", tag);
253253

254254
rv = timeutil_sync_ref_from_local(&ss, ss.base.local, &ref);
255255
zassert_equal(rv, 0,
256-
"%s: unexpected local=base fail", tag, rv);
256+
"%s: unexpected local=base fail, %d", tag, rv);
257257
zassert_equal(ref, ss.base.ref,
258258
"%s: unexpected local=base ref", tag);
259259

@@ -314,11 +314,11 @@ static void tlocal_from_ref(const char *tag,
314314

315315
rv = timeutil_sync_local_from_ref(&ss, ss.base.ref, NULL);
316316
zassert_equal(rv, -EINVAL,
317-
"%s: unexpected missing dest", tag, rv);
317+
"%s: unexpected missing dest %d", tag, rv);
318318

319319
rv = timeutil_sync_local_from_ref(&ss, ss.base.ref, &local);
320320
zassert_equal(rv, 0,
321-
"%s: unexpected fail", tag, rv);
321+
"%s: unexpected fail %d", tag, rv);
322322
zassert_equal(local, ss.base.local,
323323
"%s: unexpected base convert", tag);
324324

0 commit comments

Comments
 (0)