summaryrefslogtreecommitdiff
path: root/unit
diff options
context:
space:
mode:
authorGowtham Anandha Babu <gowtham.ab@samsung.com>2015-05-19 20:31:04 +0530
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2015-05-22 13:52:48 +0300
commitf5fcdf45a66e5cde4e24e7f79effa7e0b5b99abf (patch)
tree055769ba582b01bc2f5e86ddb67ea1a2c7339c0c /unit
parent068dcecd44aef4b83f7078496b0171035e6b8260 (diff)
downloadbluez-f5fcdf45a66e5cde4e24e7f79effa7e0b5b99abf.tar.gz
unit/test-uuid: Use tester framework
Diffstat (limited to 'unit')
-rw-r--r--unit/test-uuid.c52
1 files changed, 30 insertions, 22 deletions
diff --git a/unit/test-uuid.c b/unit/test-uuid.c
index 60c47919d..5f45b0c6f 100644
--- a/unit/test-uuid.c
+++ b/unit/test-uuid.c
@@ -29,6 +29,7 @@
#include "lib/bluetooth.h"
#include "lib/uuid.h"
+#include "src/shared/tester.h"
struct uuid_test_data {
const char *str;
@@ -128,8 +129,11 @@ static void test_uuid(gconstpointer data)
break;
case BT_UUID_UNSPEC:
default:
+ tester_test_passed();
return;
}
+
+ tester_test_passed();
}
static void test_str(gconstpointer data)
@@ -157,11 +161,13 @@ static void test_str(gconstpointer data)
bt_uuid32_create(&uuid, test_data->val32);
break;
default:
+ tester_test_passed();
return;
}
bt_uuid_to_string(&uuid, buf, sizeof(buf));
g_assert(strcasecmp(buf, str) == 0);
+ tester_test_passed();
}
static void test_cmp(gconstpointer data)
@@ -173,6 +179,7 @@ static void test_cmp(gconstpointer data)
g_assert(bt_string_to_uuid(&uuid2, test_data->str128) == 0);
g_assert(bt_uuid_cmp(&uuid1, &uuid2) == 0);
+ tester_test_passed();
}
static const struct uuid_test_data compress[] = {
@@ -220,43 +227,44 @@ static void test_malformed(gconstpointer data)
bt_uuid_t uuid;
g_assert(bt_string_to_uuid(&uuid, str) != 0);
+ tester_test_passed();
}
int main(int argc, char *argv[])
{
size_t i;
- g_test_init(&argc, &argv, NULL);
+ tester_init(&argc, &argv);
- g_test_add_data_func("/uuid/base", &uuid_base, test_uuid);
- g_test_add_data_func("/uuid/base/str", &uuid_base, test_str);
- g_test_add_data_func("/uuid/base/cmp", &uuid_base, test_cmp);
+ tester_add("/uuid/base", &uuid_base, NULL, test_uuid, NULL);
+ tester_add("/uuid/base/str", &uuid_base, NULL, test_str, NULL);
+ tester_add("/uuid/base/cmp", &uuid_base, NULL, test_cmp, NULL);
- g_test_add_data_func("/uuid/sixteen1", &uuid_sixteen1, test_uuid);
- g_test_add_data_func("/uuid/sixteen1/str", &uuid_sixteen1, test_str);
- g_test_add_data_func("/uuid/sixteen1/cmp", &uuid_sixteen1, test_cmp);
+ tester_add("/uuid/sixteen1", &uuid_sixteen1, NULL, test_uuid, NULL);
+ tester_add("/uuid/sixteen1/str", &uuid_sixteen1, NULL, test_str, NULL);
+ tester_add("/uuid/sixteen1/cmp", &uuid_sixteen1, NULL, test_cmp, NULL);
- g_test_add_data_func("/uuid/sixteen2", &uuid_sixteen2, test_uuid);
- g_test_add_data_func("/uuid/sixteen2/str", &uuid_sixteen2, test_str);
- g_test_add_data_func("/uuid/sixteen2/cmp", &uuid_sixteen2, test_cmp);
+ tester_add("/uuid/sixteen2", &uuid_sixteen2, NULL, test_uuid, NULL);
+ tester_add("/uuid/sixteen2/str", &uuid_sixteen2, NULL, test_str, NULL);
+ tester_add("/uuid/sixteen2/cmp", &uuid_sixteen2, NULL, test_cmp, NULL);
- g_test_add_data_func("/uuid/thirtytwo1", &uuid_32_1, test_uuid);
- g_test_add_data_func("/uuid/thirtytwo1/str", &uuid_32_1, test_str);
- g_test_add_data_func("/uuid/thirtytwo1/cmp", &uuid_32_1, test_cmp);
+ tester_add("/uuid/thirtytwo1", &uuid_32_1, NULL, test_uuid, NULL);
+ tester_add("/uuid/thirtytwo1/str", &uuid_32_1, NULL, test_str, NULL);
+ tester_add("/uuid/thirtytwo1/cmp", &uuid_32_1, NULL, test_cmp, NULL);
- g_test_add_data_func("/uuid/thirtytwo2", &uuid_32_2, test_uuid);
- g_test_add_data_func("/uuid/thritytwo2/str", &uuid_32_2, test_str);
- g_test_add_data_func("/uuid/thirtytwo2/cmp", &uuid_32_2, test_cmp);
+ tester_add("/uuid/thirtytwo2", &uuid_32_2, NULL, test_uuid, NULL);
+ tester_add("/uuid/thritytwo2/str", &uuid_32_2, NULL, test_str, NULL);
+ tester_add("/uuid/thirtytwo2/cmp", &uuid_32_2, NULL, test_cmp, NULL);
- g_test_add_data_func("/uuid/onetwentyeight", &uuid_128, test_uuid);
- g_test_add_data_func("/uuid/onetwentyeight/str", &uuid_128, test_str);
- g_test_add_data_func("/uuid/onetwentyeight/cmp", &uuid_128, test_cmp);
+ tester_add("/uuid/onetwentyeight", &uuid_128, NULL, test_uuid, NULL);
+ tester_add("/uuid/onetwentyeight/str", &uuid_128, NULL, test_str, NULL);
+ tester_add("/uuid/onetwentyeight/cmp", &uuid_128, NULL, test_cmp, NULL);
for (i = 0; malformed[i]; i++) {
char *testpath;
testpath = g_strdup_printf("/uuid/malformed/%s", malformed[i]);
- g_test_add_data_func(testpath, malformed[i], test_malformed);
+ tester_add(testpath, malformed[i], NULL, test_malformed, NULL);
g_free(testpath);
}
@@ -265,9 +273,9 @@ int main(int argc, char *argv[])
testpath = g_strdup_printf("/uuid/compress/%s",
compress[i].str);
- g_test_add_data_func(testpath, compress + i, test_uuid);
+ tester_add(testpath, compress + i, NULL, test_uuid, NULL);
g_free(testpath);
}
- return g_test_run();
+ return tester_run();
}