Add srp test case for client start 20/273120/1
authorhyunuk.tak <hyunuk.tak@samsung.com>
Tue, 29 Mar 2022 03:46:25 +0000 (12:46 +0900)
committerhyunuk.tak <hyunuk.tak@samsung.com>
Thu, 31 Mar 2022 00:58:05 +0000 (09:58 +0900)
Change-Id: I4198da20d6e46bb9acf29bc0b88ee81496f4d0f0
Signed-off-by: hyunuk.tak <hyunuk.tak@samsung.com>
tests/unittest/thread-unittest-srp.cpp [new file with mode: 0644]

diff --git a/tests/unittest/thread-unittest-srp.cpp b/tests/unittest/thread-unittest-srp.cpp
new file mode 100644 (file)
index 0000000..227251f
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <gtest/gtest.h>
+
+#include "thread.h"
+
+class ThreadSrpTest : public ::testing::Test
+{
+public:
+       thread_instance_h instance;
+
+protected:
+       void SetUp() override
+       {
+               thread_initialize();
+               instance = nullptr;
+       }
+
+       void TearDown() override
+       {
+               if (instance)
+                       thread_disable(instance);
+               thread_deinitialize();
+       }
+};
+
+TEST_F(ThreadSrpTest, ClientStartNotInitialized)
+{
+       EXPECT_EQ(THREAD_ERROR_NONE, thread_deinitialize());
+       EXPECT_EQ(THREAD_ERROR_NOT_INITIALIZED, thread_srp_client_start(instance));
+}
+
+TEST_F(ThreadSrpTest, ClientStartInvalidParameter)
+{
+       EXPECT_EQ(THREAD_ERROR_INVALID_PARAMETER, thread_srp_client_start(instance));
+}
+
+TEST_F(ThreadSrpTest, ClientStartErrorNone)
+{
+       EXPECT_EQ(THREAD_ERROR_NONE, thread_enable(&instance));
+       EXPECT_EQ(THREAD_ERROR_NONE, thread_srp_client_start(instance));
+}
\ No newline at end of file