17 #include <doctest/doctest.h> 39 template <
typename T, std::
size_t n>
42 bool testNameIndicatesUnsupported = testName.find(
"UNSUPPORTED") != std::string::npos;
43 CHECK_MESSAGE(testNameIndicatesUnsupported != testResult.
m_Supported,
44 "The test name does not match the supportedness it is reporting");
52 CHECK_MESSAGE(result.m_Result, result.m_Message.str());
56 template <
typename T, std::
size_t n>
59 bool testNameIndicatesUnsupported = testName.find(
"UNSUPPORTED") != std::string::npos;
60 for (
unsigned int i = 0; i < testResult.size(); ++i)
62 CHECK_MESSAGE(testNameIndicatesUnsupported != testResult[i].m_Supported,
63 "The test name does not match the supportedness it is reporting");
64 if (testResult[i].m_Supported)
67 testResult[i].m_ExpectedData,
68 testResult[i].m_ActualShape,
69 testResult[i].m_ExpectedShape);
70 CHECK_MESSAGE(result.m_Result, result.m_Message.str());
75 template<
typename FactoryType,
typename TFuncPtr,
typename... Args>
78 std::unique_ptr<armnn::IProfiler> profiler = std::make_unique<armnn::IProfiler>();
81 auto memoryManager = WorkloadFactoryHelper<FactoryType>::GetMemoryManager();
82 FactoryType workloadFactory = WorkloadFactoryHelper<FactoryType>::GetFactory(memoryManager);
84 auto testResult = (*testFunction)(workloadFactory, memoryManager, args...);
91 template<
typename FactoryType,
typename TFuncPtr,
typename... Args>
94 std::unique_ptr<armnn::IProfiler> profiler = std::make_unique<armnn::IProfiler>();
97 auto memoryManager = WorkloadFactoryHelper<FactoryType>::GetMemoryManager();
98 FactoryType workloadFactory = WorkloadFactoryHelper<FactoryType>::GetFactory(memoryManager);
100 auto tensorHandleFactory = WorkloadFactoryHelper<FactoryType>::GetTensorHandleFactory(memoryManager);
102 auto testResult = (*testFunction)(workloadFactory, memoryManager, tensorHandleFactory, args...);
108 #define ARMNN_SIMPLE_TEST_CASE(TestName, TestFunction) \ 109 TEST_CASE(#TestName) \ 114 #define ARMNN_AUTO_TEST_CASE(TestName, TestFunction, ...) \ 115 TEST_CASE(#TestName) \ 117 RunTestFunction<FactoryType>(#TestName, &TestFunction, ##__VA_ARGS__); \ 120 #define ARMNN_AUTO_TEST_FIXTURE(TestName, Fixture, TestFunction, ...) \ 121 TEST_CASE_FIXTURE(Fixture, #TestName) \ 123 RunTestFunction<FactoryType>(#TestName, &TestFunction, ##__VA_ARGS__); \ 126 #define ARMNN_AUTO_TEST_CASE_WITH_THF(TestName, TestFunction, ...) \ 127 TEST_CASE(#TestName) \ 129 RunTestFunctionUsingTensorHandleFactory<FactoryType>(#TestName, &TestFunction, ##__VA_ARGS__); \ 132 #define ARMNN_AUTO_TEST_FIXTURE_WITH_THF(TestName, Fixture, TestFunction, ...) \ 133 TEST_CASE_FIXTURE(Fixture, #TestName) \ 135 RunTestFunctionUsingTensorHandleFactory<FactoryType>(#TestName, &TestFunction, ##__VA_ARGS__); \ 138 template<
typename FactoryType,
typename TFuncPtr,
typename... Args>
141 auto memoryManager = WorkloadFactoryHelper<FactoryType>::GetMemoryManager();
142 FactoryType workloadFactory = WorkloadFactoryHelper<FactoryType>::GetFactory(memoryManager);
146 auto testResult = (*testFunction)(workloadFactory, memoryManager, refWorkloadFactory, args...);
150 template<
typename FactoryType,
typename TFuncPtr,
typename... Args>
153 auto memoryManager = WorkloadFactoryHelper<FactoryType>::GetMemoryManager();
154 FactoryType workloadFactory = WorkloadFactoryHelper<FactoryType>::GetFactory(memoryManager);
157 auto tensorHandleFactory = WorkloadFactoryHelper<FactoryType>::GetTensorHandleFactory(memoryManager);
158 auto refTensorHandleFactory =
159 RefWorkloadFactoryHelper::GetTensorHandleFactory(memoryManager);
161 auto testResult = (*testFunction)(
162 workloadFactory, memoryManager, refWorkloadFactory, tensorHandleFactory, refTensorHandleFactory, args...);
166 #define ARMNN_COMPARE_REF_AUTO_TEST_CASE(TestName, TestFunction, ...) \ 167 TEST_CASE(#TestName) \ 169 CompareRefTestFunction<FactoryType>(#TestName, &TestFunction, ##__VA_ARGS__); \ 172 #define ARMNN_COMPARE_REF_AUTO_TEST_CASE_WITH_THF(TestName, TestFunction, ...) \ 173 TEST_CASE(#TestName) \ 175 CompareRefTestFunctionUsingTensorHandleFactory<FactoryType>(#TestName, &TestFunction, ##__VA_ARGS__); \ 178 #define ARMNN_COMPARE_REF_FIXTURE_TEST_CASE(TestName, Fixture, TestFunction, ...) \ 179 TEST_CASE_FIXTURE(Fixture, #TestName) \ 181 CompareRefTestFunction<FactoryType>(#TestName, &TestFunction, ##__VA_ARGS__); \ 184 #define ARMNN_COMPARE_REF_FIXTURE_TEST_CASE_WITH_THF(TestName, Fixture, TestFunction, ...) \ 185 TEST_CASE_FIXTURE(Fixture, #TestName) \ 187 CompareRefTestFunctionUsingTensorHandleFactory<FactoryType>(#TestName, &TestFunction, ##__VA_ARGS__); \ armnn::TensorShape m_ExpectedShape
static ProfilerManager & GetInstance()
void ConfigureLogging(bool printToStandardOutput, bool printToDebugOutput, LogSeverity severity)
Configures the logging behaviour of the ARMNN library.
void CompareRefTestFunction(const char *testName, TFuncPtr testFunction, Args... args)
armnn::PredicateResult CompareTensors(const std::vector< T > &actualData, const std::vector< T > &expectedData, const armnn::TensorShape &actualShape, const armnn::TensorShape &expectedShape, bool compareBoolean=false, bool isDynamic=false)
void RunTestFunctionUsingTensorHandleFactory(const char *testName, TFuncPtr testFunction, Args... args)
void RunTestFunction(const char *testName, TFuncPtr testFunction, Args... args)
void CompareRefTestFunctionUsingTensorHandleFactory(const char *testName, TFuncPtr testFunction, Args... args)
void CompareTestResultIfSupported(const std::string &testName, const LayerTestResult< T, n > &testResult)
Executes CHECK_MESSAGE on CompareTensors() return value so that the predicate_result message is repor...
std::vector< T > m_ExpectedData
void ConfigureLoggingTest()
void RegisterProfiler(IProfiler *profiler)
std::vector< T > m_ActualData
armnn::TensorShape m_ActualShape