Liam Barry | f30d741 | 2023-09-27 12:48:35 +0100 | [diff] [blame] | 1 | /* |
| 2 | * SPDX-FileCopyrightText: Copyright 2023 Arm Limited and/or its affiliates |
| 3 | * <open-source-office@arm.com> SPDX-License-Identifier: Apache-2.0 |
| 4 | * |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | * you may not use this file except in compliance with the License. |
| 7 | * You may obtain a copy of the License at |
| 8 | * |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | * |
| 11 | * Unless required by applicable law or agreed to in writing, software |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | * See the License for the specific language governing permissions and |
| 15 | * limitations under the License. |
| 16 | */ |
| 17 | #include "BufAttributes.hpp" |
| 18 | #include "TensorFlowLiteMicro.hpp" |
| 19 | #include "TestModel.hpp" /* Model class for running inference. */ |
| 20 | |
| 21 | #include <catch.hpp> |
| 22 | #include <random> |
| 23 | |
| 24 | namespace arm { |
| 25 | namespace app { |
| 26 | static uint8_t tensorArena[ACTIVATION_BUF_SZ] ACTIVATION_BUF_ATTRIBUTE; |
| 27 | namespace inference_runner { |
| 28 | extern uint8_t* GetModelPointer(); |
| 29 | extern size_t GetModelLen(); |
| 30 | } /* namespace inference_runner */ |
| 31 | } /* namespace app */ |
| 32 | } /* namespace arm */ |
| 33 | |
| 34 | TEST_CASE("Testing Init failure due to insufficient tensor arena inf runner", "[inf runner]") |
| 35 | { |
Liam Barry | f30d741 | 2023-09-27 12:48:35 +0100 | [diff] [blame] | 36 | arm::app::TestModel model{}; |
| 37 | REQUIRE_FALSE(model.IsInited()); |
| 38 | size_t insufficientTensorArenaSz = 1000; |
| 39 | REQUIRE_FALSE(model.Init(arm::app::tensorArena, |
| 40 | insufficientTensorArenaSz, |
| 41 | arm::app::inference_runner::GetModelPointer(), |
| 42 | arm::app::inference_runner::GetModelLen())); |
Liam Barry | f30d741 | 2023-09-27 12:48:35 +0100 | [diff] [blame] | 43 | REQUIRE_FALSE(model.IsInited()); |
| 44 | } |