aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Sloyan <matthew.sloyan@arm.com>2021-06-20 18:45:05 +0100
committerTeresaARM <teresa.charlinreyes@arm.com>2021-06-21 11:25:27 +0000
commit7a00eaa6ecf121623823b1951c0e6c9093271adf (patch)
tree78503cef33c652e8567595ac3255b9041556e133
parent50f7b327e1871596355bbfed8aae5d4f7b2caae7 (diff)
downloadarmnn-7a00eaa6ecf121623823b1951c0e6c9093271adf.tar.gz
Remove remaining boost tests
* Updated unit tests to use doctest. Signed-off-by: Matthew Sloyan <matthew.sloyan@arm.com> Change-Id: I5231225cd0830f16cc0ef20e9ef27e7b92feab19
-rw-r--r--src/armnnDeserializer/test/DeserializeDepthwiseConv2d.cpp10
-rw-r--r--src/armnnDeserializer/test/DeserializeShape.cpp12
-rw-r--r--src/backends/reference/test/RefPerAxisIteratorTests.cpp86
-rw-r--r--src/backends/reference/test/RefPerChannelDecoderTests.cpp32
4 files changed, 67 insertions, 73 deletions
diff --git a/src/armnnDeserializer/test/DeserializeDepthwiseConv2d.cpp b/src/armnnDeserializer/test/DeserializeDepthwiseConv2d.cpp
index 83dede15c6..1920c1cc79 100644
--- a/src/armnnDeserializer/test/DeserializeDepthwiseConv2d.cpp
+++ b/src/armnnDeserializer/test/DeserializeDepthwiseConv2d.cpp
@@ -7,12 +7,12 @@
#include <armnnDeserializer/IDeserializer.hpp>
-#include <boost/test/unit_test.hpp>
+#include <doctest/doctest.h>
#include <string>
-BOOST_AUTO_TEST_SUITE(Deserializer)
-
+TEST_SUITE("Deserializer_DepthwiseConv2d")
+{
struct DepthwiseConv2dFlatbufferVersion1Fixture : public ParserFlatbuffersSerializeFixture
{
explicit DepthwiseConv2dFlatbufferVersion1Fixture()
@@ -218,7 +218,7 @@ struct DepthwiseConv2dFlatbufferVersion1Fixture : public ParserFlatbuffersSerial
// file. It ensures older models can still be read and executed
// featureVersion weights layout scheme 1 indicates a change in the depthwise weights layout within
// armm from [M,I,H,W] --> [1,H,W,I*M]
-BOOST_FIXTURE_TEST_CASE(DepthwiseConv2d_FlatbufferVersion1, DepthwiseConv2dFlatbufferVersion1Fixture)
+TEST_CASE_FIXTURE(DepthwiseConv2dFlatbufferVersion1Fixture, "DepthwiseConv2d_FlatbufferVersion1")
{
RunTest<4, armnn::DataType::QAsymmS8>(
0,
@@ -230,4 +230,4 @@ BOOST_FIXTURE_TEST_CASE(DepthwiseConv2d_FlatbufferVersion1, DepthwiseConv2dFlatb
25,36,12,37,42,25,29,14, 9});
}
-BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file
+} \ No newline at end of file
diff --git a/src/armnnDeserializer/test/DeserializeShape.cpp b/src/armnnDeserializer/test/DeserializeShape.cpp
index a20fb59699..5d5e04e7a4 100644
--- a/src/armnnDeserializer/test/DeserializeShape.cpp
+++ b/src/armnnDeserializer/test/DeserializeShape.cpp
@@ -3,14 +3,15 @@
// SPDX-License-Identifier: MIT
//
-#include <boost/test/unit_test.hpp>
#include "ParserFlatbuffersSerializeFixture.hpp"
#include <armnnDeserializer/IDeserializer.hpp>
-#include <string>
+#include <doctest/doctest.h>
-BOOST_AUTO_TEST_SUITE(Deserializer)
+#include <string>
+TEST_SUITE("Deserializer_Shape")
+{
struct ShapeFixture : public ParserFlatbuffersSerializeFixture
{
explicit ShapeFixture()
@@ -114,13 +115,12 @@ struct ShapeFixture : public ParserFlatbuffersSerializeFixture
}
};
-
struct SimpleShapeFixture : ShapeFixture
{
SimpleShapeFixture() : ShapeFixture() {}
};
-BOOST_FIXTURE_TEST_CASE(DeserializeShape, SimpleShapeFixture)
+TEST_CASE_FIXTURE(SimpleShapeFixture, "DeserializeShape")
{
RunTest<1, armnn::DataType::Signed32>(
0,
@@ -128,4 +128,4 @@ BOOST_FIXTURE_TEST_CASE(DeserializeShape, SimpleShapeFixture)
{{"OutputLayer",{ 1, 3, 3, 1 }}});
}
-BOOST_AUTO_TEST_SUITE_END()
+}
diff --git a/src/backends/reference/test/RefPerAxisIteratorTests.cpp b/src/backends/reference/test/RefPerAxisIteratorTests.cpp
index 7da4c0fb0f..06d2703b4e 100644
--- a/src/backends/reference/test/RefPerAxisIteratorTests.cpp
+++ b/src/backends/reference/test/RefPerAxisIteratorTests.cpp
@@ -4,37 +4,35 @@
//
#include <reference/workloads/Decoders.hpp>
-#include <armnn/utility/NumericCast.hpp>
#include <fmt/format.h>
-#include <boost/test/unit_test.hpp>
-#include <chrono>
+#include <doctest/doctest.h>
+#include <chrono>
template<typename T>
void CompareVector(std::vector<T> vec1, std::vector<T> vec2)
{
- BOOST_TEST(vec1.size() == vec2.size());
+ CHECK(vec1.size() == vec2.size());
bool mismatch = false;
for (uint i = 0; i < vec1.size(); ++i)
{
if (vec1[i] != vec2[i])
{
- /*std::stringstream ss;
- ss << "Vector value mismatch: index=" << i << " " << vec1[i] << "!=" << vec2[i];*/
- BOOST_TEST_MESSAGE(fmt::format("Vector value mismatch: index={} {} != {}",
- i,
- vec1[i],
- vec2[i]));
+ MESSAGE(fmt::format("Vector value mismatch: index={} {} != {}",
+ i,
+ vec1[i],
+ vec2[i]));
+
mismatch = true;
}
}
if (mismatch)
{
- BOOST_FAIL("Error in CompareVector. Vectors don't match.");
+ FAIL("Error in CompareVector. Vectors don't match.");
}
}
@@ -79,10 +77,10 @@ public:
unsigned int m_NumElements;
};
-BOOST_AUTO_TEST_SUITE(RefPerAxisIterator)
-
+TEST_SUITE("RefPerAxisIterator")
+{
// Test Loop (Equivalent to DecodeTensor) and Axis = 0
-BOOST_AUTO_TEST_CASE(PerAxisIteratorTest1)
+TEST_CASE("PerAxisIteratorTest1")
{
std::vector<int8_t> input = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
TensorInfo tensorInfo ({3,1,2,2},DataType::QSymmS8);
@@ -95,17 +93,17 @@ BOOST_AUTO_TEST_CASE(PerAxisIteratorTest1)
// Set iterator to index and check if the axis index is correct
iterator[5];
- BOOST_TEST(iterator.GetAxisIndex() == 1u);
+ CHECK(iterator.GetAxisIndex() == 1u);
iterator[1];
- BOOST_TEST(iterator.GetAxisIndex() == 0u);
+ CHECK(iterator.GetAxisIndex() == 0u);
iterator[10];
- BOOST_TEST(iterator.GetAxisIndex() == 2u);
+ CHECK(iterator.GetAxisIndex() == 2u);
}
// Test Axis = 1
-BOOST_AUTO_TEST_CASE(PerAxisIteratorTest2)
+TEST_CASE("PerAxisIteratorTest2")
{
std::vector<int8_t> input = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
TensorInfo tensorInfo ({3,1,2,2},DataType::QSymmS8);
@@ -118,17 +116,17 @@ BOOST_AUTO_TEST_CASE(PerAxisIteratorTest2)
// Set iterator to index and check if the axis index is correct
iterator[5];
- BOOST_TEST(iterator.GetAxisIndex() == 0u);
+ CHECK(iterator.GetAxisIndex() == 0u);
iterator[1];
- BOOST_TEST(iterator.GetAxisIndex() == 0u);
+ CHECK(iterator.GetAxisIndex() == 0u);
iterator[10];
- BOOST_TEST(iterator.GetAxisIndex() == 0u);
+ CHECK(iterator.GetAxisIndex() == 0u);
}
// Test Axis = 2
-BOOST_AUTO_TEST_CASE(PerAxisIteratorTest3)
+TEST_CASE("PerAxisIteratorTest3")
{
std::vector<int8_t> input = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
TensorInfo tensorInfo ({3,1,2,2},DataType::QSymmS8);
@@ -141,17 +139,17 @@ BOOST_AUTO_TEST_CASE(PerAxisIteratorTest3)
// Set iterator to index and check if the axis index is correct
iterator[5];
- BOOST_TEST(iterator.GetAxisIndex() == 0u);
+ CHECK(iterator.GetAxisIndex() == 0u);
iterator[1];
- BOOST_TEST(iterator.GetAxisIndex() == 0u);
+ CHECK(iterator.GetAxisIndex() == 0u);
iterator[10];
- BOOST_TEST(iterator.GetAxisIndex() == 1u);
+ CHECK(iterator.GetAxisIndex() == 1u);
}
// Test Axis = 3
-BOOST_AUTO_TEST_CASE(PerAxisIteratorTest4)
+TEST_CASE("PerAxisIteratorTest4")
{
std::vector<int8_t> input = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
TensorInfo tensorInfo ({3,1,2,2},DataType::QSymmS8);
@@ -164,18 +162,17 @@ BOOST_AUTO_TEST_CASE(PerAxisIteratorTest4)
// Set iterator to index and check if the axis index is correct
iterator[5];
- BOOST_TEST(iterator.GetAxisIndex() == 1u);
+ CHECK(iterator.GetAxisIndex() == 1u);
iterator[1];
- BOOST_TEST(iterator.GetAxisIndex() == 1u);
+ CHECK(iterator.GetAxisIndex() == 1u);
iterator[10];
- BOOST_TEST(iterator.GetAxisIndex() == 0u);
+ CHECK(iterator.GetAxisIndex() == 0u);
}
-
// Test Axis = 1. Different tensor shape
-BOOST_AUTO_TEST_CASE(PerAxisIteratorTest5)
+TEST_CASE("PerAxisIteratorTest5")
{
using namespace armnn;
std::vector<int8_t> input =
@@ -201,17 +198,17 @@ BOOST_AUTO_TEST_CASE(PerAxisIteratorTest5)
// Set iterator to index and check if the axis index is correct
iterator[5];
- BOOST_TEST(iterator.GetAxisIndex() == 1u);
+ CHECK(iterator.GetAxisIndex() == 1u);
iterator[1];
- BOOST_TEST(iterator.GetAxisIndex() == 0u);
+ CHECK(iterator.GetAxisIndex() == 0u);
iterator[10];
- BOOST_TEST(iterator.GetAxisIndex() == 0u);
+ CHECK(iterator.GetAxisIndex() == 0u);
}
// Test the increment and decrement operator
-BOOST_AUTO_TEST_CASE(PerAxisIteratorTest7)
+TEST_CASE("PerAxisIteratorTest7")
{
using namespace armnn;
std::vector<int8_t> input =
@@ -232,21 +229,20 @@ BOOST_AUTO_TEST_CASE(PerAxisIteratorTest7)
auto iterator = MockPerAxisIterator(input.data(), tensorInfo.GetShape(), 2);
iterator += 3;
- BOOST_TEST(iterator.Get(), expOutput[3]);
- BOOST_TEST(iterator.GetAxisIndex() == 1u);
+ CHECK(iterator.Get() == expOutput[3]);
+ CHECK(iterator.GetAxisIndex() == 1u);
iterator += 3;
- BOOST_TEST(iterator.Get(), expOutput[6]);
- BOOST_TEST(iterator.GetAxisIndex() == 1u);
+ CHECK(iterator.Get() == expOutput[6]);
+ CHECK(iterator.GetAxisIndex() == 1u);
iterator -= 2;
- BOOST_TEST(iterator.Get(), expOutput[4]);
- BOOST_TEST(iterator.GetAxisIndex() == 0u);
+ CHECK(iterator.Get() == expOutput[4]);
+ CHECK(iterator.GetAxisIndex() == 0u);
iterator -= 1;
- BOOST_TEST(iterator.Get(), expOutput[3]);
- BOOST_TEST(iterator.GetAxisIndex() == 1u);
+ CHECK(iterator.Get() == expOutput[3]);
+ CHECK(iterator.GetAxisIndex() == 1u);
}
-
-BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file
+} \ No newline at end of file
diff --git a/src/backends/reference/test/RefPerChannelDecoderTests.cpp b/src/backends/reference/test/RefPerChannelDecoderTests.cpp
index c2e3cee7a0..90d6afc216 100644
--- a/src/backends/reference/test/RefPerChannelDecoderTests.cpp
+++ b/src/backends/reference/test/RefPerChannelDecoderTests.cpp
@@ -4,42 +4,40 @@
//
#include <reference/workloads/Decoders.hpp>
-#include <armnn/utility/NumericCast.hpp>
#include <fmt/format.h>
-#include <boost/test/unit_test.hpp>
-
-BOOST_AUTO_TEST_SUITE(RefPerChannelDecoder)
+#include <doctest/doctest.h>
+TEST_SUITE("RefPerChannelDecoder")
+{
template<typename T>
void CompareVector(std::vector<T> vec1, std::vector<T> vec2)
{
- BOOST_TEST(vec1.size() == vec2.size());
+ CHECK(vec1.size() == vec2.size());
bool mismatch = false;
for (uint i = 0; i < vec1.size(); ++i)
{
if (vec1[i] != vec2[i])
{
- /*std::stringstream ss;
- ss << "Vector value mismatch: index=" << i << " " << vec1[i] << "!=" << vec2[i];*/
- BOOST_TEST_MESSAGE(fmt::format("Vector value mismatch: index={} {} != {}",
- i,
- vec1[i],
- vec2[i]));
+ MESSAGE(fmt::format("Vector value mismatch: index={} {} != {}",
+ i,
+ vec1[i],
+ vec2[i]));
+
mismatch = true;
}
}
if (mismatch)
{
- BOOST_FAIL("Error in CompareVector. Vectors don't match.");
+ FAIL("Error in CompareVector. Vectors don't match.");
}
}
// Ensure quantization works for none depthwise convolutions
-BOOST_AUTO_TEST_CASE(RefPerChannelDecoderTest1)
+TEST_CASE("RefPerChannelDecoderTest1")
{
using namespace armnn;
std::vector<int8_t> input =
@@ -62,7 +60,7 @@ BOOST_AUTO_TEST_CASE(RefPerChannelDecoderTest1)
}
// Ensure quantization works for depthwise convolutions M=1
-BOOST_AUTO_TEST_CASE(RefPerChannelDecoderTest2)
+TEST_CASE("RefPerChannelDecoderTest2")
{
using namespace armnn;
std::vector<int8_t> input =
@@ -88,7 +86,7 @@ BOOST_AUTO_TEST_CASE(RefPerChannelDecoderTest2)
}
// Ensure quantization works for depthwise convolutions M=2
-BOOST_AUTO_TEST_CASE(RefPerChannelDecoderTest3)
+TEST_CASE("RefPerChannelDecoderTest3")
{
using namespace armnn;
std::vector<int8_t> input =
@@ -121,7 +119,7 @@ BOOST_AUTO_TEST_CASE(RefPerChannelDecoderTest3)
}
// Ensure quantization works for depthwise convolutions M=2 for int32
-BOOST_AUTO_TEST_CASE(RefPerChannelDecoderTest4)
+TEST_CASE("RefPerChannelDecoderTest4")
{
using namespace armnn;
std::vector<int32_t> input =
@@ -153,4 +151,4 @@ BOOST_AUTO_TEST_CASE(RefPerChannelDecoderTest4)
CompareVector(output, expOutput);
}
-BOOST_AUTO_TEST_SUITE_END()
+}