#include <check.h>
#include "lib.h"
-static void setup(void)
-{
- /* Silence libsigrokdecode while the unit tests run. */
- srd_log_loglevel_set(SRD_LOG_NONE);
-}
-
-static void teardown(void)
-{
-}
-
/*
* Check various basic init related things.
*
s = suite_create("core");
tc = tcase_create("init_exit");
- tcase_add_checked_fixture(tc, setup, teardown);
+ tcase_add_checked_fixture(tc, srdtest_setup, srdtest_teardown);
tcase_add_test(tc, test_init_exit);
tcase_add_test(tc, test_init_exit_2);
tcase_add_test(tc, test_init_exit_3);
#include <check.h>
#include "lib.h"
-static void setup(void)
-{
- /* Silence libsigrokdecode while the unit tests run. */
- srd_log_loglevel_set(SRD_LOG_NONE);
-}
-
-static void teardown(void)
-{
-}
-
/*
* Check whether srd_decoder_load_all() works.
* If it returns != SRD_OK (or segfaults) this test will fail.
s = suite_create("decoder");
tc = tcase_create("load");
- tcase_add_checked_fixture(tc, setup, teardown);
+ tcase_add_checked_fixture(tc, srdtest_setup, srdtest_teardown);
tcase_add_test(tc, test_load_all);
tcase_add_test(tc, test_load_all_no_init);
tcase_add_test(tc, test_load);
suite_add_tcase(s, tc);
tc = tcase_create("list");
- tcase_add_checked_fixture(tc, setup, teardown);
+ tcase_add_checked_fixture(tc, srdtest_setup, srdtest_teardown);
tcase_add_test(tc, test_decoder_list);
tcase_add_test(tc, test_decoder_list_no_load);
tcase_add_test(tc, test_decoder_list_no_init);
#include <check.h>
#include "lib.h"
-static void setup(void)
-{
- /* Silence libsigrokdecode while the unit tests run. */
- srd_log_loglevel_set(SRD_LOG_NONE);
-}
-
-static void teardown(void)
-{
-}
-
/*
* Check whether srd_inst_new() works.
* If it returns NULL (or segfaults) this test will fail.
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);
#include <check.h>
#include "lib.h"
+void srdtest_setup(void)
+{
+ /* Silence libsigrokdecode while the unit tests run. */
+ srd_log_loglevel_set(SRD_LOG_NONE);
+}
+
+void srdtest_teardown(void)
+{
+}
+
int main(void)
{
int ret;
#include <check.h>
#include "lib.h"
-static void setup(void)
-{
- /* Silence libsigrokdecode while the unit tests run. */
- srd_log_loglevel_set(SRD_LOG_NONE);
-}
-
-static void teardown(void)
-{
-}
-
/*
* Check whether srd_session_new() works.
* If it returns != SRD_OK (or segfaults) this test will fail.
s = suite_create("session");
tc = tcase_create("new_destroy");
- tcase_add_checked_fixture(tc, setup, teardown);
+ tcase_add_checked_fixture(tc, srdtest_setup, srdtest_teardown);
tcase_add_test(tc, test_session_new);
tcase_add_test(tc, test_session_new_bogus);
tcase_add_test(tc, test_session_new_multiple);
suite_add_tcase(s, tc);
tc = tcase_create("config");
- tcase_add_checked_fixture(tc, setup, teardown);
+ tcase_add_checked_fixture(tc, srdtest_setup, srdtest_teardown);
tcase_add_test(tc, test_session_metadata_set);
tcase_add_test(tc, test_session_metadata_set_bogus);
suite_add_tcase(s, tc);
#ifndef LIBSIGROKDECODE_TESTS_LIB_H
#define LIBSIGROKDECODE_TESTS_LIB_H
+void srdtest_setup(void);
+void srdtest_teardown(void);
+
Suite *suite_core(void);
Suite *suite_decoder(void);
Suite *suite_inst(void);