13 #include <boost/test/unit_test.hpp> 35 template <
typename T, std::
size_t n>
38 bool testNameIndicatesUnsupported = testName.find(
"UNSUPPORTED") != std::string::npos;
39 BOOST_CHECK_MESSAGE(testNameIndicatesUnsupported != testResult.
supported,
40 "The test name does not match the supportedness it is reporting");
47 template <
typename T, std::
size_t n>
50 bool testNameIndicatesUnsupported = testName.find(
"UNSUPPORTED") != std::string::npos;
51 for (
unsigned int i = 0; i < testResult.size(); ++i)
53 BOOST_CHECK_MESSAGE(testNameIndicatesUnsupported != testResult[i].
supported,
54 "The test name does not match the supportedness it is reporting");
55 if (testResult[i].supported)
57 BOOST_TEST(
CompareTensors(testResult[i].output, testResult[i].outputExpected));
62 template<
typename FactoryType,
typename TFuncPtr,
typename... Args>
65 std::unique_ptr<armnn::Profiler> profiler = std::make_unique<armnn::Profiler>();
68 auto memoryManager = WorkloadFactoryHelper<FactoryType>::GetMemoryManager();
69 FactoryType workloadFactory = WorkloadFactoryHelper<FactoryType>::GetFactory(memoryManager);
71 auto testResult = (*testFunction)(workloadFactory, memoryManager, args...);
75 #define ARMNN_SIMPLE_TEST_CASE(TestName, TestFunction) \ 76 BOOST_AUTO_TEST_CASE(TestName) \ 81 #define ARMNN_AUTO_TEST_CASE(TestName, TestFunction, ...) \ 82 BOOST_AUTO_TEST_CASE(TestName) \ 84 RunTestFunction<FactoryType>(#TestName, &TestFunction, ##__VA_ARGS__); \ 87 template<
typename FactoryType,
typename TFuncPtr,
typename... Args>
90 auto memoryManager = WorkloadFactoryHelper<FactoryType>::GetMemoryManager();
91 FactoryType workloadFactory = WorkloadFactoryHelper<FactoryType>::GetFactory(memoryManager);
95 auto testResult = (*testFunction)(workloadFactory, memoryManager, refWorkloadFactory, args...);
99 #define ARMNN_COMPARE_REF_AUTO_TEST_CASE(TestName, TestFunction, ...) \ 100 BOOST_AUTO_TEST_CASE(TestName) \ 102 CompareRefTestFunction<FactoryType>(#TestName, &TestFunction, ##__VA_ARGS__); \ 105 #define ARMNN_COMPARE_REF_FIXTURE_TEST_CASE(TestName, Fixture, TestFunction, ...) \ 106 BOOST_FIXTURE_TEST_CASE(TestName, Fixture) \ 108 CompareRefTestFunction<FactoryType>(#TestName, &TestFunction, ##__VA_ARGS__); \
void RegisterProfiler(Profiler *profiler)
static ProfilerManager & GetInstance()
void ConfigureLogging(bool printToStandardOutput, bool printToDebugOutput, LogSeverity severity)
Configures the logging behaviour of the ARMNN library.
ISubgraphViewConverter supported
boost::test_tools::predicate_result CompareTensors(const boost::multi_array< T, n > &a, const boost::multi_array< T, n > &b, bool compareBoolean=false)
boost::multi_array< T, n > outputExpected
void CompareRefTestFunction(const char *testName, TFuncPtr testFunction, Args... args)
void RunTestFunction(const char *testName, TFuncPtr testFunction, Args... args)
void CompareTestResultIfSupported(const std::string &testName, const LayerTestResult< T, n > &testResult)
Executes BOOST_TEST on CompareTensors() return value so that the predicate_result message is reported...
void ConfigureLoggingTest()
boost::multi_array< T, n > output
ClWorkloadFactory FactoryType