From c2409af9ed31052739cda739f40cd2ad22f1c212 Mon Sep 17 00:00:00 2001 From: "hyunuk.tak" Date: Mon, 28 Mar 2022 11:43:13 +0900 Subject: [PATCH] Add border router test case for enable Change-Id: If13d70028f943d9d56d5e0a368cbd3392a5600a1 Signed-off-by: hyunuk.tak --- tests/unittest/thread-unittest-br.cpp | 54 +++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 tests/unittest/thread-unittest-br.cpp diff --git a/tests/unittest/thread-unittest-br.cpp b/tests/unittest/thread-unittest-br.cpp new file mode 100644 index 0000000..70ad72c --- /dev/null +++ b/tests/unittest/thread-unittest-br.cpp @@ -0,0 +1,54 @@ +/* + * 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 + +#include "thread.h" + +class ThreadBRTest : public ::testing::Test +{ +public: + thread_instance_h instance; + +protected: + void SetUp() override + { + thread_initialize(); + instance = nullptr; + } + + void TearDown() override + { + thread_deinitialize(); + } +}; + +TEST_F(ThreadBRTest, BREnableNotInitialized) +{ + EXPECT_EQ(THREAD_ERROR_NONE, thread_deinitialize()); + EXPECT_EQ(THREAD_ERROR_NOT_INITIALIZED, thread_br_enable(instance)); +} + +TEST_F(ThreadBRTest, BREnableInvalidParameter) +{ + EXPECT_EQ(THREAD_ERROR_INVALID_PARAMETER, thread_br_enable(instance)); +} + +TEST_F(ThreadBRTest, BREnableErrorNone) +{ + EXPECT_EQ(THREAD_ERROR_NONE, thread_enable(&instance)); + EXPECT_EQ(THREAD_ERROR_NONE, thread_br_enable(instance)); +} \ No newline at end of file -- 2.34.1