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 #ifndef ANDROID_HARDWARE_NEURALNETWORKS_V1_1_VTS_HAL_NEURALNETWORKS_H
18 #define ANDROID_HARDWARE_NEURALNETWORKS_V1_1_VTS_HAL_NEURALNETWORKS_H
19 
20 #include <android/hardware/neuralnetworks/1.0/IPreparedModel.h>
21 #include <android/hardware/neuralnetworks/1.1/IDevice.h>
22 #include <android/hardware/neuralnetworks/1.1/types.h>
23 #include <gtest/gtest.h>
24 #include <vector>
25 #include "1.0/Utils.h"
26 
27 namespace android::hardware::neuralnetworks::V1_1::vts::functional {
28 
29 using NamedDevice = Named<sp<IDevice>>;
30 using NeuralnetworksHidlTestParam = NamedDevice;
31 
32 class NeuralnetworksHidlTest : public testing::TestWithParam<NeuralnetworksHidlTestParam> {
33   protected:
34     void SetUp() override;
35     const sp<IDevice> kDevice = getData(GetParam());
36 };
37 
38 const std::vector<NamedDevice>& getNamedDevices();
39 
40 std::string printNeuralnetworksHidlTest(
41         const testing::TestParamInfo<NeuralnetworksHidlTestParam>& info);
42 
43 #define INSTANTIATE_DEVICE_TEST(TestSuite)                                                 \
44     GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(TestSuite);                              \
45     INSTANTIATE_TEST_SUITE_P(PerInstance, TestSuite, testing::ValuesIn(getNamedDevices()), \
46                              printNeuralnetworksHidlTest)
47 
48 // Create an IPreparedModel object. If the model cannot be prepared,
49 // "preparedModel" will be nullptr instead.
50 void createPreparedModel(const sp<IDevice>& device, const Model& model,
51                          sp<V1_0::IPreparedModel>* preparedModel);
52 
53 }  // namespace android::hardware::neuralnetworks::V1_1::vts::functional
54 
55 #endif  // ANDROID_HARDWARE_NEURALNETWORKS_V1_1_VTS_HAL_NEURALNETWORKS_H
56