From: hyunuk.tak Date: Thu, 24 Mar 2022 06:15:46 +0000 (+0900) Subject: Add network test case for getting active dataset tlvs X-Git-Tag: accepted/tizen/unified/20220914.164046~87 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7e6acac82b621dad2c5bed312cec961c189d5e7f;p=platform%2Fcore%2Fapi%2Fthread.git Add network test case for getting active dataset tlvs Change-Id: I8b7be34ddfcde849f13244c6b3c4902c543baa1e Signed-off-by: hyunuk.tak --- diff --git a/tests/unittest/thread-unittest-network.cpp b/tests/unittest/thread-unittest-network.cpp index 072a39b..10a5b16 100644 --- a/tests/unittest/thread-unittest-network.cpp +++ b/tests/unittest/thread-unittest-network.cpp @@ -38,6 +38,7 @@ public: uint64_t extendedPanId; uint16_t panId; uint8_t tlvsBuffer[NETWORK_TLVS_SIZE]; + int tlvsBufferLength; protected: void SetUp() override @@ -52,6 +53,7 @@ protected: extendedPanId = strtoull("18446744073709551615LL", nullptr, 10); panId = 65535; makeTlvsBuffer(); + tlvsBufferLength = DUMMY_TLVS_SIZE; } void TearDown() override @@ -122,18 +124,41 @@ TEST_F(ThreadNetworkTest, SetActiveDatasetTlvsNotInitialized) { EXPECT_EQ(THREAD_ERROR_NONE, thread_deinitialize()); EXPECT_EQ(THREAD_ERROR_NOT_INITIALIZED, - thread_network_set_active_dataset_tlvs(instance, tlvsBuffer, DUMMY_TLVS_SIZE)); + thread_network_set_active_dataset_tlvs(instance, tlvsBuffer, tlvsBufferLength)); } TEST_F(ThreadNetworkTest, SetActiveDatasetTlvsInvalidParameter) { EXPECT_EQ(THREAD_ERROR_INVALID_PARAMETER, - thread_network_set_active_dataset_tlvs(instance, tlvsBuffer, DUMMY_TLVS_SIZE)); + thread_network_set_active_dataset_tlvs(instance, tlvsBuffer, tlvsBufferLength)); } TEST_F(ThreadNetworkTest, SetActiveDatasetTlvsErrorNone) { EXPECT_EQ(THREAD_ERROR_NONE, thread_enable(&instance)); EXPECT_EQ(THREAD_ERROR_NONE, - thread_network_set_active_dataset_tlvs(instance, tlvsBuffer, DUMMY_TLVS_SIZE)); + thread_network_set_active_dataset_tlvs(instance, tlvsBuffer, tlvsBufferLength)); +} + +TEST_F(ThreadNetworkTest, GetActiveDatasetTlvsNotInitialized) +{ + uint8_t *tlvs_buffer = NULL; + EXPECT_EQ(THREAD_ERROR_NONE, thread_deinitialize()); + EXPECT_EQ(THREAD_ERROR_NOT_INITIALIZED, + thread_network_get_active_dataset_tlvs(instance, &tlvs_buffer, &tlvsBufferLength)); +} + +TEST_F(ThreadNetworkTest, GetActiveDatasetTlvsInvalidParameter) +{ + uint8_t *tlvs_buffer = NULL; + EXPECT_EQ(THREAD_ERROR_INVALID_PARAMETER, + thread_network_get_active_dataset_tlvs(instance, &tlvs_buffer, &tlvsBufferLength)); +} + +TEST_F(ThreadNetworkTest, GetActiveDatasetTlvsErrorNone) +{ + uint8_t *tlvs_buffer = NULL; + EXPECT_EQ(THREAD_ERROR_NONE, thread_enable(&instance)); + EXPECT_EQ(THREAD_ERROR_NONE, + thread_network_get_active_dataset_tlvs(instance, &tlvs_buffer, &tlvsBufferLength)); } \ No newline at end of file