summaryrefslogtreecommitdiff
path: root/unit
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2012-12-09 10:29:40 +0100
committerMarcel Holtmann <marcel@holtmann.org>2012-12-09 10:29:40 +0100
commite0f960e038169b5b193520e9255b695c7e4bb3d6 (patch)
tree6bba006c2154ad54f1a6687174229baf11753425 /unit
parentc45b8edf38b40411e83eef5b328f52b81630900c (diff)
downloadbluez-e0f960e038169b5b193520e9255b695c7e4bb3d6.tar.gz
unit: Use GTest for EIR unit test
Diffstat (limited to 'unit')
-rw-r--r--unit/test-eir.c45
1 files changed, 8 insertions, 37 deletions
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 <config.h>
#endif
-#include <check.h>
-
-#include <stdint.h>
-
#include <glib.h>
#include <bluetooth/bluetooth.h>
#include <bluetooth/hci.h>
#include <bluetooth/sdp.h>
-#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();
}