aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJames Ward <james.ward@arm.com>2020-09-07 16:45:07 +0100
committerJames Ward <james.ward@arm.com>2020-09-10 10:17:58 +0000
commit08f4016b8ae8ee836fc813abcbc7db826924f3ec (patch)
tree93dae8a2edbc408f9a021668c15879cc96d805c9 /tests
parent1f3b49be73d1fadf06f20c912aa160a5ab53a6a8 (diff)
downloadarmnn-08f4016b8ae8ee836fc813abcbc7db826924f3ec.tar.gz
IVGCVSW-5293 Remove boost::format from armnn/tests
* Replaced boost::format with fmt::format Signed-off-by: James Ward <james.ward@arm.com> Change-Id: Icf5a6508e7be3d31bc063643491fc5e0607f21fa
Diffstat (limited to 'tests')
-rw-r--r--tests/InferenceModel.hpp23
-rw-r--r--tests/InferenceTest.inl6
-rw-r--r--tests/InferenceTestImage.cpp30
3 files changed, 28 insertions, 31 deletions
diff --git a/tests/InferenceModel.hpp b/tests/InferenceModel.hpp
index 68ee8ae81a..8ac44f98fb 100644
--- a/tests/InferenceModel.hpp
+++ b/tests/InferenceModel.hpp
@@ -28,9 +28,9 @@
#include "armnn/utility/StringUtils.hpp"
#include <boost/exception/exception.hpp>
#include <boost/exception/diagnostic_information.hpp>
-#include <boost/format.hpp>
#include <boost/program_options.hpp>
#include <boost/variant.hpp>
+#include <fmt/format.h>
#include <algorithm>
#include <iterator>
@@ -134,9 +134,9 @@ public:
const size_t numInputBindings = params.m_InputBindings.size();
if (numInputShapes < numInputBindings)
{
- throw armnn::Exception(boost::str(boost::format(
- "Not every input has its tensor shape specified: expected=%1%, got=%2%")
- % numInputBindings % numInputShapes));
+ throw armnn::Exception(fmt::format(
+ "Not every input has its tensor shape specified: expected={0}, got={1}",
+ numInputBindings, numInputShapes));
}
for (size_t i = 0; i < numInputShapes; i++)
@@ -194,10 +194,9 @@ public:
fs::path pathToFile(params.m_ModelPath);
if (!fs::exists(pathToFile, errorCode))
{
- throw armnn::FileNotFoundException(boost::str(
- boost::format("Cannot find the file (%1%) errorCode: %2% %3%") %
- params.m_ModelPath %
- errorCode %
+ throw armnn::FileNotFoundException(fmt::format("Cannot find the file ({0}) errorCode: {1} {2}",
+ params.m_ModelPath,
+ errorCode.message(),
CHECK_LOCATION().AsString()));
}
std::ifstream file(params.m_ModelPath, std::ios::binary);
@@ -454,7 +453,7 @@ public:
{
if (m_InputBindings.size() < inputIndex + 1)
{
- throw armnn::Exception(boost::str(boost::format("Input index out of range: %1%") % inputIndex));
+ throw armnn::Exception(fmt::format("Input index out of range: {}", inputIndex));
}
}
@@ -462,7 +461,7 @@ public:
{
if (m_OutputBindings.size() < outputIndex + 1)
{
- throw armnn::Exception(boost::str(boost::format("Output index out of range: %1%") % outputIndex));
+ throw armnn::Exception(fmt::format("Output index out of range: {}", outputIndex));
}
}
@@ -493,8 +492,8 @@ public:
{
unsigned int outputIndex = boost::numeric_cast<unsigned int>(i);
throw armnn::Exception(
- boost::str(boost::format("Not enough data for output #%1%: expected "
- "%2% elements, got %3%") % outputIndex % expectedOutputDataSize % actualOutputDataSize));
+ fmt::format("Not enough data for output #{0}: expected "
+ "{1} elements, got {2}", outputIndex, expectedOutputDataSize, actualOutputDataSize));
}
},
outputContainers[i]);
diff --git a/tests/InferenceTest.inl b/tests/InferenceTest.inl
index 362be7bdae..4a97d17018 100644
--- a/tests/InferenceTest.inl
+++ b/tests/InferenceTest.inl
@@ -6,8 +6,8 @@
#include <armnn/utility/Assert.hpp>
#include <boost/numeric/conversion/cast.hpp>
-#include <boost/format.hpp>
#include <boost/program_options.hpp>
+#include <fmt/format.h>
#include <fstream>
#include <iostream>
@@ -288,8 +288,8 @@ void ClassifierTestCaseProvider<TDatabase, InferenceModel>::ReadPredictions()
}
else
{
- throw armnn::Exception(boost::str(boost::format("Failed to open input validation file: %1%")
- % m_ValidationFileIn));
+ throw armnn::Exception(fmt::format("Failed to open input validation file: {}"
+ , m_ValidationFileIn));
}
}
}
diff --git a/tests/InferenceTestImage.cpp b/tests/InferenceTestImage.cpp
index 1cf73caf45..f76c958f4e 100644
--- a/tests/InferenceTestImage.cpp
+++ b/tests/InferenceTestImage.cpp
@@ -7,8 +7,8 @@
#include <armnn/utility/Assert.hpp>
#include <armnn/utility/IgnoreUnused.hpp>
-#include <boost/format.hpp>
#include <boost/numeric/conversion/cast.hpp>
+#include <fmt/format.h>
#include <array>
@@ -33,8 +33,7 @@ unsigned int GetImageChannelIndex(ImageChannelLayout channelLayout, ImageChannel
case ImageChannelLayout::Bgr:
return 2u - static_cast<unsigned int>(channel);
default:
- throw UnknownImageChannelLayout(boost::str(boost::format("Unknown layout %1%")
- % static_cast<int>(channelLayout)));
+ throw UnknownImageChannelLayout(fmt::format("Unknown layout {}", static_cast<int>(channelLayout)));
}
}
@@ -139,12 +138,12 @@ InferenceTestImage::InferenceTestImage(char const* filePath)
if (stbData == nullptr)
{
- throw InferenceTestImageLoadFailed(boost::str(boost::format("Could not load the image at %1%") % filePath));
+ throw InferenceTestImageLoadFailed(fmt::format("Could not load the image at {}", filePath));
}
if (width == 0 || height == 0)
{
- throw InferenceTestImageLoadFailed(boost::str(boost::format("Could not load empty image at %1%") % filePath));
+ throw InferenceTestImageLoadFailed(fmt::format("Could not load empty image at {}", filePath));
}
m_Width = boost::numeric_cast<unsigned int>(width);
@@ -160,8 +159,8 @@ std::tuple<uint8_t, uint8_t, uint8_t> InferenceTestImage::GetPixelAs3Channels(un
{
if (x >= m_Width || y >= m_Height)
{
- throw InferenceTestImageOutOfBoundsAccess(boost::str(boost::format("Attempted out of bounds image access. "
- "Requested (%1%, %2%). Maximum valid coordinates (%3%, %4%).") % x % y % (m_Width - 1) % (m_Height - 1)));
+ throw InferenceTestImageOutOfBoundsAccess(fmt::format("Attempted out of bounds image access. "
+ "Requested ({0}, {1}). Maximum valid coordinates ({2}, {3}).", x, y, (m_Width - 1), (m_Height - 1)));
}
const unsigned int pixelOffset = x * GetNumChannels() + y * GetWidth() * GetNumChannels();
@@ -218,8 +217,8 @@ std::vector<float> InferenceTestImage::Resize(unsigned int newWidth,
std::vector<float> out;
if (newWidth == 0 || newHeight == 0)
{
- throw InferenceTestImageResizeFailed(boost::str(boost::format("None of the dimensions passed to a resize "
- "operation can be zero. Requested width: %1%. Requested height: %2%.") % newWidth % newHeight));
+ throw InferenceTestImageResizeFailed(fmt::format("None of the dimensions passed to a resize "
+ "operation can be zero. Requested width: {0}. Requested height: {1}.", newWidth, newHeight));
}
switch (meth) {
@@ -234,9 +233,9 @@ std::vector<float> InferenceTestImage::Resize(unsigned int newWidth,
break;
}
default:
- throw InferenceTestImageResizeFailed(boost::str(
- boost::format("Unknown resizing method asked ArmNN only supports {STB, BilinearAndNormalized} %1%")
- % location.AsString()));
+ throw InferenceTestImageResizeFailed(fmt::format("Unknown resizing method asked ArmNN only"
+ " supports {STB, BilinearAndNormalized} {}",
+ location.AsString()));
}
return out;
}
@@ -266,14 +265,13 @@ void InferenceTestImage::Write(WriteFormat format, const char* filePath) const
break;
}
default:
- throw InferenceTestImageWriteFailed(boost::str(boost::format("Unknown format %1%")
- % static_cast<int>(format)));
+ throw InferenceTestImageWriteFailed(fmt::format("Unknown format {}", static_cast<int>(format)));
}
if (res == 0)
{
- throw InferenceTestImageWriteFailed(boost::str(boost::format("An error occurred when writing to file %1%")
- % filePath));
+ throw InferenceTestImageWriteFailed(fmt::format("An error occurred when writing to file {}",
+ filePath));
}
}