blob: ed59a2dd8c2645b0e5dc738d55a02159b998befc [file] [log] [blame]
Michael Butlerf76acd02018-03-22 16:37:57 -07001/*
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
21namespace android {
22namespace hardware {
23namespace neuralnetworks {
24namespace V1_1 {
25namespace vts {
26namespace functional {
27
28// create device test
29TEST_F(NeuralnetworksHidlTest, CreateDevice) {}
30
31// status test
32TEST_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
39TEST_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