1 /* 2 * Copyright (C) 2018 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #define LOG_TAG "neuralnetworks_hidl_hal_test" 18 19 #include "VtsHalNeuralnetworks.h" 20 21 namespace android { 22 namespace hardware { 23 namespace neuralnetworks { 24 namespace V1_0 { 25 namespace vts { 26 namespace functional { 27 28 // create device test 29 TEST_F(NeuralnetworksHidlTest, CreateDevice) {} 30 31 // status test 32 TEST_F(NeuralnetworksHidlTest, StatusTest) { 33 Return<DeviceStatus> status = device->getStatus(); 34 ASSERT_TRUE(status.isOk()); 35 EXPECT_EQ(DeviceStatus::AVAILABLE, static_cast<DeviceStatus>(status)); 36 } 37 38 // initialization 39 TEST_F(NeuralnetworksHidlTest, GetCapabilitiesTest) { 40 Return<void> ret = 41 device->getCapabilities([](ErrorStatus status, const Capabilities& capabilities) { 42 EXPECT_EQ(ErrorStatus::NONE, status); 43 EXPECT_LT(0.0f, capabilities.float32Performance.execTime); 44 EXPECT_LT(0.0f, capabilities.float32Performance.powerUsage); 45 EXPECT_LT(0.0f, capabilities.quantized8Performance.execTime); 46 EXPECT_LT(0.0f, capabilities.quantized8Performance.powerUsage); 47 }); 48 EXPECT_TRUE(ret.isOk()); 49 } 50 51 } // namespace functional 52 } // namespace vts 53 } // namespace V1_0 54 } // namespace neuralnetworks 55 } // namespace hardware 56 } // namespace android 57