• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_1 {
25 namespace vts {
26 namespace functional {
27 
28 // create device test
TEST_F(NeuralnetworksHidlTest,CreateDevice)29 TEST_F(NeuralnetworksHidlTest, CreateDevice) {}
30 
31 // status test
TEST_F(NeuralnetworksHidlTest,StatusTest)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
TEST_F(NeuralnetworksHidlTest,GetCapabilitiesTest)39 TEST_F(NeuralnetworksHidlTest, GetCapabilitiesTest) {
40     Return<void> ret =
41         device->getCapabilities_1_1([](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             EXPECT_LT(0.0f, capabilities.relaxedFloat32toFloat16Performance.execTime);
48             EXPECT_LT(0.0f, capabilities.relaxedFloat32toFloat16Performance.powerUsage);
49         });
50     EXPECT_TRUE(ret.isOk());
51 }
52 
53 }  // namespace functional
54 }  // namespace vts
55 }  // namespace V1_1
56 }  // namespace neuralnetworks
57 }  // namespace hardware
58 }  // namespace android
59