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 <v2_0/innrt_device.h> 22 23 #include "gtest/gtest.h" 24 25 #include "interfaces/kits/c/neural_network_runtime/neural_network_runtime.h" 26 #include "frameworks/native/memory_manager.h" 27 28 namespace V2_0 = OHOS::HDI::Nnrt::V2_0; 29 30 namespace OHOS::NeuralNetworkRuntime::Test { 31 class HDINNRtTest : public testing::Test { 32 public: 33 // device ptr 34 OHOS::sptr<V2_0::INnrtDevice> device_; 35 std::vector<void*> buffers_; 36 SetUp()37 void SetUp() override 38 { 39 device_ = V2_0::INnrtDevice::Get(); 40 if (device_ == nullptr) { 41 // std::cout << "Get HDI device failed." << std::endl; 42 GTEST_SKIP() << "Get HDI device failed."; 43 } 44 } 45 TearDown()46 void TearDown() override 47 { 48 device_.clear(); 49 } 50 }; 51 } // namespace OHOS::NeuralNetworkRuntime::Test 52 53 #endif // HDI_NNRT_TEST_H