From: Pawel Szewczyk
Date: Thu, 24 Sep 2015 12:54:15 +0000 (+0200)
Subject: tests: Add getting device test
X-Git-Tag: submit/tizen_common/20160317.155115~29
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=db69e2cecb5666808965c41883e244b090bc793c;p=platform%2Fcore%2Fapi%2Fusb-host.git
tests: Add getting device test
Change-Id: If61331c16b98393aa93f64433a8f73da157e4a5b
Signed-off-by: Pawel Szewczyk
---
diff --git a/tests/libhusb-test.c b/tests/libhusb-test.c
index 13ae650..f8f0ff4 100644
--- a/tests/libhusb-test.c
+++ b/tests/libhusb-test.c
@@ -95,10 +95,20 @@ static void test_open(void **state)
assert_ptr_equal(handle->lusb_dev_handle, lusb_handle);
}
+static void test_get_device(void **state)
+{
+ libhusb_device_handle handle;
+ libhusb_device *device;
+
+ device = libhusb_get_device(&handle);
+ assert_ptr_equal(handle.device, device);
+}
/* Custom macro for defining test with given name and fixed teardown function */
#define HUSB_TEST_CTX(func) \
cmocka_unit_test_setup_teardown(func, setup_libhusb_context, teardown_libhusb_context)
+#define HUSB_TEST_NOSETUP(func) \
+ cmocka_unit_test(func)
static struct CMUnitTest tests[] = {
@@ -108,6 +118,7 @@ static struct CMUnitTest tests[] = {
*/
HUSB_TEST_CTX(test_init),
HUSB_TEST_CTX(test_open),
+ HUSB_TEST_NOSETUP(test_get_device),
};