From e0f960e038169b5b193520e9255b695c7e4bb3d6 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sun, 9 Dec 2012 10:29:40 +0100 Subject: unit: Use GTest for EIR unit test --- unit/test-eir.c | 45 ++++++++------------------------------------- 1 file changed, 8 insertions(+), 37 deletions(-) (limited to 'unit') diff --git a/unit/test-eir.c b/unit/test-eir.c index cefcacd13..5ad6928a9 100644 --- a/unit/test-eir.c +++ b/unit/test-eir.c @@ -25,19 +25,15 @@ #include #endif -#include - -#include - #include #include #include #include -#include "eir.h" +#include "src/eir.h" -START_TEST(test_basic) +static void test_basic(void) { struct eir_data data; unsigned char buf[HCI_MAX_EIR_LENGTH]; @@ -47,43 +43,18 @@ START_TEST(test_basic) memset(&data, 0, sizeof(data)); err = eir_parse(&data, buf, HCI_MAX_EIR_LENGTH); - ck_assert(err == 0); - ck_assert(data.services == NULL); - ck_assert(data.name == NULL); + g_assert(err == 0); + g_assert(data.services == NULL); + g_assert(data.name == NULL); eir_data_free(&data); } -END_TEST - -static void add_test(Suite *s, const char *name, TFun func) -{ - TCase *t; - - t = tcase_create(name); - tcase_add_test(t, func); - suite_add_tcase(s, t); -} int main(int argc, char *argv[]) { - int fails; - SRunner *sr; - Suite *s; - - s = suite_create("EIR"); - - add_test(s, "basic", test_basic); - - sr = srunner_create(s); - - srunner_run_all(sr, CK_NORMAL); - - fails = srunner_ntests_failed(sr); - - srunner_free(sr); + g_test_init(&argc, &argv, NULL); - if (fails > 0) - return -1; + g_test_add_func("/eir/basic", test_basic); - return 0; + return g_test_run(); } -- cgit v1.2.1