entity-manager: probe: add probe logic tests
Add unit tests for matchProbe with json arrays.
Change-Id: Ic6cc068cc4f635a2b33d4b62dc624273560c10b9
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/test/test_entity-manager.cpp b/test/test_entity-manager.cpp
index e7b83ae..939136b 100644
--- a/test/test_entity-manager.cpp
+++ b/test/test_entity-manager.cpp
@@ -688,3 +688,45 @@
BasicVariantType v;
EXPECT_THROW(matchProbe(j, v), std::invalid_argument);
}
+
+TEST(MatchProbe, arrayNeqString)
+{
+ nlohmann::json j = R"([1, 2])"_json;
+ BasicVariantType v = "hello"s;
+ EXPECT_FALSE(matchProbe(j, v));
+}
+
+TEST(MatchProbe, arrayNeqFalse)
+{
+ nlohmann::json j = R"([1, 2])"_json;
+ BasicVariantType v = false;
+ EXPECT_FALSE(matchProbe(j, v));
+}
+
+TEST(MatchProbe, arrayNeqTrue)
+{
+ nlohmann::json j = R"([1, 2])"_json;
+ BasicVariantType v = true;
+ EXPECT_FALSE(matchProbe(j, v));
+}
+
+TEST(MatchProbe, arrayNeqUint8)
+{
+ nlohmann::json j = R"([1, 2])"_json;
+ BasicVariantType v = uint8_t(1);
+ EXPECT_FALSE(matchProbe(j, v));
+}
+
+TEST(MatchProbe, arrayNeqInt32)
+{
+ nlohmann::json j = R"([1, 2])"_json;
+ BasicVariantType v = int32_t(-1);
+ EXPECT_FALSE(matchProbe(j, v));
+}
+
+TEST(MatchProbe, arrayNeqDouble)
+{
+ nlohmann::json j = R"([1, 2])"_json;
+ BasicVariantType v = double(1.1);
+ EXPECT_FALSE(matchProbe(j, v));
+}