aboutsummaryrefslogtreecommitdiff
path: root/test/UtilsTests.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/UtilsTests.cpp')
-rw-r--r--test/UtilsTests.cpp73
1 files changed, 34 insertions, 39 deletions
diff --git a/test/UtilsTests.cpp b/test/UtilsTests.cpp
index de84bb49..68d7b501 100644
--- a/test/UtilsTests.cpp
+++ b/test/UtilsTests.cpp
@@ -1,23 +1,18 @@
//
-// Copyright © 2017 Arm Ltd. All rights reserved.
+// Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#include "DriverTestHelpers.hpp"
-#include <boost/test/unit_test.hpp>
#include <log/log.h>
-#include "../Utils.hpp"
#include <armnn/src/armnn/OptimizedNetworkImpl.hpp>
#include <fstream>
-#include <iomanip>
#include <memory>
#include <armnn/INetwork.hpp>
-#include "armnn/NetworkFwd.hpp"
-
-#include <Filesystem.hpp>
+#include <armnnUtils/Filesystem.hpp>
using namespace android;
using namespace android::nn;
@@ -50,7 +45,7 @@ public:
return stream.good() ? ::armnn::Status::Success : ::armnn::Status::Failure;
}
- ::armnn::profiling::ProfilingGuid GetGuid() const final { return ::armnn::profiling::ProfilingGuid(0); }
+ ::arm::pipe::ProfilingGuid GetGuid() const final { return ::arm::pipe::ProfilingGuid(0); }
void UpdateMockSerializedContent(const std::string& mockSerializedContent)
{
@@ -64,7 +59,6 @@ private:
} // armnn namespace
-BOOST_AUTO_TEST_SUITE(UtilsTests)
// The following are helpers for writing unit tests for the driver.
namespace
@@ -78,10 +72,9 @@ public:
ExportNetworkGraphFixture()
: ExportNetworkGraphFixture("/data")
{}
+
ExportNetworkGraphFixture(const std::string& requestInputsAndOutputsDumpDir)
- : m_RequestInputsAndOutputsDumpDir(requestInputsAndOutputsDumpDir)
- , m_FileName()
- , m_FileStream()
+ : m_RequestInputsAndOutputsDumpDir(requestInputsAndOutputsDumpDir), m_FileName(), m_FileStream()
{
// Set the name of the output .dot file.
// NOTE: the export now uses a time stamp to name the file so we
@@ -97,7 +90,7 @@ public:
m_FileStream.close();
// Ignore any error (such as file not found).
- (void)remove(m_FileName.c_str());
+ (void) remove(m_FileName.c_str());
}
bool FileExists()
@@ -147,10 +140,12 @@ private:
};
-
} // namespace
-BOOST_AUTO_TEST_CASE(ExportToEmptyDirectory)
+DOCTEST_TEST_SUITE("UtilsTests")
+{
+
+DOCTEST_TEST_CASE("ExportToEmptyDirectory")
{
// Set the fixture for this test.
ExportNetworkGraphFixture fixture("");
@@ -167,13 +162,13 @@ BOOST_AUTO_TEST_CASE(ExportToEmptyDirectory)
// Export the mock optimized network.
fixture.m_FileName = armnn_driver::ExportNetworkGraphToDotFile(mockOptimizedNetwork,
- fixture.m_RequestInputsAndOutputsDumpDir);
+ fixture.m_RequestInputsAndOutputsDumpDir);
// Check that the output file does not exist.
- BOOST_TEST(!fixture.FileExists());
+ DOCTEST_CHECK(!fixture.FileExists());
}
-BOOST_AUTO_TEST_CASE(ExportNetwork)
+DOCTEST_TEST_CASE("ExportNetwork")
{
// Set the fixture for this test.
ExportNetworkGraphFixture fixture;
@@ -191,16 +186,16 @@ BOOST_AUTO_TEST_CASE(ExportNetwork)
// Export the mock optimized network.
fixture.m_FileName = armnn_driver::ExportNetworkGraphToDotFile(mockOptimizedNetwork,
- fixture.m_RequestInputsAndOutputsDumpDir);
+ fixture.m_RequestInputsAndOutputsDumpDir);
// Check that the output file exists and that it has the correct name.
- BOOST_TEST(fixture.FileExists());
+ DOCTEST_CHECK(fixture.FileExists());
// Check that the content of the output file matches the mock content.
- BOOST_TEST(fixture.GetFileContent() == mockSerializedContent);
+ DOCTEST_CHECK(fixture.GetFileContent() == mockSerializedContent);
}
-BOOST_AUTO_TEST_CASE(ExportNetworkOverwriteFile)
+DOCTEST_TEST_CASE("ExportNetworkOverwriteFile")
{
// Set the fixture for this test.
ExportNetworkGraphFixture fixture;
@@ -217,13 +212,13 @@ BOOST_AUTO_TEST_CASE(ExportNetworkOverwriteFile)
// Export the mock optimized network.
fixture.m_FileName = armnn_driver::ExportNetworkGraphToDotFile(mockOptimizedNetwork,
- fixture.m_RequestInputsAndOutputsDumpDir);
+ fixture.m_RequestInputsAndOutputsDumpDir);
// Check that the output file exists and that it has the correct name.
- BOOST_TEST(fixture.FileExists());
+ DOCTEST_CHECK(fixture.FileExists());
// Check that the content of the output file matches the mock content.
- BOOST_TEST(fixture.GetFileContent() == mockSerializedContent);
+ DOCTEST_CHECK(fixture.GetFileContent() == mockSerializedContent);
// Update the mock serialized content of the network.
mockSerializedContent = "This is ANOTHER mock serialized content!";
@@ -235,16 +230,16 @@ BOOST_AUTO_TEST_CASE(ExportNetworkOverwriteFile)
// Export the mock optimized network.
fixture.m_FileName = armnn_driver::ExportNetworkGraphToDotFile(mockOptimizedNetwork2,
- fixture.m_RequestInputsAndOutputsDumpDir);
+ fixture.m_RequestInputsAndOutputsDumpDir);
// Check that the output file still exists and that it has the correct name.
- BOOST_TEST(fixture.FileExists());
+ DOCTEST_CHECK(fixture.FileExists());
// Check that the content of the output file matches the mock content.
- BOOST_TEST(fixture.GetFileContent() == mockSerializedContent);
+ DOCTEST_CHECK(fixture.GetFileContent() == mockSerializedContent);
}
-BOOST_AUTO_TEST_CASE(ExportMultipleNetworks)
+DOCTEST_TEST_CASE("ExportMultipleNetworks")
{
// Set the fixtures for this test.
ExportNetworkGraphFixture fixture1;
@@ -263,32 +258,32 @@ BOOST_AUTO_TEST_CASE(ExportMultipleNetworks)
// Export the mock optimized network.
fixture1.m_FileName = armnn_driver::ExportNetworkGraphToDotFile(mockOptimizedNetwork,
- fixture1.m_RequestInputsAndOutputsDumpDir);
+ fixture1.m_RequestInputsAndOutputsDumpDir);
// Check that the output file exists and that it has the correct name.
- BOOST_TEST(fixture1.FileExists());
+ DOCTEST_CHECK(fixture1.FileExists());
// Check that the content of the output file matches the mock content.
- BOOST_TEST(fixture1.GetFileContent() == mockSerializedContent);
+ DOCTEST_CHECK(fixture1.GetFileContent() == mockSerializedContent);
// Export the mock optimized network.
fixture2.m_FileName = armnn_driver::ExportNetworkGraphToDotFile(mockOptimizedNetwork,
- fixture2.m_RequestInputsAndOutputsDumpDir);
+ fixture2.m_RequestInputsAndOutputsDumpDir);
// Check that the output file exists and that it has the correct name.
- BOOST_TEST(fixture2.FileExists());
+ DOCTEST_CHECK(fixture2.FileExists());
// Check that the content of the output file matches the mock content.
- BOOST_TEST(fixture2.GetFileContent() == mockSerializedContent);
+ DOCTEST_CHECK(fixture2.GetFileContent() == mockSerializedContent);
// Export the mock optimized network.
fixture3.m_FileName = armnn_driver::ExportNetworkGraphToDotFile(mockOptimizedNetwork,
- fixture3.m_RequestInputsAndOutputsDumpDir);
+ fixture3.m_RequestInputsAndOutputsDumpDir);
// Check that the output file exists and that it has the correct name.
- BOOST_TEST(fixture3.FileExists());
+ DOCTEST_CHECK(fixture3.FileExists());
// Check that the content of the output file matches the mock content.
- BOOST_TEST(fixture3.GetFileContent() == mockSerializedContent);
+ DOCTEST_CHECK(fixture3.GetFileContent() == mockSerializedContent);
}
-BOOST_AUTO_TEST_SUITE_END()
+}