X-Git-Url: https://sigrok.org/gitweb/?p=libsigrokdecode.git;a=blobdiff_plain;f=tests%2Fcheck_inst.c;h=fe7e1f9977aebd26f2b32d20b6fe87e22dc8c050;hp=25adc4f89160355ff42f6133cfe65a441192aaff;hb=04ff49263b0a462250d2301e6d4d17db5904a8d3;hpb=368b406efb2f4527d11b10dda8011f352288023e diff --git a/tests/check_inst.c b/tests/check_inst.c index 25adc4f..fe7e1f9 100644 --- a/tests/check_inst.c +++ b/tests/check_inst.c @@ -21,16 +21,7 @@ #include "../libsigrokdecode.h" /* First, to avoid compiler warning. */ #include #include - -static void setup(void) -{ - /* Silence libsigrokdecode while the unit tests run. */ - srd_log_loglevel_set(SRD_LOG_NONE); -} - -static void teardown(void) -{ -} +#include "lib.h" /* * Check whether srd_inst_new() works. @@ -41,7 +32,7 @@ START_TEST(test_inst_new) struct srd_session *sess; struct srd_decoder_inst *inst; - srd_init(NULL); + srd_init(DECODERS_DIR); srd_decoder_load("uart"); srd_session_new(&sess); inst = srd_inst_new(sess, "uart", NULL); @@ -61,7 +52,7 @@ START_TEST(test_inst_new_multiple) inst1 = inst2 = inst3 = NULL; - srd_init(NULL); + srd_init(DECODERS_DIR); srd_decoder_load_all(); srd_session_new(&sess); @@ -98,7 +89,7 @@ START_TEST(test_inst_option_set_empty) struct srd_decoder_inst *inst; GHashTable *options; - srd_init(NULL); + srd_init(DECODERS_DIR); srd_decoder_load_all(); srd_session_new(&sess); inst = srd_inst_new(sess, "uart", NULL); @@ -122,7 +113,7 @@ START_TEST(test_inst_option_set_bogus) struct srd_decoder_inst *inst; GHashTable *options; - srd_init(NULL); + srd_init(DECODERS_DIR); srd_decoder_load_all(); srd_session_new(&sess); inst = srd_inst_new(sess, "uart", NULL); @@ -157,13 +148,13 @@ Suite *suite_inst(void) s = suite_create("inst"); tc = tcase_create("new"); - tcase_add_checked_fixture(tc, setup, teardown); + tcase_add_checked_fixture(tc, srdtest_setup, srdtest_teardown); tcase_add_test(tc, test_inst_new); tcase_add_test(tc, test_inst_new_multiple); suite_add_tcase(s, tc); tc = tcase_create("option"); - tcase_add_checked_fixture(tc, setup, teardown); + tcase_add_checked_fixture(tc, srdtest_setup, srdtest_teardown); tcase_add_test(tc, test_inst_option_set_empty); tcase_add_test(tc, test_inst_option_set_bogus); suite_add_tcase(s, tc);