From 2cc7b95f697762c8b101ca080a6802848bdcac1d Mon Sep 17 00:00:00 2001 From: "hyunuk.tak" Date: Tue, 29 Mar 2022 13:03:21 +0900 Subject: [PATCH] Add srp test case for setting client host name Change-Id: I5124a8714a3c8c3e6470550c351885f9352532f3 Signed-off-by: hyunuk.tak --- tests/unittest/thread-unittest-srp.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/unittest/thread-unittest-srp.cpp b/tests/unittest/thread-unittest-srp.cpp index b03eeb3..aa33de6 100644 --- a/tests/unittest/thread-unittest-srp.cpp +++ b/tests/unittest/thread-unittest-srp.cpp @@ -21,6 +21,7 @@ class ThreadSrpTest : public ::testing::Test { public: + const char *hostName = "host_name"; thread_instance_h instance; protected: @@ -87,4 +88,21 @@ TEST_F(ThreadSrpTest, ClientRemoveHostErrorNone) { EXPECT_EQ(THREAD_ERROR_NONE, thread_enable(&instance)); EXPECT_EQ(THREAD_ERROR_NONE, thread_srp_client_remove_host(instance)); +} + +TEST_F(ThreadSrpTest, ClientSetHostNameNotInitialized) +{ + EXPECT_EQ(THREAD_ERROR_NONE, thread_deinitialize()); + EXPECT_EQ(THREAD_ERROR_NOT_INITIALIZED, thread_srp_client_set_host_name(instance, hostName)); +} + +TEST_F(ThreadSrpTest, ClientSetHostNameInvalidParameter) +{ + EXPECT_EQ(THREAD_ERROR_INVALID_PARAMETER, thread_srp_client_set_host_name(instance, hostName)); +} + +TEST_F(ThreadSrpTest, ClientSetHostNameErrorNone) +{ + EXPECT_EQ(THREAD_ERROR_NONE, thread_enable(&instance)); + EXPECT_EQ(THREAD_ERROR_NONE, thread_srp_client_set_host_name(instance, hostName)); } \ No newline at end of file -- 2.34.1