]> sigrok.org Git - libsigrokdecode.git/blobdiff - tests/check_inst.c
mx25lxx05d: Implement FAST READ command.
[libsigrokdecode.git] / tests / check_inst.c
index 25adc4f89160355ff42f6133cfe65a441192aaff..fe7e1f9977aebd26f2b32d20b6fe87e22dc8c050 100644 (file)
 #include "../libsigrokdecode.h" /* First, to avoid compiler warning. */
 #include <stdlib.h>
 #include <check.h>
-
-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);