]> sigrok.org Git - libsigrok.git/commitdiff
tests: Replace remaining deprecated check calls
authorJ. Neuschäfer <redacted>
Tue, 13 May 2025 20:54:54 +0000 (22:54 +0200)
committerSoeren Apel <redacted>
Sun, 9 Nov 2025 21:40:22 +0000 (22:40 +0100)
These were not caught by coccinelle.

tests/analog.c
tests/input_binary.c
tests/strutil.c

index 0e3f43a488e161cf652cbdf9a9ede0aecda604a5..1e223acd8e627fcdcc1c2d2ed094db2e141fd921 100644 (file)
@@ -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);
                }
index a6dae1b6f1e729798340e54fd2993b3f8a49a2a0..ccef48ffac40c1cd8a19e6c7dc4b53d114e5319d 100644 (file)
@@ -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 "",
index 1fe8abeb39ab920088eda8375ed44cc1e0d825f5..529df9cc93f0bcce2a686bd815735c1b674a1756 100644 (file)
@@ -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);
 }