blob: 36827c0586a5db989f96400a6c995b0a4326f371 [file] [log] [blame]
Colm Donelan6350d272020-06-09 16:56:25 +01001//
2// Copyright © 2020 Arm Ltd. All rights reserved.
3// SPDX-License-Identifier: MIT
4//
5
6#include <boost/test/unit_test.hpp>
7#include "ParserFlatbuffersFixture.hpp"
8#include "../TfLiteParser.hpp"
9
10BOOST_AUTO_TEST_SUITE(TensorflowLiteParser)
11
12BOOST_AUTO_TEST_CASE(ParseEmptyBinaryData)
13{
14 ITfLiteParser::TfLiteParserOptions options;
15 ITfLiteParserPtr m_Parser(ITfLiteParser::Create(armnn::Optional<ITfLiteParser::TfLiteParserOptions>(options)));
16 // Should throw armnn::ParseException: Buffer doesn't conform to the expected Tensorflow Lite flatbuffers format.
17 BOOST_CHECK_THROW(m_Parser->CreateNetworkFromBinary({0}), armnn::ParseException);
18}
19
20struct NoInputBindingsFixture : public ParserFlatbuffersFixture
21{
22 explicit NoInputBindingsFixture()
23 {
24 m_JsonString = R"(
25 {
26 "version": 3,
27 "operator_codes": [ { "builtin_code": "CONV_2D" } ],
28 "subgraphs": [ { } ]
29 }
30 )";
31 SetupSingleInputSingleOutput("inputTensor", "outputTensor");
32 }
33};
34
35BOOST_FIXTURE_TEST_CASE( ParseBadInputBindings, NoInputBindingsFixture )
36{
37 // Should throw armnn::ParseException: No input binding found for subgraph:0 and name:inputTensor.
38 BOOST_CHECK_THROW( (RunTest<4, armnn::DataType::QAsymmU8>(0, { }, { 0 })), armnn::ParseException);
39}
40
41BOOST_AUTO_TEST_SUITE_END()