aboutsummaryrefslogtreecommitdiff
path: root/src/armnnTfLiteParser/test/TfLiteParser.cpp
diff options
context:
space:
mode:
authorColm Donelan <colm.donelan@arm.com>2023-06-22 10:19:17 +0100
committerColm Donelan <colm.donelan@arm.com>2023-06-30 14:20:56 +0100
commit0dfb2658ce521571aa0f9e859f813c60fda9d8d6 (patch)
treeef4605cebb29c6754da8dfea0decd4250288e2a5 /src/armnnTfLiteParser/test/TfLiteParser.cpp
parent16e27cf81424dcad05d129f9ba368a8c446cd25f (diff)
downloadarmnn-0dfb2658ce521571aa0f9e859f813c60fda9d8d6.tar.gz
IVGCVSW-7666 Add a FileComparisonExecutor to ExecuteNetwork.
* Implement the "-C" command line option of executenetwork. * Add a FileComparisonExecutorFile which will read tensors from a previously written text file and compare them to the execution output. Signed-off-by: Colm Donelan <colm.donelan@arm.com> Change-Id: I8380fd263028af13d65a67fb6afd89626d1b07b8
Diffstat (limited to 'src/armnnTfLiteParser/test/TfLiteParser.cpp')
-rw-r--r--src/armnnTfLiteParser/test/TfLiteParser.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/armnnTfLiteParser/test/TfLiteParser.cpp b/src/armnnTfLiteParser/test/TfLiteParser.cpp
index 65bbaeae0f..841c46e620 100644
--- a/src/armnnTfLiteParser/test/TfLiteParser.cpp
+++ b/src/armnnTfLiteParser/test/TfLiteParser.cpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
+// Copyright © 2020, 2023 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
@@ -37,4 +37,20 @@ TEST_CASE_FIXTURE(NoInputBindingsFixture, "ParseBadInputBindings")
CHECK_THROWS_AS((RunTest<4, armnn::DataType::QAsymmU8>(0, { }, { 0 })), armnn::ParseException);
}
+TEST_CASE("ParseInvalidFileName")
+{
+ // Nullptr should throw InvalidArgumentException
+ CHECK_THROWS_AS(armnnTfLiteParser::TfLiteParserImpl::LoadModelFromFile(nullptr), armnn::InvalidArgumentException);
+ // Empty string should throw FileNotFoundException.
+ CHECK_THROWS_AS(armnnTfLiteParser::TfLiteParserImpl::LoadModelFromFile(""), armnn::FileNotFoundException);
+ // Garbage string should throw FileNotFoundException.
+ CHECK_THROWS_AS(armnnTfLiteParser::TfLiteParserImpl::LoadModelFromFile("askjfhseuirwqeuiy"),
+ armnn::FileNotFoundException);
+ // Valid directory should throw InvalidArgumentException
+ CHECK_THROWS_AS(armnnTfLiteParser::TfLiteParserImpl::LoadModelFromFile("."), armnn::InvalidArgumentException);
+ // Valid file but not a regular file should throw InvalidArgumentException
+ CHECK_THROWS_AS(armnnTfLiteParser::TfLiteParserImpl::LoadModelFromFile("/dev/null"),
+ armnn::InvalidArgumentException);
+}
+
}