aboutsummaryrefslogtreecommitdiff
path: root/src/backends/aclCommon
diff options
context:
space:
mode:
authorSadik Armagan <sadik.armagan@arm.com>2021-06-10 18:24:34 +0100
committerSadik Armagan <sadik.armagan@arm.com>2021-06-11 10:33:16 +0000
commit1625efc870f1a8b7c6e6382277ddbb245f91a294 (patch)
tree39fbbaa15ed7eb81337b082c2d20b0af68b91c02 /src/backends/aclCommon
parent958e0ba61e940a8d11955cf2a10f681c7c47e1fa (diff)
downloadarmnn-1625efc870f1a8b7c6e6382277ddbb245f91a294.tar.gz
IVGCVSW-5963 'Move unit tests to new framework'
* Used doctest in ArmNN unit tests Signed-off-by: Sadik Armagan <sadik.armagan@arm.com> Change-Id: Ia9cf5fc72775878885c5f864abf2c56b3a935f1a
Diffstat (limited to 'src/backends/aclCommon')
-rw-r--r--src/backends/aclCommon/test/ArmComputeTensorUtilsTests.cpp20
-rw-r--r--src/backends/aclCommon/test/CreateWorkloadClNeon.hpp18
-rw-r--r--src/backends/aclCommon/test/MemCopyTests.cpp46
3 files changed, 41 insertions, 43 deletions
diff --git a/src/backends/aclCommon/test/ArmComputeTensorUtilsTests.cpp b/src/backends/aclCommon/test/ArmComputeTensorUtilsTests.cpp
index 4ab748806c..fa933a0ec3 100644
--- a/src/backends/aclCommon/test/ArmComputeTensorUtilsTests.cpp
+++ b/src/backends/aclCommon/test/ArmComputeTensorUtilsTests.cpp
@@ -5,13 +5,13 @@
#include <aclCommon/ArmComputeTensorUtils.hpp>
-#include <boost/test/unit_test.hpp>
+#include <doctest/doctest.h>
using namespace armnn::armcomputetensorutils;
-BOOST_AUTO_TEST_SUITE(ArmComputeTensorUtils)
-
-BOOST_AUTO_TEST_CASE(BuildArmComputeTensorInfoTest)
+TEST_SUITE("ArmComputeTensorUtils")
+{
+TEST_CASE("BuildArmComputeTensorInfoTest")
{
const armnn::TensorShape tensorShape = { 1, 2, 3, 4 };
@@ -26,21 +26,21 @@ BOOST_AUTO_TEST_CASE(BuildArmComputeTensorInfoTest)
const arm_compute::TensorInfo aclTensorInfo0 = BuildArmComputeTensorInfo(tensorInfo0);
const arm_compute::TensorShape& aclTensorShape = aclTensorInfo0.tensor_shape();
- BOOST_CHECK(aclTensorShape.num_dimensions() == tensorShape.GetNumDimensions());
+ CHECK(aclTensorShape.num_dimensions() == tensorShape.GetNumDimensions());
for(unsigned int i = 0u; i < tensorShape.GetNumDimensions(); ++i)
{
// NOTE: arm_compute tensor dimensions are stored in the opposite order
- BOOST_CHECK(aclTensorShape[i] == tensorShape[tensorShape.GetNumDimensions() - i - 1]);
+ CHECK(aclTensorShape[i] == tensorShape[tensorShape.GetNumDimensions() - i - 1]);
}
- BOOST_CHECK(aclTensorInfo0.data_type() == arm_compute::DataType::QASYMM8);
- BOOST_CHECK(aclTensorInfo0.quantization_info().scale()[0] == quantScale);
+ CHECK(aclTensorInfo0.data_type() == arm_compute::DataType::QASYMM8);
+ CHECK(aclTensorInfo0.quantization_info().scale()[0] == quantScale);
// Tensor info with per-axis quantization
const armnn::TensorInfo tensorInfo1(tensorShape, dataType, quantScales, 0);
const arm_compute::TensorInfo aclTensorInfo1 = BuildArmComputeTensorInfo(tensorInfo1);
- BOOST_CHECK(aclTensorInfo1.quantization_info().scale() == quantScales);
+ CHECK(aclTensorInfo1.quantization_info().scale() == quantScales);
}
-BOOST_AUTO_TEST_SUITE_END()
+}
diff --git a/src/backends/aclCommon/test/CreateWorkloadClNeon.hpp b/src/backends/aclCommon/test/CreateWorkloadClNeon.hpp
index 0a30907f55..bdae9988ed 100644
--- a/src/backends/aclCommon/test/CreateWorkloadClNeon.hpp
+++ b/src/backends/aclCommon/test/CreateWorkloadClNeon.hpp
@@ -19,6 +19,8 @@
#include <neon/NeonTensorHandle.hpp>
#endif
+#include <doctest/doctest.h>
+
using namespace armnn;
namespace
@@ -92,23 +94,23 @@ void CreateMemCopyWorkloads(IWorkloadFactory& factory)
auto workload2 = MakeAndCheckWorkload<CopyMemGenericWorkload>(*layer2, refFactory);
MemCopyQueueDescriptor queueDescriptor1 = workload1->GetData();
- BOOST_TEST(queueDescriptor1.m_Inputs.size() == 1);
- BOOST_TEST(queueDescriptor1.m_Outputs.size() == 1);
+ CHECK(queueDescriptor1.m_Inputs.size() == 1);
+ CHECK(queueDescriptor1.m_Outputs.size() == 1);
auto inputHandle1 = PolymorphicDowncast<RefTensorHandle*>(queueDescriptor1.m_Inputs[0]);
auto outputHandle1 = PolymorphicDowncast<IComputeTensorHandle*>(queueDescriptor1.m_Outputs[0]);
- BOOST_TEST((inputHandle1->GetTensorInfo() == TensorInfo({2, 3}, DataType::Float32)));
+ CHECK((inputHandle1->GetTensorInfo() == TensorInfo({2, 3}, DataType::Float32)));
auto result = CompareTensorHandleShape<IComputeTensorHandle>(outputHandle1, {2, 3});
- BOOST_TEST(result.m_Result, result.m_Message.str());
+ CHECK_MESSAGE(result.m_Result, result.m_Message.str());
MemCopyQueueDescriptor queueDescriptor2 = workload2->GetData();
- BOOST_TEST(queueDescriptor2.m_Inputs.size() == 1);
- BOOST_TEST(queueDescriptor2.m_Outputs.size() == 1);
+ CHECK(queueDescriptor2.m_Inputs.size() == 1);
+ CHECK(queueDescriptor2.m_Outputs.size() == 1);
auto inputHandle2 = PolymorphicDowncast<IComputeTensorHandle*>(queueDescriptor2.m_Inputs[0]);
auto outputHandle2 = PolymorphicDowncast<RefTensorHandle*>(queueDescriptor2.m_Outputs[0]);
result = CompareTensorHandleShape<IComputeTensorHandle>(inputHandle2, {2, 3});
- BOOST_TEST(result.m_Result, result.m_Message.str());
- BOOST_TEST((outputHandle2->GetTensorInfo() == TensorInfo({2, 3}, DataType::Float32)));
+ CHECK_MESSAGE(result.m_Result, result.m_Message.str());
+ CHECK((outputHandle2->GetTensorInfo() == TensorInfo({2, 3}, DataType::Float32)));
}
} //namespace
diff --git a/src/backends/aclCommon/test/MemCopyTests.cpp b/src/backends/aclCommon/test/MemCopyTests.cpp
index 7612cbfe28..132550342c 100644
--- a/src/backends/aclCommon/test/MemCopyTests.cpp
+++ b/src/backends/aclCommon/test/MemCopyTests.cpp
@@ -15,71 +15,67 @@
#include <neon/test/NeonWorkloadFactoryHelper.hpp>
#endif
-#include <boost/test/unit_test.hpp>
+#include <doctest/doctest.h>
-BOOST_AUTO_TEST_SUITE(MemCopyCommon)
-
-BOOST_AUTO_TEST_CASE(AclTypeConversions)
+TEST_SUITE("MemCopyCommon")
+{
+TEST_CASE("AclTypeConversions")
{
arm_compute::Strides strides(1, 2, 3, 4);
armnn::TensorShape convertedStrides = armnn::armcomputetensorutils::GetStrides(strides);
- BOOST_TEST(convertedStrides[0] == 4);
- BOOST_TEST(convertedStrides[1] == 3);
- BOOST_TEST(convertedStrides[2] == 2);
- BOOST_TEST(convertedStrides[3] == 1);
+ CHECK(convertedStrides[0] == 4);
+ CHECK(convertedStrides[1] == 3);
+ CHECK(convertedStrides[2] == 2);
+ CHECK(convertedStrides[3] == 1);
arm_compute::TensorShape shape(5, 6, 7, 8);
armnn::TensorShape convertedshape = armnn::armcomputetensorutils::GetShape(shape);
- BOOST_TEST(convertedshape[0] == 8);
- BOOST_TEST(convertedshape[1] == 7);
- BOOST_TEST(convertedshape[2] == 6);
- BOOST_TEST(convertedshape[3] == 5);
+ CHECK(convertedshape[0] == 8);
+ CHECK(convertedshape[1] == 7);
+ CHECK(convertedshape[2] == 6);
+ CHECK(convertedshape[3] == 5);
}
-BOOST_AUTO_TEST_SUITE_END()
+}
#if defined(ARMCOMPUTECL_ENABLED) && defined(ARMCOMPUTENEON_ENABLED)
-BOOST_FIXTURE_TEST_SUITE(MemCopyClNeon, ClContextControlFixture)
-
-BOOST_AUTO_TEST_CASE(CopyBetweenNeonAndGpu)
+TEST_CASE_FIXTURE(ClContextControlFixture, "CopyBetweenNeonAndGpu")
{
LayerTestResult<float, 4> result =
MemCopyTest<armnn::NeonWorkloadFactory, armnn::ClWorkloadFactory, armnn::DataType::Float32>(false);
auto predResult = CompareTensors(result.m_ActualData, result.m_ExpectedData,
result.m_ActualShape, result.m_ExpectedShape);
- BOOST_TEST(predResult.m_Result, predResult.m_Message.str());
+ CHECK_MESSAGE(predResult.m_Result, predResult.m_Message.str());
}
-BOOST_AUTO_TEST_CASE(CopyBetweenGpuAndNeon)
+TEST_CASE_FIXTURE(ClContextControlFixture, "CopyBetweenGpuAndNeon")
{
LayerTestResult<float, 4> result =
MemCopyTest<armnn::ClWorkloadFactory, armnn::NeonWorkloadFactory, armnn::DataType::Float32>(false);
auto predResult = CompareTensors(result.m_ActualData, result.m_ExpectedData,
result.m_ActualShape, result.m_ExpectedShape);
- BOOST_TEST(predResult.m_Result, predResult.m_Message.str());
+ CHECK_MESSAGE(predResult.m_Result, predResult.m_Message.str());
}
-BOOST_AUTO_TEST_CASE(CopyBetweenNeonAndGpuWithSubtensors)
+TEST_CASE_FIXTURE(ClContextControlFixture, "CopyBetweenNeonAndGpuWithSubtensors")
{
LayerTestResult<float, 4> result =
MemCopyTest<armnn::NeonWorkloadFactory, armnn::ClWorkloadFactory, armnn::DataType::Float32>(true);
auto predResult = CompareTensors(result.m_ActualData, result.m_ExpectedData,
result.m_ActualShape, result.m_ExpectedShape);
- BOOST_TEST(predResult.m_Result, predResult.m_Message.str());
+ CHECK_MESSAGE(predResult.m_Result, predResult.m_Message.str());
}
-BOOST_AUTO_TEST_CASE(CopyBetweenGpuAndNeonWithSubtensors)
+TEST_CASE_FIXTURE(ClContextControlFixture, "CopyBetweenGpuAndNeonWithSubtensors")
{
LayerTestResult<float, 4> result =
MemCopyTest<armnn::ClWorkloadFactory, armnn::NeonWorkloadFactory, armnn::DataType::Float32>(true);
auto predResult = CompareTensors(result.m_ActualData, result.m_ExpectedData,
result.m_ActualShape, result.m_ExpectedShape);
- BOOST_TEST(predResult.m_Result, predResult.m_Message.str());
+ CHECK_MESSAGE(predResult.m_Result, predResult.m_Message.str());
}
-BOOST_AUTO_TEST_SUITE_END()
-
#endif