blob: 974d2c808fd18875fc2f831d3967368b74b346c5 [file] [log] [blame]
Liam Barryf30d7412023-09-27 12:48:35 +01001/*
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
24namespace arm {
25namespace 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
34TEST_CASE("Testing Init failure due to insufficient tensor arena inf runner", "[inf runner]")
35{
Liam Barryf30d7412023-09-27 12:48:35 +010036 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 Barryf30d7412023-09-27 12:48:35 +010043 REQUIRE_FALSE(model.IsInited());
44}