* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "../libsigrokdecode.h" /* First, to avoid compiler warning. */
-#include "../libsigrokdecode-internal.h"
+#include "../libsigrokdecode-internal.h" /* First, to avoid compiler warning. */
+#include "../libsigrokdecode.h"
+#include <stdint.h>
#include <stdlib.h>
#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.
srd_init(NULL);
srd_session_new(&sess);
/* Try a bunch of values. */
- for (i = 0; i < 1000; i++) {
+ for (i = 0; i < 1000; i++)
conf_check_ok(sess, SRD_CONF_SAMPLERATE, i);
- }
/* Try the max. possible value. */
- conf_check_ok(sess, SRD_CONF_SAMPLERATE, 18446744073709551615ULL);
+ conf_check_ok(sess, SRD_CONF_SAMPLERATE, UINT64_MAX);
srd_session_destroy(sess);
srd_exit();
}
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);