blob: cc44c9efe1877cf20c6be160e2c1e48fc3231f00 [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_0::vts::functional {
Michael Butlerf76acd02018-03-22 16:37:57 -070022
23// create device test
Michael Butler7076f622019-08-29 11:08:25 -070024TEST_P(NeuralnetworksHidlTest, CreateDevice) {}
Michael Butlerf76acd02018-03-22 16:37:57 -070025
26// status test
Michael Butler7076f622019-08-29 11:08:25 -070027TEST_P(NeuralnetworksHidlTest, StatusTest) {
Michael Butlere16af0a2019-08-29 22:17:24 -070028 Return<DeviceStatus> status = kDevice->getStatus();
Michael Butlerf76acd02018-03-22 16:37:57 -070029 ASSERT_TRUE(status.isOk());
30 EXPECT_EQ(DeviceStatus::AVAILABLE, static_cast<DeviceStatus>(status));
31}
32
33// initialization
Michael Butler7076f622019-08-29 11:08:25 -070034TEST_P(NeuralnetworksHidlTest, GetCapabilitiesTest) {
Michael Butlerf76acd02018-03-22 16:37:57 -070035 Return<void> ret =
Michael Butlere16af0a2019-08-29 22:17:24 -070036 kDevice->getCapabilities([](ErrorStatus status, const Capabilities& capabilities) {
Michael Butlerbbe5dad2019-08-26 23:55:47 -070037 EXPECT_EQ(ErrorStatus::NONE, status);
38 EXPECT_LT(0.0f, capabilities.float32Performance.execTime);
39 EXPECT_LT(0.0f, capabilities.float32Performance.powerUsage);
40 EXPECT_LT(0.0f, capabilities.quantized8Performance.execTime);
41 EXPECT_LT(0.0f, capabilities.quantized8Performance.powerUsage);
42 });
Michael Butlerf76acd02018-03-22 16:37:57 -070043 EXPECT_TRUE(ret.isOk());
44}
45
Michael Butlerbbe5dad2019-08-26 23:55:47 -070046} // namespace android::hardware::neuralnetworks::V1_0::vts::functional