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
diff --git a/tests/InferenceModel.hpp b/tests/InferenceModel.hpp
index 68ee8ae..8ac44f9 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 @@
             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 @@
             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 @@
     {
         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 @@
     {
         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 @@
                 {
                     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 362be7b..4a97d17 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 @@
         }
         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 1cf73ca..f76c958 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 @@
     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 @@
 
     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 @@
 {
     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> 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 @@
             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 @@
             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));
     }
 }