• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef HDI_NNRT_TEST_H
17 #define HDI_NNRT_TEST_H
18 
19 #include <string>
20 #include <vector>
21 #include <v1_0/innrt_device.h>
22 
23 #include "gtest/gtest.h"
24 
25 #include "interfaces/kits/c/neural_network_runtime.h"
26 #include "frameworks/native/memory_manager.h"
27 
28 namespace V1_0 = OHOS::HDI::Nnrt::V1_0;
29 
30 namespace OHOS::NeuralNetworkRuntime::Test {
31 
32 class HDINNRtTest : public testing::Test {
33 public:
34     // device ptr
35     OHOS::sptr<V1_0::INnrtDevice> device_;
36     std::vector<void*> buffers_;
37 
SetUp()38     void SetUp() override
39     {
40         device_ = V1_0::INnrtDevice::Get();
41         if (device_ == nullptr) {
42             // std::cout << "Get HDI device failed." << std::endl;
43             GTEST_SKIP() << "Get HDI device failed.";
44         }
45     }
46 
TearDown()47     void TearDown() override
48     {
49         device_.clear();
50     }
51 };
52 } // namespace OHOS::NeuralNetworkRuntime::Test
53 
54 #endif // HDI_NNRT_TEST_H