From 9150bff63a690caa743c471943afe509ebed1044 Mon Sep 17 00:00:00 2001 From: Sadik Armagan Date: Wed, 26 May 2021 15:40:53 +0100 Subject: IVGCVSW-4618 'Transition Units Test Suites' * Used doctest in android-nn-driver unit tests. Signed-off-by: Sadik Armagan Change-Id: I9b5d4dfd77d53c7ebee7f8c43628a1d6ff74d1a3 --- test/1.2/Capabilities.cpp | 36 ++++++++++++++++++---- test/1.2/Dilation.cpp | 24 +++++++-------- test/1.2/Lstm.cpp | 77 ++++++++++++++++++++++++++--------------------- 3 files changed, 84 insertions(+), 53 deletions(-) (limited to 'test/1.2') diff --git a/test/1.2/Capabilities.cpp b/test/1.2/Capabilities.cpp index 15ecf968..aa0c6423 100644 --- a/test/1.2/Capabilities.cpp +++ b/test/1.2/Capabilities.cpp @@ -9,7 +9,31 @@ #include -#include +// Un-define some of the macros as they clash in 'third-party/doctest/doctest.h' +// and 'system/core/base/include/android-base/logging.h' +// macro redefined error[-Werror,-Wmacro-redefined] +#ifdef CHECK +#undef CHECK +#endif +#ifdef CHECK_EQ +#undef CHECK_EQ +#endif +#ifdef CHECK_NE +#undef CHECK_NE +#endif +#ifdef CHECK_GT +#undef CHECK_GT +#endif +#ifdef CHECK_LT +#undef CHECK_LT +#endif +#ifdef CHECK_GE +#undef CHECK_GE +#endif +#ifdef CHECK_LE +#undef CHECK_LE +#endif +#include #include @@ -66,9 +90,9 @@ void CheckOperandType(const V1_2::Capabilities& capabilities, V1_2::OperandType ARMNN_ASSERT(perfInfo.powerUsage == powerUsage); } -BOOST_FIXTURE_TEST_SUITE(CapabilitiesTests, CapabilitiesFixture) - -BOOST_AUTO_TEST_CASE(PerformanceCapabilitiesWithRuntime) +TEST_SUITE("CapabilitiesTests") +{ +TEST_CASE_FIXTURE(CapabilitiesFixture, "PerformanceCapabilitiesWithRuntime") { using namespace armnn_driver::hal_1_2; using namespace android::nn; @@ -124,7 +148,7 @@ BOOST_AUTO_TEST_CASE(PerformanceCapabilitiesWithRuntime) ArmnnDriverImpl::getCapabilities_1_2(runtime, getCapabilitiesFn); } -BOOST_AUTO_TEST_CASE(PerformanceCapabilitiesUndefined) +TEST_CASE_FIXTURE(CapabilitiesFixture, "PerformanceCapabilitiesUndefined") { using namespace armnn_driver::hal_1_2; using namespace android::nn; @@ -164,4 +188,4 @@ BOOST_AUTO_TEST_CASE(PerformanceCapabilitiesUndefined) ArmnnDriverImpl::getCapabilities_1_2(runtime, getCapabilitiesFn); } -BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file +} \ No newline at end of file diff --git a/test/1.2/Dilation.cpp b/test/1.2/Dilation.cpp index 1a7ba4b4..e1cde9fd 100644 --- a/test/1.2/Dilation.cpp +++ b/test/1.2/Dilation.cpp @@ -7,11 +7,11 @@ #include "../../1.2/HalPolicy.hpp" -#include +#include -BOOST_AUTO_TEST_SUITE(DilationTests) - -BOOST_AUTO_TEST_CASE(ConvolutionExplicitPaddingNoDilation) +TEST_SUITE("DilationTests") +{ +TEST_CASE("ConvolutionExplicitPaddingNoDilation") { DilationTestOptions options; options.m_IsDepthwiseConvolution = false; @@ -21,7 +21,7 @@ BOOST_AUTO_TEST_CASE(ConvolutionExplicitPaddingNoDilation) DilationTestImpl(options); } -BOOST_AUTO_TEST_CASE(ConvolutionExplicitPaddingDilation) +TEST_CASE("ConvolutionExplicitPaddingDilation") { DilationTestOptions options; options.m_IsDepthwiseConvolution = false; @@ -31,7 +31,7 @@ BOOST_AUTO_TEST_CASE(ConvolutionExplicitPaddingDilation) DilationTestImpl(options); } -BOOST_AUTO_TEST_CASE(ConvolutionImplicitPaddingNoDilation) +TEST_CASE("ConvolutionImplicitPaddingNoDilation") { DilationTestOptions options; options.m_IsDepthwiseConvolution = false; @@ -41,7 +41,7 @@ BOOST_AUTO_TEST_CASE(ConvolutionImplicitPaddingNoDilation) DilationTestImpl(options); } -BOOST_AUTO_TEST_CASE(ConvolutionImplicitPaddingDilation) +TEST_CASE("ConvolutionImplicitPaddingDilation") { DilationTestOptions options; options.m_IsDepthwiseConvolution = false; @@ -51,7 +51,7 @@ BOOST_AUTO_TEST_CASE(ConvolutionImplicitPaddingDilation) DilationTestImpl(options); } -BOOST_AUTO_TEST_CASE(DepthwiseConvolutionExplicitPaddingNoDilation) +TEST_CASE("DepthwiseConvolutionExplicitPaddingNoDilation") { DilationTestOptions options; options.m_IsDepthwiseConvolution = true; @@ -61,7 +61,7 @@ BOOST_AUTO_TEST_CASE(DepthwiseConvolutionExplicitPaddingNoDilation) DilationTestImpl(options); } -BOOST_AUTO_TEST_CASE(DepthwiseConvolutionExplicitPaddingDilation) +TEST_CASE("DepthwiseConvolutionExplicitPaddingDilation") { DilationTestOptions options; options.m_IsDepthwiseConvolution = true; @@ -71,7 +71,7 @@ BOOST_AUTO_TEST_CASE(DepthwiseConvolutionExplicitPaddingDilation) DilationTestImpl(options); } -BOOST_AUTO_TEST_CASE(DepthwiseConvolutionImplicitPaddingNoDilation) +TEST_CASE("DepthwiseConvolutionImplicitPaddingNoDilation") { DilationTestOptions options; options.m_IsDepthwiseConvolution = true; @@ -81,7 +81,7 @@ BOOST_AUTO_TEST_CASE(DepthwiseConvolutionImplicitPaddingNoDilation) DilationTestImpl(options); } -BOOST_AUTO_TEST_CASE(DepthwiseConvolutionImplicitPaddingDilation) +TEST_CASE("DepthwiseConvolutionImplicitPaddingDilation") { DilationTestOptions options; options.m_IsDepthwiseConvolution = true; @@ -91,4 +91,4 @@ BOOST_AUTO_TEST_CASE(DepthwiseConvolutionImplicitPaddingDilation) DilationTestImpl(options); } -BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file +} \ No newline at end of file diff --git a/test/1.2/Lstm.cpp b/test/1.2/Lstm.cpp index 03f7fe47..70fbf70f 100644 --- a/test/1.2/Lstm.cpp +++ b/test/1.2/Lstm.cpp @@ -5,47 +5,54 @@ #include "../Lstm.hpp" -#include - -BOOST_AUTO_TEST_SUITE(LstmTests) - using namespace armnn_driver; -BOOST_DATA_TEST_CASE(LstmNoCifgNoPeepholeNoProjectionTest, COMPUTE_DEVICES) -{ - LstmNoCifgNoPeepholeNoProjection(sample); -} - -BOOST_DATA_TEST_CASE(LstmCifgPeepholeNoProjectionTest, COMPUTE_DEVICES) -{ - LstmCifgPeepholeNoProjection(sample); -} - -BOOST_DATA_TEST_CASE(LstmNoCifgPeepholeProjectionTest, COMPUTE_DEVICES) -{ - LstmNoCifgPeepholeProjection(sample); -} - -BOOST_DATA_TEST_CASE(LstmCifgPeepholeNoProjectionBatch2Test, COMPUTE_DEVICES) -{ - LstmCifgPeepholeNoProjectionBatch2(sample); -} - -BOOST_DATA_TEST_CASE(LstmNoCifgPeepholeProjectionNoClippingLayerNormTest, COMPUTE_DEVICES) +TEST_SUITE("LstmTests_1.2_CpuRef") { - LstmNoCifgPeepholeProjectionNoClippingLayerNorm(sample); -} - -BOOST_DATA_TEST_CASE(LstmCifgPeepholeProjectionNoClippingLayerNormTest, COMPUTE_DEVICES) -{ - LstmCifgPeepholeProjectionNoClippingLayerNorm(sample); + TEST_CASE("LstmNoCifgNoPeepholeNoProjectionTest_1.2_armnn::Compute::CpuRef") + { + LstmNoCifgNoPeepholeNoProjection(armnn::Compute::CpuRef); + } + TEST_CASE("LstmCifgPeepholeNoProjectionTest_1.2_CpuRef") + { + LstmCifgPeepholeNoProjection(armnn::Compute::CpuRef); + } + TEST_CASE("LstmNoCifgPeepholeProjectionTest_1.2_CpuRef") + { + LstmNoCifgPeepholeProjection(armnn::Compute::CpuRef); + } + TEST_CASE("LstmCifgPeepholeNoProjectionBatch2Test_1.2_CpuRef") + { + LstmCifgPeepholeNoProjectionBatch2(armnn::Compute::CpuRef); + } + TEST_CASE("QuantizedLstmTest_1.2_CpuRef") + { + QuantizedLstm(armnn::Compute::CpuRef); + } } #if defined(ARMCOMPUTECL_ENABLED) -BOOST_DATA_TEST_CASE(QuantizedLstmTest, COMPUTE_DEVICES) +TEST_SUITE("LstmTests_1.2_GpuAcc") { - QuantizedLstm(sample); + TEST_CASE("LstmNoCifgNoPeepholeNoProjectionTest_1.2_GpuAcc") + { + LstmNoCifgNoPeepholeNoProjection(armnn::Compute::GpuAcc); + } + TEST_CASE("LstmCifgPeepholeNoProjectionTest_1.2_GpuAcc") + { + LstmCifgPeepholeNoProjection(armnn::Compute::GpuAcc); + } + TEST_CASE("LstmNoCifgPeepholeProjectionTest_1.2_GpuAcc") + { + LstmNoCifgPeepholeProjection(armnn::Compute::GpuAcc); + } + TEST_CASE("LstmCifgPeepholeNoProjectionBatch2Test_1.2_GpuAcc") + { + LstmCifgPeepholeNoProjectionBatch2(armnn::Compute::GpuAcc); + } + TEST_CASE("QuantizedLstmTest_1.2_GpuAcc") + { + QuantizedLstm(armnn::Compute::GpuAcc); + } } #endif - -BOOST_AUTO_TEST_SUITE_END() -- cgit v1.2.1