blob: 2791e804c34af828449f0bebb84d42389fa6cd66 [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
Michael Butlerbbe5dad2019-08-26 23:55:47 -070021namespace android::hardware::neuralnetworks::V1_1::vts::functional {
22
23using V1_0::DeviceStatus;
24using V1_0::ErrorStatus;
Michael Butlerf76acd02018-03-22 16:37:57 -070025
26// create device test
27TEST_F(NeuralnetworksHidlTest, CreateDevice) {}
28
29// status test
30TEST_F(NeuralnetworksHidlTest, StatusTest) {
Michael Butlere16af0a2019-08-29 22:17:24 -070031 Return<DeviceStatus> status = kDevice->getStatus();
Michael Butlerf76acd02018-03-22 16:37:57 -070032 ASSERT_TRUE(status.isOk());
33 EXPECT_EQ(DeviceStatus::AVAILABLE, static_cast<DeviceStatus>(status));
34}
35
36// initialization
37TEST_F(NeuralnetworksHidlTest, GetCapabilitiesTest) {
38 Return<void> ret =
Michael Butlere16af0a2019-08-29 22:17:24 -070039 kDevice->getCapabilities_1_1([](ErrorStatus status, const Capabilities& capabilities) {
Michael Butlerbbe5dad2019-08-26 23:55:47 -070040 EXPECT_EQ(ErrorStatus::NONE, status);
41 EXPECT_LT(0.0f, capabilities.float32Performance.execTime);
42 EXPECT_LT(0.0f, capabilities.float32Performance.powerUsage);
43 EXPECT_LT(0.0f, capabilities.quantized8Performance.execTime);
44 EXPECT_LT(0.0f, capabilities.quantized8Performance.powerUsage);
45 EXPECT_LT(0.0f, capabilities.relaxedFloat32toFloat16Performance.execTime);
46 EXPECT_LT(0.0f, capabilities.relaxedFloat32toFloat16Performance.powerUsage);
47 });
Michael Butlerf76acd02018-03-22 16:37:57 -070048 EXPECT_TRUE(ret.isOk());
49}
50
Michael Butlerbbe5dad2019-08-26 23:55:47 -070051} // namespace android::hardware::neuralnetworks::V1_1::vts::functional