From: hyunuk.tak Date: Tue, 22 Mar 2022 03:54:09 +0000 (+0900) Subject: Add core test case for factoryreset X-Git-Tag: accepted/tizen/unified/20220914.164046~101 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F81%2F272881%2F1;p=platform%2Fcore%2Fapi%2Fthread.git Add core test case for factoryreset Change-Id: I568adb7440e9dc062de1dea0b5c8e3f6fc3d0002 Signed-off-by: hyunuk.tak --- diff --git a/tests/unittest/mocks/thread-mock-dummy.cpp b/tests/unittest/mocks/thread-mock-dummy.cpp index 3c6d4ed..02af7aa 100644 --- a/tests/unittest/mocks/thread-mock-dummy.cpp +++ b/tests/unittest/mocks/thread-mock-dummy.cpp @@ -28,6 +28,11 @@ static GVariant *__method_reset(GVariant *parameters) return g_variant_new("(i)", THREAD_ERROR_NONE); } +static GVariant *__method_factoryreset(GVariant *parameters) +{ + return g_variant_new("(i)", THREAD_ERROR_NONE); +} + struct { const gchar *interface_name; const gchar *signal_name; @@ -60,6 +65,10 @@ struct { __method_reset, }, { + THREAD_DBUS_FACTORY_RESET_METHOD, + __method_factoryreset + }, + { NULL, NULL, } diff --git a/tests/unittest/thread-unittest-core.cpp b/tests/unittest/thread-unittest-core.cpp index 29f763d..51b94c7 100644 --- a/tests/unittest/thread-unittest-core.cpp +++ b/tests/unittest/thread-unittest-core.cpp @@ -114,4 +114,21 @@ TEST_F(ThreadCoreTest, ResetErrorNone) { EXPECT_EQ(THREAD_ERROR_NONE, thread_enable(&instance)); EXPECT_EQ(THREAD_ERROR_NONE, thread_reset(instance)); +} + +TEST_F(ThreadCoreTest, FactoryresetNotInitialized) +{ + EXPECT_EQ(THREAD_ERROR_NONE, thread_deinitialize()); + EXPECT_EQ(THREAD_ERROR_NOT_INITIALIZED, thread_factoryreset(instance)); +} + +TEST_F(ThreadCoreTest, FactoryresetInvalidParameter) +{ + EXPECT_EQ(THREAD_ERROR_INVALID_PARAMETER, thread_factoryreset(instance)); +} + +TEST_F(ThreadCoreTest, FactoryresetErrorNone) +{ + EXPECT_EQ(THREAD_ERROR_NONE, thread_enable(&instance)); + EXPECT_EQ(THREAD_ERROR_NONE, thread_factoryreset(instance)); } \ No newline at end of file