TemplateCharReplace: More tests

Fix case insensitive replace

Tested: Tests pass

Change-Id: I0c650e4761d3c6e464a90ecfe1e2c8b314c2ff57
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/src/Utils.cpp b/src/Utils.cpp
index 010a55a..4888760 100644
--- a/src/Utils.cpp
+++ b/src/Utils.cpp
@@ -192,8 +192,8 @@
             {
                 std::string val = std::visit(VariantToStringVisitor(),
                                              foundDevicePair.second);
-                boost::replace_all(*strPtr,
-                                   templateChar + foundDevicePair.first, val);
+                boost::ireplace_all(*strPtr,
+                                    templateChar + foundDevicePair.first, val);
                 continue;
             }
 
diff --git a/test/test_entity-manager.cpp b/test/test_entity-manager.cpp
index 7dc1c72..2cf839b 100644
--- a/test/test_entity-manager.cpp
+++ b/test/test_entity-manager.cpp
@@ -175,4 +175,38 @@
 
     nlohmann::json expected = "4 / 2 equals 2 bar";
     EXPECT_EQ(expected, j["foo"]);
-}
\ No newline at end of file
+}
+
+TEST(TemplateCharReplace, hexAndWrongCase)
+{
+    nlohmann::json j = {{"Address", "0x54"},
+                        {"Bus", 15},
+                        {"Name", "$bus sensor 0"},
+                        {"Type", "SomeType"}};
+
+    boost::container::flat_map<std::string, BasicVariantType> data;
+    data["BUS"] = 15;
+
+    for (auto it = j.begin(); it != j.end(); it++)
+    {
+        templateCharReplace(it, data, 0);
+    }
+    nlohmann::json expected = {{"Address", 84},
+                               {"Bus", 15},
+                               {"Name", "15 sensor 0"},
+                               {"Type", "SomeType"}};
+    EXPECT_EQ(expected, j);
+}
+
+TEST(TemplateCharReplace, replaceSecondAsInt)
+{
+    nlohmann::json j = {{"foo", "twelve is $TEST"}};
+    auto it = j.begin();
+    boost::container::flat_map<std::string, BasicVariantType> data;
+    data["test"] = 12;
+
+    templateCharReplace(it, data, 0);
+
+    nlohmann::json expected = "twelve is 12";
+    EXPECT_EQ(expected, j["foo"]);
+}