Slava Shklyaev | 871be94 | 2018-09-12 14:52:02 +0100 | [diff] [blame] | 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 "Models.h" |
| 20 | #include "VtsHalNeuralnetworks.h" |
| 21 | |
| 22 | namespace android { |
| 23 | namespace hardware { |
| 24 | namespace neuralnetworks { |
| 25 | namespace V1_2 { |
| 26 | namespace vts { |
| 27 | namespace functional { |
| 28 | |
| 29 | // forward declarations |
| 30 | std::vector<Request> createRequests(const std::vector<MixedTypedExample>& examples); |
| 31 | |
| 32 | // generate validation tests |
| 33 | #define VTS_CURRENT_TEST_CASE(TestName) \ |
| 34 | TEST_F(ValidationTest, TestName) { \ |
| 35 | const Model model = TestName::createTestModel(); \ |
| 36 | const std::vector<Request> requests = createRequests(TestName::examples); \ |
| 37 | validateModel(model); \ |
| 38 | validateRequests(model, requests); \ |
| 39 | } |
| 40 | |
| 41 | FOR_EACH_TEST_MODEL(VTS_CURRENT_TEST_CASE) |
| 42 | |
| 43 | #undef VTS_CURRENT_TEST_CASE |
| 44 | |
| 45 | } // namespace functional |
| 46 | } // namespace vts |
| 47 | } // namespace V1_2 |
| 48 | } // namespace neuralnetworks |
| 49 | } // namespace hardware |
| 50 | } // namespace android |