aboutsummaryrefslogtreecommitdiff
path: root/tests/InferenceTest.hpp
diff options
context:
space:
mode:
authorJames Ward <james.ward@arm.com>2020-10-12 14:17:36 +0100
committerJames Ward <james.ward@arm.com>2020-10-14 12:41:58 +0000
commitc89829f1f47855227f9a842c979f3a43800ea826 (patch)
tree40d58dfa85ff4f8ebf03f5b594ace1775fae2c22 /tests/InferenceTest.hpp
parentf9f33a04626756b73e6fd5c89092fd4bcb504b16 (diff)
downloadarmnn-c89829f1f47855227f9a842c979f3a43800ea826.tar.gz
IVGCVSW-5280 Switch tests/InferenceTest and derived tests over to cxxopts
* refactor AddCommandLineOptions() functions to allow checking of required options * add CxxoptsUtils.hpp file for convenience functions !referencetests:268500 Signed-off-by: James Ward <james.ward@arm.com> Change-Id: Ica954b210b2981b7cd10995f0d75fcb2a2f7b443
Diffstat (limited to 'tests/InferenceTest.hpp')
-rw-r--r--tests/InferenceTest.hpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/InferenceTest.hpp b/tests/InferenceTest.hpp
index 1dafd01c01..5ec744ca7e 100644
--- a/tests/InferenceTest.hpp
+++ b/tests/InferenceTest.hpp
@@ -11,7 +11,8 @@
#include <armnn/TypesUtils.hpp>
#include <armnn/utility/IgnoreUnused.hpp>
-#include <boost/program_options.hpp>
+#include <cxxopts/cxxopts.hpp>
+#include <fmt/format.h>
namespace armnn
@@ -25,7 +26,7 @@ inline std::istream& operator>>(std::istream& in, armnn::Compute& compute)
if (compute == armnn::Compute::Undefined)
{
in.setstate(std::ios_base::failbit);
- throw boost::program_options::validation_error(boost::program_options::validation_error::invalid_option_value);
+ throw cxxopts::OptionException(fmt::format("Unrecognised compute device: {}", token));
}
return in;
}
@@ -38,7 +39,7 @@ inline std::istream& operator>>(std::istream& in, armnn::BackendId& backend)
if (compute == armnn::Compute::Undefined)
{
in.setstate(std::ios_base::failbit);
- throw boost::program_options::validation_error(boost::program_options::validation_error::invalid_option_value);
+ throw cxxopts::OptionException(fmt::format("Unrecognised compute device: {}", token));
}
backend = compute;
return in;
@@ -92,9 +93,9 @@ class IInferenceTestCaseProvider
public:
virtual ~IInferenceTestCaseProvider() {}
- virtual void AddCommandLineOptions(boost::program_options::options_description& options)
+ virtual void AddCommandLineOptions(cxxopts::Options& options, std::vector<std::string>& required)
{
- IgnoreUnused(options);
+ IgnoreUnused(options, required);
};
virtual bool ProcessCommandLineOptions(const InferenceTestOptions &commonOptions)
{
@@ -180,7 +181,7 @@ public:
template <typename TConstructDatabaseCallable, typename TConstructModelCallable>
ClassifierTestCaseProvider(TConstructDatabaseCallable constructDatabase, TConstructModelCallable constructModel);
- virtual void AddCommandLineOptions(boost::program_options::options_description& options) override;
+ virtual void AddCommandLineOptions(cxxopts::Options& options, std::vector<std::string>& required) override;
virtual bool ProcessCommandLineOptions(const InferenceTestOptions &commonOptions) override;
virtual std::unique_ptr<IInferenceTestCase> GetTestCase(unsigned int testCaseId) override;
virtual bool OnInferenceTestFinished() override;