From: J. Neuschäfer Date: Tue, 13 May 2025 20:54:54 +0000 (+0200) Subject: tests: Replace remaining deprecated check calls X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=0112557f544da20790ab5a8924f3fc87482ed501;p=libsigrok.git tests: Replace remaining deprecated check calls These were not caught by coccinelle. --- diff --git a/tests/analog.c b/tests/analog.c index 0e3f43a4..1e223acd 100644 --- a/tests/analog.c +++ b/tests/analog.c @@ -393,7 +393,7 @@ START_TEST(test_analog_to_float_conv) /* Convert to an array of single precision float values. */ ret = sr_analog_to_float(&analog, &f_out[0]); if (!item->want) { - fail_if(ret == SR_OK, + ck_assert_msg(ret != SR_OK, "%s: sr_analog_to_float() passed", item_text); if (with_diag) { fprintf(stderr, " -- expected fail, OK\n"); @@ -401,7 +401,7 @@ START_TEST(test_analog_to_float_conv) } continue; } - fail_unless(ret == SR_OK, + ck_assert_msg(ret == SR_OK, "%s: sr_analog_to_float() failed: %d", item_text, ret); if (with_diag) { fprintf(stderr, " -- float:"); @@ -421,7 +421,7 @@ START_TEST(test_analog_to_float_conv) for (value_idx = 0; value_idx < item->nums; value_idx++) { want = item->want[value_idx]; have = f_out[value_idx]; - fail_unless(want == have, + ck_assert_msg(want == have, "%s: input %f != output %f", item_text, want, have); } diff --git a/tests/input_binary.c b/tests/input_binary.c index a6dae1b6..ccef48ff 100644 --- a/tests/input_binary.c +++ b/tests/input_binary.c @@ -109,7 +109,7 @@ static void datafeed_in(const struct sr_dev_inst *sdi, switch (packet->type) { case SR_DF_HEADER: // g_debug("Received SR_DF_HEADER."); - // fail_unless(p != NULL, "SR_DF_HEADER payload was NULL."); + // ck_assert_msg(p != NULL, "SR_DF_HEADER payload was NULL."); logic_channellist = srtest_get_enabled_logic_channels(sdi); ck_assert(logic_channellist != NULL); @@ -169,7 +169,7 @@ static void datafeed_in(const struct sr_dev_inst *sdi, break; case SR_DF_END: // g_debug("Received SR_DF_END."); - // fail_unless(p != NULL, "SR_DF_END payload was NULL."); + // ck_assert_msg(p != NULL, "SR_DF_END payload was NULL."); have_seen_df_end = TRUE; if (sample_counter != expected_samples) { ck_abort_msg("Expected %" PRIu64 " samples, got %" PRIu64 "", diff --git a/tests/strutil.c b/tests/strutil.c index 1fe8abeb..529df9cc 100644 --- a/tests/strutil.c +++ b/tests/strutil.c @@ -38,9 +38,9 @@ static void test_vsnprintf(const char *expected, char *format, ...) len = vsnprintf(s, len, format, args); va_end(args); - fail_unless(s != NULL, + ck_assert_msg(s != NULL, "Invalid result for '%s': len = %i.", expected, len); - fail_unless(!strcmp(s, expected), + ck_assert_msg(!strcmp(s, expected), "Invalid result for '%s': %s.", expected, s); g_free(s); }