From: hyunuk.tak Date: Wed, 23 Mar 2022 06:35:01 +0000 (+0900) Subject: Add core test case for getting extended address X-Git-Tag: accepted/tizen/unified/20220914.164046~93 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e2cab1477c5fad55c1dc63c6fba17387098bc0d5;p=platform%2Fcore%2Fapi%2Fthread.git Add core test case for getting extended address Change-Id: Ic3dadc496378ea36b598e9bac639cea97aed1033 Signed-off-by: hyunuk.tak --- diff --git a/tests/unittest/mocks/thread-mock-dummy.cpp b/tests/unittest/mocks/thread-mock-dummy.cpp index 4a3942b..bbb950d 100644 --- a/tests/unittest/mocks/thread-mock-dummy.cpp +++ b/tests/unittest/mocks/thread-mock-dummy.cpp @@ -110,6 +110,11 @@ static GVariant *__property_get_link_mode() return g_variant_new("(v)", g_variant_new("(bbb)", true, true, true)); } +static GVariant *__property_get_extended_address() +{ + return g_variant_new("(v)", g_variant_new("t", 0)); +} + struct { const gchar *interface_name; const gchar *signal_name; @@ -181,6 +186,12 @@ struct { __property_get_link_mode, }, { + "Get", + THREAD_DBUS_PROPERTY_EXTENDED_ADDRESS, + __property_get_extended_address, + }, + { + NULL, NULL, NULL, } diff --git a/tests/unittest/thread-unittest-core.cpp b/tests/unittest/thread-unittest-core.cpp index d2b7ed6..04b3488 100644 --- a/tests/unittest/thread-unittest-core.cpp +++ b/tests/unittest/thread-unittest-core.cpp @@ -28,6 +28,8 @@ public: thread_device_role_e deviceRole; thread_device_type_e deviceType; thread_scan_param_h scanParam; + uint64_t extendedAddress; + const char *uuid; public: static void deviceRoleCb(thread_device_role_e device_role, void *user_data) {}; @@ -283,4 +285,21 @@ TEST_F(ThreadCoreTest, ScanErrorNone) thread_scan(instance, scanParam, ScanCallback, nullptr)); RUN_GMAIN_LOOP; +} + +TEST_F(ThreadCoreTest, GetExtendedAddressNotInitialized) +{ + EXPECT_EQ(THREAD_ERROR_NONE, thread_deinitialize()); + EXPECT_EQ(THREAD_ERROR_NOT_INITIALIZED, thread_get_extended_address(instance, &extendedAddress)); +} + +TEST_F(ThreadCoreTest, GetExtendedAddressInvalidParameter) +{ + EXPECT_EQ(THREAD_ERROR_INVALID_PARAMETER, thread_get_extended_address(instance, &extendedAddress)); +} + +TEST_F(ThreadCoreTest, GetExtendedAddressErrorNone) +{ + EXPECT_EQ(THREAD_ERROR_NONE, thread_enable(&instance)); + EXPECT_EQ(THREAD_ERROR_NONE, thread_get_extended_address(instance, &extendedAddress)); } \ No newline at end of file