diff options
Diffstat (limited to 'src/armnnUtils/test')
-rw-r--r-- | src/armnnUtils/test/FloatingPointComparisonTest.cpp | 116 | ||||
-rw-r--r-- | src/armnnUtils/test/ParserHelperTest.cpp | 38 | ||||
-rw-r--r-- | src/armnnUtils/test/PrototxtConversionsTest.cpp | 42 | ||||
-rw-r--r-- | src/armnnUtils/test/QuantizeHelperTest.cpp | 22 | ||||
-rw-r--r-- | src/armnnUtils/test/TensorUtilsTest.cpp | 112 | ||||
-rw-r--r-- | src/armnnUtils/test/TransformIteratorTest.cpp | 19 |
6 files changed, 175 insertions, 174 deletions
diff --git a/src/armnnUtils/test/FloatingPointComparisonTest.cpp b/src/armnnUtils/test/FloatingPointComparisonTest.cpp index dab0deb5e6..7b97404ed3 100644 --- a/src/armnnUtils/test/FloatingPointComparisonTest.cpp +++ b/src/armnnUtils/test/FloatingPointComparisonTest.cpp @@ -5,133 +5,133 @@ #include <armnnUtils/FloatingPointComparison.hpp> -#include <boost/test/unit_test.hpp> +#include <doctest/doctest.h> using namespace armnnUtils; -BOOST_AUTO_TEST_SUITE(FloatingPointComparisonSuite) - -BOOST_AUTO_TEST_CASE(FloatingPointComparisonDefaultTolerance) +TEST_SUITE("FloatingPointComparisonSuite") +{ +TEST_CASE("FloatingPointComparisonDefaultTolerance") { // 1% range of 1.2 is 1.188 -> 1.212 // Just below tolerance. - BOOST_TEST(!within_percentage_tolerance(1.2f, 1.17f)); + CHECK(!within_percentage_tolerance(1.2f, 1.17f)); // Just above tolerance. - BOOST_TEST(!within_percentage_tolerance(1.2f, 1.213f)); + CHECK(!within_percentage_tolerance(1.2f, 1.213f)); // Just inside the lower range. - BOOST_TEST(within_percentage_tolerance(1.2f, 1.189f)); + CHECK(within_percentage_tolerance(1.2f, 1.189f)); // Just inside the upper range. - BOOST_TEST(within_percentage_tolerance(1.2f, 1.210f)); + CHECK(within_percentage_tolerance(1.2f, 1.210f)); // Exact match - BOOST_TEST(within_percentage_tolerance(1.2f, 1.2f)); + CHECK(within_percentage_tolerance(1.2f, 1.2f)); // Negative value tests. - BOOST_TEST(!within_percentage_tolerance(-1.2f, -1.17f)); - BOOST_TEST(!within_percentage_tolerance(-1.2f, -1.213f)); - BOOST_TEST(within_percentage_tolerance(-1.2f, -1.189f)); - BOOST_TEST(within_percentage_tolerance(-1.2f, -1.210f)); - BOOST_TEST(within_percentage_tolerance(-1.2f, -1.2f)); + CHECK(!within_percentage_tolerance(-1.2f, -1.17f)); + CHECK(!within_percentage_tolerance(-1.2f, -1.213f)); + CHECK(within_percentage_tolerance(-1.2f, -1.189f)); + CHECK(within_percentage_tolerance(-1.2f, -1.210f)); + CHECK(within_percentage_tolerance(-1.2f, -1.2f)); // Negative & positive tests - BOOST_TEST(!within_percentage_tolerance(1.2f, -1.2f)); - BOOST_TEST(!within_percentage_tolerance(-1.2f, 1.2f)); + CHECK(!within_percentage_tolerance(1.2f, -1.2f)); + CHECK(!within_percentage_tolerance(-1.2f, 1.2f)); // Negative and positive test with large float values. - BOOST_TEST(!within_percentage_tolerance(3.3E+38f, -1.17549435e38f)); - BOOST_TEST(!within_percentage_tolerance(-1.17549435e38f, 3.3E+38f)); + CHECK(!within_percentage_tolerance(3.3E+38f, -1.17549435e38f)); + CHECK(!within_percentage_tolerance(-1.17549435e38f, 3.3E+38f)); // 1% range of 0.04 is 0.0396 -> 0.0404 // Just below tolerance. - BOOST_TEST(!within_percentage_tolerance(0.04f, 0.039f)); + CHECK(!within_percentage_tolerance(0.04f, 0.039f)); // Just above tolerance. - BOOST_TEST(!within_percentage_tolerance(0.04f, 0.04041f)); + CHECK(!within_percentage_tolerance(0.04f, 0.04041f)); // Just inside the lower range. - BOOST_TEST(within_percentage_tolerance(0.04f, 0.0397f)); + CHECK(within_percentage_tolerance(0.04f, 0.0397f)); // Just inside the upper range. - BOOST_TEST(within_percentage_tolerance(0.04f, 0.04039f)); + CHECK(within_percentage_tolerance(0.04f, 0.04039f)); // Exact match - BOOST_TEST(within_percentage_tolerance(0.04f, 0.04f)); + CHECK(within_percentage_tolerance(0.04f, 0.04f)); } -BOOST_AUTO_TEST_CASE(FloatingPointComparisonLargePositiveNumbersDefaultTolerance) +TEST_CASE("FloatingPointComparisonLargePositiveNumbersDefaultTolerance") { // Just below tolerance. - BOOST_TEST(!within_percentage_tolerance(3.3E+38f, (3.3E+38f * 0.989f))); + CHECK(!within_percentage_tolerance(3.3E+38f, (3.3E+38f * 0.989f))); // Just above tolerance. - BOOST_TEST(!within_percentage_tolerance(3.3E+38f, (3.3E+38f * 1.011f))); + CHECK(!within_percentage_tolerance(3.3E+38f, (3.3E+38f * 1.011f))); // Just inside the lower range. - BOOST_TEST(within_percentage_tolerance(3.3E+38f, (3.3E+38f * 0.992f))); + CHECK(within_percentage_tolerance(3.3E+38f, (3.3E+38f * 0.992f))); // Just inside the upper range. - BOOST_TEST(within_percentage_tolerance(3.3E+38f, (3.3E+38f * 1.009f))); + CHECK(within_percentage_tolerance(3.3E+38f, (3.3E+38f * 1.009f))); // Exact match - BOOST_TEST(within_percentage_tolerance(3.3E+38f, 3.3E+38f)); + CHECK(within_percentage_tolerance(3.3E+38f, 3.3E+38f)); } -BOOST_AUTO_TEST_CASE(FloatingPointComparisonLargeNegativeNumbersDefaultTolerance) +TEST_CASE("FloatingPointComparisonLargeNegativeNumbersDefaultTolerance") { // Just below tolerance. - BOOST_TEST(!within_percentage_tolerance(-1.17549435e38f, (-1.17549435e38f * -1.009f))); + CHECK(!within_percentage_tolerance(-1.17549435e38f, (-1.17549435e38f * -1.009f))); // Just above tolerance. - BOOST_TEST(!within_percentage_tolerance(-1.17549435e38f, (-1.17549435e38f * 1.011f))); + CHECK(!within_percentage_tolerance(-1.17549435e38f, (-1.17549435e38f * 1.011f))); // Just inside the lower range. - BOOST_TEST(within_percentage_tolerance(-1.17549435e38f, -1.17549435e38f - (-1.17549435e38f * 0.0099f))); + CHECK(within_percentage_tolerance(-1.17549435e38f, -1.17549435e38f - (-1.17549435e38f * 0.0099f))); // Just inside the upper range. - BOOST_TEST(within_percentage_tolerance(-1.17549435e38f, -1.17549435e38f + (-1.17549435e38f * 0.0099f))); + CHECK(within_percentage_tolerance(-1.17549435e38f, -1.17549435e38f + (-1.17549435e38f * 0.0099f))); // Exact match - BOOST_TEST(within_percentage_tolerance(-1.17549435e38f, -1.17549435e38f)); + CHECK(within_percentage_tolerance(-1.17549435e38f, -1.17549435e38f)); } -BOOST_AUTO_TEST_CASE(FloatingPointComparisonSpecifiedTolerance) +TEST_CASE("FloatingPointComparisonSpecifiedTolerance") { // 2% range of 1.2 is 1.176 -> 1.224 // Just below tolerance. - BOOST_TEST(!within_percentage_tolerance(1.2f, 1.175f, 2.0f)); + CHECK(!within_percentage_tolerance(1.2f, 1.175f, 2.0f)); // Just above tolerance. - BOOST_TEST(!within_percentage_tolerance(1.2f, 1.226f, 2.0f)); + CHECK(!within_percentage_tolerance(1.2f, 1.226f, 2.0f)); // Just inside the lower range. - BOOST_TEST(within_percentage_tolerance(1.2f, 1.18f, 2.0f)); + CHECK(within_percentage_tolerance(1.2f, 1.18f, 2.0f)); // Just inside the upper range. - BOOST_TEST(within_percentage_tolerance(1.2f, 1.22f, 2.0f)); + CHECK(within_percentage_tolerance(1.2f, 1.22f, 2.0f)); // Exact match. - BOOST_TEST(within_percentage_tolerance(1.2f, 1.2f, 2.0f)); + CHECK(within_percentage_tolerance(1.2f, 1.2f, 2.0f)); // 5% range of 6.2 is 5.89 -> 6.51 // Just below tolerance. - BOOST_TEST(!within_percentage_tolerance(6.2f, 5.88f, 5.0f)); + CHECK(!within_percentage_tolerance(6.2f, 5.88f, 5.0f)); // Just above tolerance. - BOOST_TEST(!within_percentage_tolerance(6.2f, 6.52f, 5.0f)); + CHECK(!within_percentage_tolerance(6.2f, 6.52f, 5.0f)); // Just inside the lower range. - BOOST_TEST(within_percentage_tolerance(6.2f, 5.9f, 5.0f)); + CHECK(within_percentage_tolerance(6.2f, 5.9f, 5.0f)); // Just inside the upper range. - BOOST_TEST(within_percentage_tolerance(6.2f, 6.5f, 5.0f)); + CHECK(within_percentage_tolerance(6.2f, 6.5f, 5.0f)); // Larger tolerance (unlikely to be used). - BOOST_TEST(within_percentage_tolerance(10.0f, 9.01f, 10.0f)); - BOOST_TEST(!within_percentage_tolerance(10.0f, 8.99f, 10.0f)); + CHECK(within_percentage_tolerance(10.0f, 9.01f, 10.0f)); + CHECK(!within_percentage_tolerance(10.0f, 8.99f, 10.0f)); } -BOOST_AUTO_TEST_CASE(FloatingPointComparisonLargePositiveNumbersSpecifiedTolerance) +TEST_CASE("FloatingPointComparisonLargePositiveNumbersSpecifiedTolerance") { // Just below tolerance. - BOOST_TEST(!within_percentage_tolerance(3.3E+38f, (3.3E+38f * 0.979f), 2.0f)); + CHECK(!within_percentage_tolerance(3.3E+38f, (3.3E+38f * 0.979f), 2.0f)); // Just above tolerance. - BOOST_TEST(!within_percentage_tolerance(3.3E+38f, (3.3E+38f * 1.021f), 2.0f)); + CHECK(!within_percentage_tolerance(3.3E+38f, (3.3E+38f * 1.021f), 2.0f)); // Just inside the lower range. - BOOST_TEST(within_percentage_tolerance(3.3E+38f, (3.3E+38f * 0.982f), 2.0f)); + CHECK(within_percentage_tolerance(3.3E+38f, (3.3E+38f * 0.982f), 2.0f)); // Just inside the upper range. - BOOST_TEST(within_percentage_tolerance(3.3E+38f, (3.3E+38f * 1.019f), 2.0f)); + CHECK(within_percentage_tolerance(3.3E+38f, (3.3E+38f * 1.019f), 2.0f)); } -BOOST_AUTO_TEST_CASE(FloatingPointComparisonLargeNegativeNumbersSpecifiedTolerance) +TEST_CASE("FloatingPointComparisonLargeNegativeNumbersSpecifiedTolerance") { // Just below tolerance. - BOOST_TEST(!within_percentage_tolerance(-1.17549435e38f, (-1.17549435e38f * -1.019f), 2.0f)); + CHECK(!within_percentage_tolerance(-1.17549435e38f, (-1.17549435e38f * -1.019f), 2.0f)); // Just above tolerance. - BOOST_TEST(!within_percentage_tolerance(-1.17549435e38f, (-1.17549435e38f * 1.021f), 2.0f)); + CHECK(!within_percentage_tolerance(-1.17549435e38f, (-1.17549435e38f * 1.021f), 2.0f)); // Just inside the lower range. - BOOST_TEST(within_percentage_tolerance(-1.17549435e38f, -1.17549435e38f - (-1.17549435e38f * 0.0089f), 2.0f)); + CHECK(within_percentage_tolerance(-1.17549435e38f, -1.17549435e38f - (-1.17549435e38f * 0.0089f), 2.0f)); // Just inside the upper range. - BOOST_TEST(within_percentage_tolerance(-1.17549435e38f, -1.17549435e38f + (-1.17549435e38f * 0.0089f), 2.0f)); + CHECK(within_percentage_tolerance(-1.17549435e38f, -1.17549435e38f + (-1.17549435e38f * 0.0089f), 2.0f)); } -BOOST_AUTO_TEST_SUITE_END() +} diff --git a/src/armnnUtils/test/ParserHelperTest.cpp b/src/armnnUtils/test/ParserHelperTest.cpp index dbf0673bf5..2ed9bd1f03 100644 --- a/src/armnnUtils/test/ParserHelperTest.cpp +++ b/src/armnnUtils/test/ParserHelperTest.cpp @@ -8,15 +8,15 @@ #include <armnn/Tensor.hpp> #include <armnn/Types.hpp> -#include <boost/test/unit_test.hpp> +#include <doctest/doctest.h> using namespace armnn; using namespace armnnUtils; -BOOST_AUTO_TEST_SUITE(ParserHelperSuite) - -BOOST_AUTO_TEST_CASE(CalculateReducedOutputTensoInfoTest) +TEST_SUITE("ParserHelperSuite") +{ +TEST_CASE("CalculateReducedOutputTensoInfoTest") { bool keepDims = false; @@ -29,8 +29,8 @@ BOOST_AUTO_TEST_CASE(CalculateReducedOutputTensoInfoTest) CalculateReducedOutputTensoInfo(inputTensorInfo, axisData1, keepDims, outputTensorInfo1); - BOOST_TEST(outputTensorInfo1.GetNumDimensions() == 1); - BOOST_TEST(outputTensorInfo1.GetShape()[0] == 1); + CHECK(outputTensorInfo1.GetNumDimensions() == 1); + CHECK(outputTensorInfo1.GetShape()[0] == 1); // Reducing dimension 0 results in a 3x4 size tensor (one dimension) std::set<unsigned int> axisData2 = { 0 }; @@ -38,8 +38,8 @@ BOOST_AUTO_TEST_CASE(CalculateReducedOutputTensoInfoTest) CalculateReducedOutputTensoInfo(inputTensorInfo, axisData2, keepDims, outputTensorInfo2); - BOOST_TEST(outputTensorInfo2.GetNumDimensions() == 1); - BOOST_TEST(outputTensorInfo2.GetShape()[0] == 12); + CHECK(outputTensorInfo2.GetNumDimensions() == 1); + CHECK(outputTensorInfo2.GetShape()[0] == 12); // Reducing dimensions 0,1 results in a 4 size tensor (one dimension) std::set<unsigned int> axisData3 = { 0, 1 }; @@ -47,8 +47,8 @@ BOOST_AUTO_TEST_CASE(CalculateReducedOutputTensoInfoTest) CalculateReducedOutputTensoInfo(inputTensorInfo, axisData3, keepDims, outputTensorInfo3); - BOOST_TEST(outputTensorInfo3.GetNumDimensions() == 1); - BOOST_TEST(outputTensorInfo3.GetShape()[0] == 4); + CHECK(outputTensorInfo3.GetNumDimensions() == 1); + CHECK(outputTensorInfo3.GetShape()[0] == 4); // Reducing dimension 0 results in a { 1, 3, 4 } dimension tensor keepDims = true; @@ -58,10 +58,10 @@ BOOST_AUTO_TEST_CASE(CalculateReducedOutputTensoInfoTest) CalculateReducedOutputTensoInfo(inputTensorInfo, axisData4, keepDims, outputTensorInfo4); - BOOST_TEST(outputTensorInfo4.GetNumDimensions() == 3); - BOOST_TEST(outputTensorInfo4.GetShape()[0] == 1); - BOOST_TEST(outputTensorInfo4.GetShape()[1] == 3); - BOOST_TEST(outputTensorInfo4.GetShape()[2] == 4); + CHECK(outputTensorInfo4.GetNumDimensions() == 3); + CHECK(outputTensorInfo4.GetShape()[0] == 1); + CHECK(outputTensorInfo4.GetShape()[1] == 3); + CHECK(outputTensorInfo4.GetShape()[2] == 4); // Reducing dimension 1, 2 results in a { 2, 1, 1 } dimension tensor keepDims = true; @@ -71,12 +71,12 @@ BOOST_AUTO_TEST_CASE(CalculateReducedOutputTensoInfoTest) CalculateReducedOutputTensoInfo(inputTensorInfo, axisData5, keepDims, outputTensorInfo5); - BOOST_TEST(outputTensorInfo5.GetNumDimensions() == 3); - BOOST_TEST(outputTensorInfo5.GetShape()[0] == 2); - BOOST_TEST(outputTensorInfo5.GetShape()[1] == 1); - BOOST_TEST(outputTensorInfo5.GetShape()[2] == 1); + CHECK(outputTensorInfo5.GetNumDimensions() == 3); + CHECK(outputTensorInfo5.GetShape()[0] == 2); + CHECK(outputTensorInfo5.GetShape()[1] == 1); + CHECK(outputTensorInfo5.GetShape()[2] == 1); } -BOOST_AUTO_TEST_SUITE_END() +} diff --git a/src/armnnUtils/test/PrototxtConversionsTest.cpp b/src/armnnUtils/test/PrototxtConversionsTest.cpp index d51c8015cf..dc6b6a58f9 100644 --- a/src/armnnUtils/test/PrototxtConversionsTest.cpp +++ b/src/armnnUtils/test/PrototxtConversionsTest.cpp @@ -6,40 +6,40 @@ #include <PrototxtConversions.hpp> #include "armnn/Tensor.hpp" -#include <boost/test/unit_test.hpp> +#include <doctest/doctest.h> -BOOST_AUTO_TEST_SUITE(PrototxtConversions) - -BOOST_AUTO_TEST_CASE(ConvertInt32ToOctalStringTest) +TEST_SUITE("PrototxtConversions") +{ +TEST_CASE("ConvertInt32ToOctalStringTest") { using armnnUtils::ConvertInt32ToOctalString; std::string octalString = ConvertInt32ToOctalString(1); - BOOST_TEST(octalString.compare("\\\\001\\\\000\\\\000\\\\000")); + CHECK(octalString.compare("\\\\001\\\\000\\\\000\\\\000")); octalString = ConvertInt32ToOctalString(256); - BOOST_TEST(octalString.compare("\\\\000\\\\100\\\\000\\\\000")); + CHECK(octalString.compare("\\\\000\\\\100\\\\000\\\\000")); octalString = ConvertInt32ToOctalString(65536); - BOOST_TEST(octalString.compare("\\\\000\\\\000\\\\100\\\\000")); + CHECK(octalString.compare("\\\\000\\\\000\\\\100\\\\000")); octalString = ConvertInt32ToOctalString(16777216); - BOOST_TEST(octalString.compare("\\\\000\\\\000\\\\000\\\\100")); + CHECK(octalString.compare("\\\\000\\\\000\\\\000\\\\100")); octalString = ConvertInt32ToOctalString(-1); - BOOST_TEST(octalString.compare("\\\\377\\\\377\\\\377\\\\377")); + CHECK(octalString.compare("\\\\377\\\\377\\\\377\\\\377")); octalString = ConvertInt32ToOctalString(-256); - BOOST_TEST(octalString.compare("\\\\000\\\\377\\\\377\\\\377")); + CHECK(octalString.compare("\\\\000\\\\377\\\\377\\\\377")); octalString = ConvertInt32ToOctalString(-65536); - BOOST_TEST(octalString.compare("\\\\000\\\\000\\\\377\\\\377")); + CHECK(octalString.compare("\\\\000\\\\000\\\\377\\\\377")); octalString = ConvertInt32ToOctalString(-16777216); - BOOST_TEST(octalString.compare("\\\\000\\\\000\\\\000\\\\377")); + CHECK(octalString.compare("\\\\000\\\\000\\\\000\\\\377")); } -BOOST_AUTO_TEST_CASE(ConvertTensorShapeToStringTest) +TEST_CASE("ConvertTensorShapeToStringTest") { using armnnUtils::ConvertTensorShapeToString; using armnn::TensorShape; @@ -51,13 +51,13 @@ BOOST_AUTO_TEST_CASE(ConvertTensorShapeToStringTest) }; auto output_string = createAndConvert({5}); - BOOST_TEST(output_string.compare( + CHECK(output_string.compare( "dim {\n" "size: 5\n" "}")); output_string = createAndConvert({4, 5}); - BOOST_TEST(output_string.compare( + CHECK(output_string.compare( "dim {\n" "size: 4\n" "}\n" @@ -67,7 +67,7 @@ BOOST_AUTO_TEST_CASE(ConvertTensorShapeToStringTest) )); output_string = createAndConvert({3, 4, 5}); - BOOST_TEST(output_string.compare( + CHECK(output_string.compare( "dim {\n" "size: 3\n" "}\n" @@ -80,7 +80,7 @@ BOOST_AUTO_TEST_CASE(ConvertTensorShapeToStringTest) )); output_string = createAndConvert({2, 3, 4, 5}); - BOOST_TEST(output_string.compare( + CHECK(output_string.compare( "dim {\n" "size: 2\n" "}\n" @@ -96,7 +96,7 @@ BOOST_AUTO_TEST_CASE(ConvertTensorShapeToStringTest) )); output_string = createAndConvert({1, 2, 3, 4, 5}); - BOOST_TEST(output_string.compare( + CHECK(output_string.compare( "dim {\n" "size: 1\n" "}\n" @@ -115,7 +115,7 @@ BOOST_AUTO_TEST_CASE(ConvertTensorShapeToStringTest) )); output_string = createAndConvert({0xffffffff, 0xffffffff}); - BOOST_TEST(output_string.compare( + CHECK(output_string.compare( "dim {\n" "size: 4294967295\n" "}\n" @@ -125,7 +125,7 @@ BOOST_AUTO_TEST_CASE(ConvertTensorShapeToStringTest) )); output_string = createAndConvert({1, 0}); - BOOST_TEST(output_string.compare( + CHECK(output_string.compare( "dim {\n" "size: 1\n" "}\n" @@ -135,4 +135,4 @@ BOOST_AUTO_TEST_CASE(ConvertTensorShapeToStringTest) )); } -BOOST_AUTO_TEST_SUITE_END() +} diff --git a/src/armnnUtils/test/QuantizeHelperTest.cpp b/src/armnnUtils/test/QuantizeHelperTest.cpp index 410fdfa715..6df6d808cb 100644 --- a/src/armnnUtils/test/QuantizeHelperTest.cpp +++ b/src/armnnUtils/test/QuantizeHelperTest.cpp @@ -6,12 +6,12 @@ #include <QuantizeHelper.hpp> #include <armnn/utility/IgnoreUnused.hpp> -#include <boost/test/unit_test.hpp> +#include <doctest/doctest.h> #include <vector> -BOOST_AUTO_TEST_SUITE(QuantizeHelper) - +TEST_SUITE("QuantizeHelper") +{ namespace { @@ -24,23 +24,23 @@ bool IsFloatIterFunc(T iter) } // anonymous namespace -BOOST_AUTO_TEST_CASE(IsFloatIterFuncTest) +TEST_CASE("IsFloatIterFuncTest") { std::vector<float> fArray; - BOOST_TEST(IsFloatIterFunc(fArray.begin()) == true); - BOOST_TEST(IsFloatIterFunc(fArray.cbegin()) == true); + CHECK(IsFloatIterFunc(fArray.begin()) == true); + CHECK(IsFloatIterFunc(fArray.cbegin()) == true); std::vector<double> dArray; - BOOST_TEST(IsFloatIterFunc(dArray.begin()) == true); + CHECK(IsFloatIterFunc(dArray.begin()) == true); std::vector<int> iArray; - BOOST_TEST(IsFloatIterFunc(iArray.begin()) == false); + CHECK(IsFloatIterFunc(iArray.begin()) == false); float floats[5]; - BOOST_TEST(IsFloatIterFunc(&floats[0]) == true); + CHECK(IsFloatIterFunc(&floats[0]) == true); int ints[5]; - BOOST_TEST(IsFloatIterFunc(&ints[0]) == false); + CHECK(IsFloatIterFunc(&ints[0]) == false); } -BOOST_AUTO_TEST_SUITE_END() +} diff --git a/src/armnnUtils/test/TensorUtilsTest.cpp b/src/armnnUtils/test/TensorUtilsTest.cpp index d24740b762..6d5f719eb1 100644 --- a/src/armnnUtils/test/TensorUtilsTest.cpp +++ b/src/armnnUtils/test/TensorUtilsTest.cpp @@ -7,131 +7,131 @@ #include <armnnUtils/TensorUtils.hpp> -#include <boost/test/unit_test.hpp> +#include <doctest/doctest.h> using namespace armnn; using namespace armnnUtils; -BOOST_AUTO_TEST_SUITE(TensorUtilsSuite) - -BOOST_AUTO_TEST_CASE(ExpandDimsAxis0Test) +TEST_SUITE("TensorUtilsSuite") +{ +TEST_CASE("ExpandDimsAxis0Test") { armnn::TensorShape inputShape({ 2, 3, 4 }); // Expand dimension 0 armnn::TensorShape outputShape = ExpandDims(inputShape, 0); - BOOST_TEST(outputShape.GetNumDimensions() == 4); - BOOST_TEST(outputShape[0] == 1); - BOOST_TEST(outputShape[1] == 2); - BOOST_TEST(outputShape[2] == 3); - BOOST_TEST(outputShape[3] == 4); + CHECK(outputShape.GetNumDimensions() == 4); + CHECK(outputShape[0] == 1); + CHECK(outputShape[1] == 2); + CHECK(outputShape[2] == 3); + CHECK(outputShape[3] == 4); } -BOOST_AUTO_TEST_CASE(ExpandDimsAxis1Test) +TEST_CASE("ExpandDimsAxis1Test") { armnn::TensorShape inputShape({ 2, 3, 4 }); // Expand dimension 1 armnn::TensorShape outputShape = ExpandDims(inputShape, 1); - BOOST_TEST(outputShape.GetNumDimensions() == 4); - BOOST_TEST(outputShape[0] == 2); - BOOST_TEST(outputShape[1] == 1); - BOOST_TEST(outputShape[2] == 3); - BOOST_TEST(outputShape[3] == 4); + CHECK(outputShape.GetNumDimensions() == 4); + CHECK(outputShape[0] == 2); + CHECK(outputShape[1] == 1); + CHECK(outputShape[2] == 3); + CHECK(outputShape[3] == 4); } -BOOST_AUTO_TEST_CASE(ExpandDimsAxis2Test) +TEST_CASE("ExpandDimsAxis2Test") { armnn::TensorShape inputShape({ 2, 3, 4 }); // Expand dimension 2 armnn::TensorShape outputShape = ExpandDims(inputShape, 2); - BOOST_TEST(outputShape.GetNumDimensions() == 4); - BOOST_TEST(outputShape[0] == 2); - BOOST_TEST(outputShape[1] == 3); - BOOST_TEST(outputShape[2] == 1); - BOOST_TEST(outputShape[3] == 4); + CHECK(outputShape.GetNumDimensions() == 4); + CHECK(outputShape[0] == 2); + CHECK(outputShape[1] == 3); + CHECK(outputShape[2] == 1); + CHECK(outputShape[3] == 4); } -BOOST_AUTO_TEST_CASE(ExpandDimsAxis3Test) +TEST_CASE("ExpandDimsAxis3Test") { armnn::TensorShape inputShape({ 2, 3, 4 }); // Expand dimension 3 armnn::TensorShape outputShape = ExpandDims(inputShape, 3); - BOOST_TEST(outputShape.GetNumDimensions() == 4); - BOOST_TEST(outputShape[0] == 2); - BOOST_TEST(outputShape[1] == 3); - BOOST_TEST(outputShape[2] == 4); - BOOST_TEST(outputShape[3] == 1); + CHECK(outputShape.GetNumDimensions() == 4); + CHECK(outputShape[0] == 2); + CHECK(outputShape[1] == 3); + CHECK(outputShape[2] == 4); + CHECK(outputShape[3] == 1); } -BOOST_AUTO_TEST_CASE(ExpandDimsNegativeAxis1Test) +TEST_CASE("ExpandDimsNegativeAxis1Test") { armnn::TensorShape inputShape({ 2, 3, 4 }); // Expand dimension -1 armnn::TensorShape outputShape = ExpandDims(inputShape, -1); - BOOST_TEST(outputShape.GetNumDimensions() == 4); - BOOST_TEST(outputShape[0] == 2); - BOOST_TEST(outputShape[1] == 3); - BOOST_TEST(outputShape[2] == 4); - BOOST_TEST(outputShape[3] == 1); + CHECK(outputShape.GetNumDimensions() == 4); + CHECK(outputShape[0] == 2); + CHECK(outputShape[1] == 3); + CHECK(outputShape[2] == 4); + CHECK(outputShape[3] == 1); } -BOOST_AUTO_TEST_CASE(ExpandDimsNegativeAxis2Test) +TEST_CASE("ExpandDimsNegativeAxis2Test") { armnn::TensorShape inputShape({ 2, 3, 4 }); // Expand dimension -2 armnn::TensorShape outputShape = ExpandDims(inputShape, -2); - BOOST_TEST(outputShape.GetNumDimensions() == 4); - BOOST_TEST(outputShape[0] == 2); - BOOST_TEST(outputShape[1] == 3); - BOOST_TEST(outputShape[2] == 1); - BOOST_TEST(outputShape[3] == 4); + CHECK(outputShape.GetNumDimensions() == 4); + CHECK(outputShape[0] == 2); + CHECK(outputShape[1] == 3); + CHECK(outputShape[2] == 1); + CHECK(outputShape[3] == 4); } -BOOST_AUTO_TEST_CASE(ExpandDimsNegativeAxis3Test) +TEST_CASE("ExpandDimsNegativeAxis3Test") { armnn::TensorShape inputShape({ 2, 3, 4 }); // Expand dimension -3 armnn::TensorShape outputShape = ExpandDims(inputShape, -3); - BOOST_TEST(outputShape.GetNumDimensions() == 4); - BOOST_TEST(outputShape[0] == 2); - BOOST_TEST(outputShape[1] == 1); - BOOST_TEST(outputShape[2] == 3); - BOOST_TEST(outputShape[3] == 4); + CHECK(outputShape.GetNumDimensions() == 4); + CHECK(outputShape[0] == 2); + CHECK(outputShape[1] == 1); + CHECK(outputShape[2] == 3); + CHECK(outputShape[3] == 4); } -BOOST_AUTO_TEST_CASE(ExpandDimsNegativeAxis4Test) +TEST_CASE("ExpandDimsNegativeAxis4Test") { armnn::TensorShape inputShape({ 2, 3, 4 }); // Expand dimension -4 armnn::TensorShape outputShape = ExpandDims(inputShape, -4); - BOOST_TEST(outputShape.GetNumDimensions() == 4); - BOOST_TEST(outputShape[0] == 1); - BOOST_TEST(outputShape[1] == 2); - BOOST_TEST(outputShape[2] == 3); - BOOST_TEST(outputShape[3] == 4); + CHECK(outputShape.GetNumDimensions() == 4); + CHECK(outputShape[0] == 1); + CHECK(outputShape[1] == 2); + CHECK(outputShape[2] == 3); + CHECK(outputShape[3] == 4); } -BOOST_AUTO_TEST_CASE(ExpandDimsInvalidAxisTest) +TEST_CASE("ExpandDimsInvalidAxisTest") { armnn::TensorShape inputShape({ 2, 3, 4 }); // Invalid expand dimension 4 - BOOST_CHECK_THROW(ExpandDims(inputShape, 4), armnn::InvalidArgumentException); + CHECK_THROWS_AS(ExpandDims(inputShape, 4), armnn::InvalidArgumentException); } -BOOST_AUTO_TEST_CASE(ExpandDimsInvalidNegativeAxisTest) +TEST_CASE("ExpandDimsInvalidNegativeAxisTest") { armnn::TensorShape inputShape({ 2, 3, 4 }); // Invalid expand dimension -5 - BOOST_CHECK_THROW(ExpandDims(inputShape, -5), armnn::InvalidArgumentException); + CHECK_THROWS_AS(ExpandDims(inputShape, -5), armnn::InvalidArgumentException); } -BOOST_AUTO_TEST_SUITE_END() +} diff --git a/src/armnnUtils/test/TransformIteratorTest.cpp b/src/armnnUtils/test/TransformIteratorTest.cpp index c44e454312..2151153913 100644 --- a/src/armnnUtils/test/TransformIteratorTest.cpp +++ b/src/armnnUtils/test/TransformIteratorTest.cpp @@ -5,13 +5,14 @@ #include <armnn/utility/TransformIterator.hpp> -#include <boost/test/unit_test.hpp> +#include <doctest/doctest.h> +#include <vector> #include <iostream> using namespace armnn; -BOOST_AUTO_TEST_SUITE(TransformIteratorSuite) - +TEST_SUITE("TransformIteratorSuite") +{ namespace { @@ -25,7 +26,7 @@ static std::string concat(const std::string val) return val + "a"; } -BOOST_AUTO_TEST_CASE(TransformIteratorTest) +TEST_CASE("TransformIteratorTest") { struct WrapperTestClass { @@ -63,14 +64,14 @@ BOOST_AUTO_TEST_CASE(TransformIteratorTest) for(auto val : wrapperStringClass) { - BOOST_CHECK(val != "e"); + CHECK(val != "e"); i++; } i = 1; for(auto val : wrapperTestClass) { - BOOST_CHECK(val == square(i)); + CHECK(val == square(i)); i++; } @@ -78,7 +79,7 @@ BOOST_AUTO_TEST_CASE(TransformIteratorTest) // Check original vector is unchanged for(auto val : wrapperTestClass.m_Vec) { - BOOST_CHECK(val == i); + CHECK(val == i); i++; } @@ -92,11 +93,11 @@ BOOST_AUTO_TEST_CASE(TransformIteratorTest) i = 1; for(auto val : transformedVec) { - BOOST_CHECK(val == square(i)); + CHECK(val == square(i)); i++; } } } -BOOST_AUTO_TEST_SUITE_END() +} |