From 67f10dd10598d75ecd1cba6a8fa6be2d9ca67fe4 Mon Sep 17 00:00:00 2001 From: w30052974 Date: Fri, 10 Jan 2025 16:32:35 +0800 Subject: [PATCH] =?UTF-8?q?nnrt=20ut=20=E8=99=9A=E5=81=87=E6=96=AD?= =?UTF-8?q?=E8=A8=80=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: w30052974 --- .../neural_network_runtime_test.cpp | 44 +------------------ test/unittest/ops/eltwise_test.cpp | 2 +- 2 files changed, 3 insertions(+), 43 deletions(-) diff --git a/test/unittest/components/v1_0/neural_network_runtime_test/neural_network_runtime_test.cpp b/test/unittest/components/v1_0/neural_network_runtime_test/neural_network_runtime_test.cpp index ab00317..94b27e2 100644 --- a/test/unittest/components/v1_0/neural_network_runtime_test/neural_network_runtime_test.cpp +++ b/test/unittest/components/v1_0/neural_network_runtime_test/neural_network_runtime_test.cpp @@ -688,20 +688,6 @@ HWTEST_F(NeuralNetworkRuntimeTest, model_destroy_001, testing::ext::TestSize.Lev EXPECT_EQ(nullptr, pModel); } -/* - * @tc.name: model_destroy_002 - * @tc.desc: Verify the *OH_NNModel is nullptr of the OH_NNModel_Destroy function. - * @tc.type: FUNC - */ -HWTEST_F(NeuralNetworkRuntimeTest, model_destroy_002, testing::ext::TestSize.Level0) -{ - InnerModel innerModel; - OH_NNModel* model = nullptr; - OH_NNModel** pModel = &model; - OH_NNModel_Destroy(pModel); - EXPECT_EQ(nullptr, model); -} - /* * @tc.name: model_destroy_003 * @tc.desc: Verify the normal model of the OH_NNModel_Destroy function. @@ -1094,19 +1080,6 @@ HWTEST_F(NeuralNetworkRuntimeTest, compilation_destroy_001, testing::ext::TestSi EXPECT_EQ(nullptr, pCompilation); } -/* - * @tc.name: compilation_destroy_002 - * @tc.desc: Verify the *OH_NNCompilation is nullptr of the OH_NNCompilation_Destroy function. - * @tc.type: FUNC - */ -HWTEST_F(NeuralNetworkRuntimeTest, compilation_destroy_002, testing::ext::TestSize.Level0) -{ - OH_NNCompilation* compilation = nullptr; - OH_NNCompilation** pCompilation = &compilation; - OH_NNCompilation_Destroy(pCompilation); - EXPECT_EQ(nullptr, compilation); -} - /* * @tc.name: compilation_destroy_003 * @tc.desc: Verify the normal model of the OH_NNCompilation_Destroy function. @@ -2142,13 +2115,13 @@ HWTEST_F(NeuralNetworkRuntimeTest, executor_destroy_input_memory_003, testing::e std::vector, OH_NN_TensorType>> m_outputTensorDescs; NNExecutor* executor = new (std::nothrow) NNExecutor( m_backendID, m_device, mockIPreparedMode, m_inputTensorDescs, m_outputTensorDescs); + EXPECT_NE(executor, nullptr); OH_NNExecutor* nnExecutor = reinterpret_cast(executor); uint32_t inputIndex = 0; OH_NN_Memory* memory = nullptr; OH_NN_Memory** pMemory = &memory; OH_NNExecutor_DestroyInputMemory(nnExecutor, inputIndex, pMemory); - EXPECT_EQ(nullptr, memory); testing::Mock::AllowLeak(mockIPreparedMode.get()); } @@ -2244,13 +2217,13 @@ HWTEST_F(NeuralNetworkRuntimeTest, executor_destroy_output_memory_003, testing:: std::vector, OH_NN_TensorType>> m_outputTensorDescs; NNExecutor* executor = new (std::nothrow) NNExecutor( m_backendID, m_device, mockIPreparedMode, m_inputTensorDescs, m_outputTensorDescs); + EXPECT_NE(executor, nullptr); OH_NNExecutor* nnExecutor = reinterpret_cast(executor); uint32_t outputIndex = 0; OH_NN_Memory* memory = nullptr; OH_NN_Memory** pMemory = &memory; OH_NNExecutor_DestroyOutputMemory(nnExecutor, outputIndex, pMemory); - EXPECT_EQ(nullptr, memory); testing::Mock::AllowLeak(mockIPreparedMode.get()); } @@ -2514,19 +2487,6 @@ HWTEST_F(NeuralNetworkRuntimeTest, executor_destroy_001, testing::ext::TestSize. EXPECT_EQ(nullptr, pExecutor); } -/* - * @tc.name: executor_destroy_002 - * @tc.desc: Verify the *OH_NNExecutor is nullptr of the OH_NNExecutor_Destroy function. - * @tc.type: FUNC - */ -HWTEST_F(NeuralNetworkRuntimeTest, executor_destroy_002, testing::ext::TestSize.Level0) -{ - OH_NNExecutor* nnExecutor = nullptr; - OH_NNExecutor** pExecutor = &nnExecutor; - OH_NNExecutor_Destroy(pExecutor); - EXPECT_EQ(nullptr, nnExecutor); -} - /* * @tc.name: device_get_all_devices_id_001 * @tc.desc: Verify the allDevicesID is nullptr of the OH_NNDevice_GetAllDevicesID function. diff --git a/test/unittest/ops/eltwise_test.cpp b/test/unittest/ops/eltwise_test.cpp index 8f15c12..8749f4d 100644 --- a/test/unittest/ops/eltwise_test.cpp +++ b/test/unittest/ops/eltwise_test.cpp @@ -273,7 +273,7 @@ HWTEST_F(EltwiseBuilderTest, eltwise_getprimitive_001, TestSize.Level1) LiteGraphTensorPtr expectPrimitive = {nullptr, DestroyLiteGraphPrimitive}; EXPECT_NE(expectPrimitive, primitive); bool eltwiseModeReturn = mindspore::lite::MindIR_Eltwise_GetMode(primitive.get()); - EXPECT_EQ(eltwiseModeReturn, eltwiseModeReturn); + EXPECT_EQ(false, eltwiseModeReturn); } /** -- Gitee