From c9ce876efcc649407713d8e1e1b64a216c26d8a5 Mon Sep 17 00:00:00 2001 From: chuxing Date: Tue, 23 Mar 2021 10:59:05 +0800 Subject: [PATCH] update --- .../ge/hybrid/known_node_executor_unittest.cc | 122 +++++++++--------- 1 file changed, 61 insertions(+), 61 deletions(-) diff --git a/tests/ut/ge/hybrid/known_node_executor_unittest.cc b/tests/ut/ge/hybrid/known_node_executor_unittest.cc index 5a3be8c3..67a8e323 100644 --- a/tests/ut/ge/hybrid/known_node_executor_unittest.cc +++ b/tests/ut/ge/hybrid/known_node_executor_unittest.cc @@ -1,62 +1,62 @@ -/** - * Copyright 2019-2021 Huawei Technologies Co., Ltd - * - * 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 -#include -#include - -#define protected public -#define private public -#include "hybrid/node_executor/compiledsubgraph/known_node_executor.h" -#undef private -#undef protected -#include "graph/manager/graph_mem_allocator.h" - -using namespace std; -using namespace testing; -using namespace ge; -using namespace hybrid; - -class UnknownNodeExecutorTest : public testing::Test { - protected: - void SetUp() {} - void TearDown() {} -}; - -namespace { -class KnownNodeTaskMock : public KnownNodeTask { - public: - KnownNodeTaskMock(std::shared_ptr davinci_model): KnownNodeTask(davinci_model) {}; - ~KnownNodeTaskMock() override = default; - MOCK_METHOD0(DoInitDavinciModel, Status()); -}; -} - -TEST_F(UnknownNodeExecutorTest, test_init_davinci_model) { - auto davinci_model = std::make_shared(0, nullptr); - davinci_model->SetDeviceId(0); - davinci_model->SetKnownNode(true); - - auto ge_model = make_shared(); - AttrUtils::SetInt(ge_model, ATTR_MODEL_VAR_SIZE, 0); - AttrUtils::SetInt(ge_model, ATTR_MODEL_MEMORY_SIZE, 1024); - davinci_model->Assign(ge_model); - - KnownNodeTaskMock mock(davinci_model); - EXPECT_CALL(mock, DoInitDavinciModel).WillOnce(::testing::Return(SUCCESS)); - ASSERT_EQ(mock.InitDavinciModel(), SUCCESS); +/** + * Copyright 2019-2021 Huawei Technologies Co., Ltd + * + * 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 +#include +#include + +#define protected public +#define private public +#include "hybrid/node_executor/compiledsubgraph/known_node_executor.h" +#undef private +#undef protected +#include "graph/manager/graph_mem_allocator.h" + +using namespace std; +using namespace testing; +using namespace ge; +using namespace hybrid; + +class UnknownNodeExecutorTest : public testing::Test { + protected: + void SetUp() {} + void TearDown() {} +}; + +namespace { +class KnownNodeTaskMock : public KnownNodeTask { + public: + KnownNodeTaskMock(std::shared_ptr davinci_model): KnownNodeTask(davinci_model) {}; + ~KnownNodeTaskMock() override = default; + MOCK_METHOD0(DoInitDavinciModel, Status()); +}; +} + +TEST_F(UnknownNodeExecutorTest, test_init_davinci_model) { + auto davinci_model = std::make_shared(0, nullptr); + davinci_model->SetDeviceId(0); + davinci_model->SetKnownNode(true); + + auto ge_model = make_shared(); + AttrUtils::SetInt(ge_model, ATTR_MODEL_VAR_SIZE, 0); + AttrUtils::SetInt(ge_model, ATTR_MODEL_MEMORY_SIZE, 1024); + davinci_model->Assign(ge_model); + + KnownNodeTaskMock mock(davinci_model); + EXPECT_CALL(mock, DoInitDavinciModel).WillOnce(::testing::Return(SUCCESS)); + ASSERT_EQ(mock.InitDavinciModel(), SUCCESS); } \ No newline at end of file