Christopher Meis | 59ef1e7 | 2025-04-16 08:53:25 +0200 | [diff] [blame] | 1 | #include "entity_manager/utils.hpp" |
Brad Bishop | e45d8c7 | 2022-05-25 15:12:53 -0400 | [diff] [blame] | 2 | #include "utils.hpp" |
James Feist | 481c5d5 | 2019-08-13 14:40:40 -0700 | [diff] [blame] | 3 | |
James Feist | 481c5d5 | 2019-08-13 14:40:40 -0700 | [diff] [blame] | 4 | #include <nlohmann/json.hpp> |
James Feist | 8c505da | 2020-05-28 10:06:33 -0700 | [diff] [blame] | 5 | |
Brad Bishop | 9d2ef08 | 2020-08-26 15:17:55 -0400 | [diff] [blame] | 6 | #include <string> |
James Feist | 481c5d5 | 2019-08-13 14:40:40 -0700 | [diff] [blame] | 7 | #include <variant> |
| 8 | |
| 9 | #include "gtest/gtest.h" |
| 10 | |
Brad Bishop | 9d2ef08 | 2020-08-26 15:17:55 -0400 | [diff] [blame] | 11 | using namespace std::string_literals; |
| 12 | |
James Feist | 481c5d5 | 2019-08-13 14:40:40 -0700 | [diff] [blame] | 13 | TEST(TemplateCharReplace, replaceOneInt) |
| 14 | { |
| 15 | nlohmann::json j = {{"foo", "$bus"}}; |
| 16 | auto it = j.begin(); |
Andrew Jeffery | 1983d2f | 2022-04-05 14:55:13 +0930 | [diff] [blame] | 17 | DBusInterface data; |
James Feist | 481c5d5 | 2019-08-13 14:40:40 -0700 | [diff] [blame] | 18 | data["BUS"] = 23; |
| 19 | |
Christopher Meis | 59ef1e7 | 2025-04-16 08:53:25 +0200 | [diff] [blame] | 20 | em_utils::templateCharReplace(it, data, 0); |
James Feist | 481c5d5 | 2019-08-13 14:40:40 -0700 | [diff] [blame] | 21 | |
| 22 | nlohmann::json expected = 23; |
| 23 | EXPECT_EQ(expected, j["foo"]); |
| 24 | } |
| 25 | |
| 26 | TEST(TemplateCharReplace, replaceOneStr) |
| 27 | { |
| 28 | nlohmann::json j = {{"foo", "$TEST"}}; |
| 29 | auto it = j.begin(); |
Andrew Jeffery | 1983d2f | 2022-04-05 14:55:13 +0930 | [diff] [blame] | 30 | DBusInterface data; |
James Feist | 481c5d5 | 2019-08-13 14:40:40 -0700 | [diff] [blame] | 31 | data["TEST"] = std::string("Test"); |
| 32 | |
Christopher Meis | 59ef1e7 | 2025-04-16 08:53:25 +0200 | [diff] [blame] | 33 | em_utils::templateCharReplace(it, data, 0); |
James Feist | 481c5d5 | 2019-08-13 14:40:40 -0700 | [diff] [blame] | 34 | |
| 35 | nlohmann::json expected = "Test"; |
| 36 | EXPECT_EQ(expected, j["foo"]); |
| 37 | } |
| 38 | |
| 39 | TEST(TemplateCharReplace, replaceSecondStr) |
| 40 | { |
| 41 | nlohmann::json j = {{"foo", "the $TEST"}}; |
| 42 | auto it = j.begin(); |
Andrew Jeffery | 1983d2f | 2022-04-05 14:55:13 +0930 | [diff] [blame] | 43 | DBusInterface data; |
James Feist | 481c5d5 | 2019-08-13 14:40:40 -0700 | [diff] [blame] | 44 | data["TEST"] = std::string("Test"); |
| 45 | |
Christopher Meis | 59ef1e7 | 2025-04-16 08:53:25 +0200 | [diff] [blame] | 46 | em_utils::templateCharReplace(it, data, 0); |
James Feist | 481c5d5 | 2019-08-13 14:40:40 -0700 | [diff] [blame] | 47 | |
| 48 | nlohmann::json expected = "the Test"; |
| 49 | EXPECT_EQ(expected, j["foo"]); |
| 50 | } |
| 51 | |
James Feist | 481c5d5 | 2019-08-13 14:40:40 -0700 | [diff] [blame] | 52 | TEST(TemplateCharReplace, replaceMiddleStr) |
| 53 | { |
| 54 | nlohmann::json j = {{"foo", "the $TEST worked"}}; |
| 55 | auto it = j.begin(); |
Andrew Jeffery | 1983d2f | 2022-04-05 14:55:13 +0930 | [diff] [blame] | 56 | DBusInterface data; |
James Feist | 481c5d5 | 2019-08-13 14:40:40 -0700 | [diff] [blame] | 57 | data["TEST"] = std::string("Test"); |
| 58 | |
Christopher Meis | 59ef1e7 | 2025-04-16 08:53:25 +0200 | [diff] [blame] | 59 | em_utils::templateCharReplace(it, data, 0); |
James Feist | 481c5d5 | 2019-08-13 14:40:40 -0700 | [diff] [blame] | 60 | |
| 61 | nlohmann::json expected = "the Test worked"; |
| 62 | EXPECT_EQ(expected, j["foo"]); |
| 63 | } |
James Feist | 481c5d5 | 2019-08-13 14:40:40 -0700 | [diff] [blame] | 64 | |
| 65 | TEST(TemplateCharReplace, replaceLastStr) |
| 66 | { |
| 67 | nlohmann::json j = {{"foo", "the Test $TEST"}}; |
| 68 | auto it = j.begin(); |
Andrew Jeffery | 1983d2f | 2022-04-05 14:55:13 +0930 | [diff] [blame] | 69 | DBusInterface data; |
James Feist | 481c5d5 | 2019-08-13 14:40:40 -0700 | [diff] [blame] | 70 | data["TEST"] = 23; |
| 71 | |
Christopher Meis | 59ef1e7 | 2025-04-16 08:53:25 +0200 | [diff] [blame] | 72 | em_utils::templateCharReplace(it, data, 0); |
James Feist | 481c5d5 | 2019-08-13 14:40:40 -0700 | [diff] [blame] | 73 | |
| 74 | nlohmann::json expected = "the Test 23"; |
| 75 | EXPECT_EQ(expected, j["foo"]); |
| 76 | } |
| 77 | |
| 78 | TEST(TemplateCharReplace, increment) |
| 79 | { |
| 80 | nlohmann::json j = {{"foo", "3 plus 1 equals $TEST + 1"}}; |
| 81 | auto it = j.begin(); |
Andrew Jeffery | 1983d2f | 2022-04-05 14:55:13 +0930 | [diff] [blame] | 82 | DBusInterface data; |
James Feist | 481c5d5 | 2019-08-13 14:40:40 -0700 | [diff] [blame] | 83 | data["TEST"] = 3; |
| 84 | |
Christopher Meis | 59ef1e7 | 2025-04-16 08:53:25 +0200 | [diff] [blame] | 85 | em_utils::templateCharReplace(it, data, 0); |
James Feist | 481c5d5 | 2019-08-13 14:40:40 -0700 | [diff] [blame] | 86 | |
| 87 | nlohmann::json expected = "3 plus 1 equals 4"; |
| 88 | EXPECT_EQ(expected, j["foo"]); |
| 89 | } |
| 90 | |
| 91 | TEST(TemplateCharReplace, decrement) |
| 92 | { |
| 93 | nlohmann::json j = {{"foo", "3 minus 1 equals $TEST - 1 !"}}; |
| 94 | auto it = j.begin(); |
Andrew Jeffery | 1983d2f | 2022-04-05 14:55:13 +0930 | [diff] [blame] | 95 | DBusInterface data; |
James Feist | 481c5d5 | 2019-08-13 14:40:40 -0700 | [diff] [blame] | 96 | data["TEST"] = 3; |
| 97 | |
Christopher Meis | 59ef1e7 | 2025-04-16 08:53:25 +0200 | [diff] [blame] | 98 | em_utils::templateCharReplace(it, data, 0); |
James Feist | 481c5d5 | 2019-08-13 14:40:40 -0700 | [diff] [blame] | 99 | |
| 100 | nlohmann::json expected = "3 minus 1 equals 2 !"; |
| 101 | EXPECT_EQ(expected, j["foo"]); |
| 102 | } |
| 103 | |
| 104 | TEST(TemplateCharReplace, modulus) |
| 105 | { |
| 106 | nlohmann::json j = {{"foo", "3 mod 2 equals $TEST % 2"}}; |
| 107 | auto it = j.begin(); |
Andrew Jeffery | 1983d2f | 2022-04-05 14:55:13 +0930 | [diff] [blame] | 108 | DBusInterface data; |
James Feist | 481c5d5 | 2019-08-13 14:40:40 -0700 | [diff] [blame] | 109 | data["TEST"] = 3; |
| 110 | |
Christopher Meis | 59ef1e7 | 2025-04-16 08:53:25 +0200 | [diff] [blame] | 111 | em_utils::templateCharReplace(it, data, 0); |
James Feist | 481c5d5 | 2019-08-13 14:40:40 -0700 | [diff] [blame] | 112 | |
| 113 | nlohmann::json expected = "3 mod 2 equals 1"; |
| 114 | EXPECT_EQ(expected, j["foo"]); |
| 115 | } |
| 116 | |
| 117 | TEST(TemplateCharReplace, multiply) |
| 118 | { |
| 119 | nlohmann::json j = {{"foo", "3 * 2 equals $TEST * 2"}}; |
| 120 | auto it = j.begin(); |
Andrew Jeffery | 1983d2f | 2022-04-05 14:55:13 +0930 | [diff] [blame] | 121 | DBusInterface data; |
James Feist | 481c5d5 | 2019-08-13 14:40:40 -0700 | [diff] [blame] | 122 | data["TEST"] = 3; |
| 123 | |
Christopher Meis | 59ef1e7 | 2025-04-16 08:53:25 +0200 | [diff] [blame] | 124 | em_utils::templateCharReplace(it, data, 0); |
James Feist | 481c5d5 | 2019-08-13 14:40:40 -0700 | [diff] [blame] | 125 | |
| 126 | nlohmann::json expected = "3 * 2 equals 6"; |
| 127 | EXPECT_EQ(expected, j["foo"]); |
| 128 | } |
| 129 | |
| 130 | TEST(TemplateCharReplace, divide) |
| 131 | { |
| 132 | nlohmann::json j = {{"foo", "4 / 2 equals $TEST / 2"}}; |
| 133 | auto it = j.begin(); |
Andrew Jeffery | 1983d2f | 2022-04-05 14:55:13 +0930 | [diff] [blame] | 134 | DBusInterface data; |
James Feist | 481c5d5 | 2019-08-13 14:40:40 -0700 | [diff] [blame] | 135 | data["TEST"] = 4; |
| 136 | |
Christopher Meis | 59ef1e7 | 2025-04-16 08:53:25 +0200 | [diff] [blame] | 137 | em_utils::templateCharReplace(it, data, 0); |
James Feist | 481c5d5 | 2019-08-13 14:40:40 -0700 | [diff] [blame] | 138 | |
| 139 | nlohmann::json expected = "4 / 2 equals 2"; |
| 140 | EXPECT_EQ(expected, j["foo"]); |
James Feist | 8c20feb | 2019-08-14 15:10:11 -0700 | [diff] [blame] | 141 | } |
| 142 | |
| 143 | TEST(TemplateCharReplace, multiMath) |
| 144 | { |
| 145 | nlohmann::json j = {{"foo", "4 * 2 % 6 equals $TEST * 2 % 6"}}; |
| 146 | auto it = j.begin(); |
Andrew Jeffery | 1983d2f | 2022-04-05 14:55:13 +0930 | [diff] [blame] | 147 | DBusInterface data; |
James Feist | 8c20feb | 2019-08-14 15:10:11 -0700 | [diff] [blame] | 148 | data["TEST"] = 4; |
| 149 | |
Christopher Meis | 59ef1e7 | 2025-04-16 08:53:25 +0200 | [diff] [blame] | 150 | em_utils::templateCharReplace(it, data, 0); |
James Feist | 8c20feb | 2019-08-14 15:10:11 -0700 | [diff] [blame] | 151 | |
| 152 | nlohmann::json expected = "4 * 2 % 6 equals 2"; |
| 153 | EXPECT_EQ(expected, j["foo"]); |
| 154 | } |
| 155 | |
| 156 | TEST(TemplateCharReplace, twoReplacements) |
| 157 | { |
| 158 | nlohmann::json j = {{"foo", "$FOO $BAR"}}; |
| 159 | auto it = j.begin(); |
Andrew Jeffery | 1983d2f | 2022-04-05 14:55:13 +0930 | [diff] [blame] | 160 | DBusInterface data; |
James Feist | 8c20feb | 2019-08-14 15:10:11 -0700 | [diff] [blame] | 161 | data["FOO"] = std::string("foo"); |
| 162 | data["BAR"] = std::string("bar"); |
| 163 | |
Christopher Meis | 59ef1e7 | 2025-04-16 08:53:25 +0200 | [diff] [blame] | 164 | em_utils::templateCharReplace(it, data, 0); |
James Feist | 8c20feb | 2019-08-14 15:10:11 -0700 | [diff] [blame] | 165 | |
| 166 | nlohmann::json expected = "foo bar"; |
| 167 | EXPECT_EQ(expected, j["foo"]); |
| 168 | } |
| 169 | |
| 170 | TEST(TemplateCharReplace, twoReplacementsWithMath) |
| 171 | { |
| 172 | nlohmann::json j = {{"foo", "4 / 2 equals $TEST / 2 $BAR"}}; |
| 173 | auto it = j.begin(); |
Andrew Jeffery | 1983d2f | 2022-04-05 14:55:13 +0930 | [diff] [blame] | 174 | DBusInterface data; |
James Feist | 8c20feb | 2019-08-14 15:10:11 -0700 | [diff] [blame] | 175 | data["TEST"] = 4; |
| 176 | data["BAR"] = std::string("bar"); |
| 177 | |
Christopher Meis | 59ef1e7 | 2025-04-16 08:53:25 +0200 | [diff] [blame] | 178 | em_utils::templateCharReplace(it, data, 0); |
James Feist | 8c20feb | 2019-08-14 15:10:11 -0700 | [diff] [blame] | 179 | |
| 180 | nlohmann::json expected = "4 / 2 equals 2 bar"; |
Zhikui Ren | a0d1b3f | 2021-10-05 16:21:56 -0700 | [diff] [blame] | 181 | } |
| 182 | |
| 183 | TEST(TemplateCharReplace, twoReplacementsWithMath2) |
| 184 | { |
| 185 | nlohmann::json j = {{"foo", "4 / 2 equals $ADDRESS / 2 $BAR"}}; |
| 186 | auto it = j.begin(); |
Andrew Jeffery | 1983d2f | 2022-04-05 14:55:13 +0930 | [diff] [blame] | 187 | DBusInterface data; |
Zhikui Ren | a0d1b3f | 2021-10-05 16:21:56 -0700 | [diff] [blame] | 188 | data["ADDRESS"] = 4; |
| 189 | data["BAR"] = std::string("bar"); |
| 190 | |
Christopher Meis | 59ef1e7 | 2025-04-16 08:53:25 +0200 | [diff] [blame] | 191 | em_utils::templateCharReplace(it, data, 0); |
Zhikui Ren | a0d1b3f | 2021-10-05 16:21:56 -0700 | [diff] [blame] | 192 | |
| 193 | nlohmann::json expected = "4 / 2 equals 2 bar"; |
James Feist | 8c20feb | 2019-08-14 15:10:11 -0700 | [diff] [blame] | 194 | EXPECT_EQ(expected, j["foo"]); |
James Feist | b0097d4 | 2019-08-15 09:24:13 -0700 | [diff] [blame] | 195 | } |
| 196 | |
| 197 | TEST(TemplateCharReplace, hexAndWrongCase) |
| 198 | { |
| 199 | nlohmann::json j = {{"Address", "0x54"}, |
| 200 | {"Bus", 15}, |
| 201 | {"Name", "$bus sensor 0"}, |
| 202 | {"Type", "SomeType"}}; |
| 203 | |
Andrew Jeffery | 1983d2f | 2022-04-05 14:55:13 +0930 | [diff] [blame] | 204 | DBusInterface data; |
James Feist | b0097d4 | 2019-08-15 09:24:13 -0700 | [diff] [blame] | 205 | data["BUS"] = 15; |
| 206 | |
| 207 | for (auto it = j.begin(); it != j.end(); it++) |
| 208 | { |
Christopher Meis | 59ef1e7 | 2025-04-16 08:53:25 +0200 | [diff] [blame] | 209 | em_utils::templateCharReplace(it, data, 0); |
James Feist | b0097d4 | 2019-08-15 09:24:13 -0700 | [diff] [blame] | 210 | } |
| 211 | nlohmann::json expected = {{"Address", 84}, |
| 212 | {"Bus", 15}, |
| 213 | {"Name", "15 sensor 0"}, |
| 214 | {"Type", "SomeType"}}; |
| 215 | EXPECT_EQ(expected, j); |
| 216 | } |
| 217 | |
| 218 | TEST(TemplateCharReplace, replaceSecondAsInt) |
| 219 | { |
| 220 | nlohmann::json j = {{"foo", "twelve is $TEST"}}; |
| 221 | auto it = j.begin(); |
Andrew Jeffery | 1983d2f | 2022-04-05 14:55:13 +0930 | [diff] [blame] | 222 | DBusInterface data; |
James Feist | b0097d4 | 2019-08-15 09:24:13 -0700 | [diff] [blame] | 223 | data["test"] = 12; |
| 224 | |
Christopher Meis | 59ef1e7 | 2025-04-16 08:53:25 +0200 | [diff] [blame] | 225 | em_utils::templateCharReplace(it, data, 0); |
James Feist | b0097d4 | 2019-08-15 09:24:13 -0700 | [diff] [blame] | 226 | |
| 227 | nlohmann::json expected = "twelve is 12"; |
| 228 | EXPECT_EQ(expected, j["foo"]); |
| 229 | } |
James Feist | c296c80 | 2019-08-28 09:26:47 -0700 | [diff] [blame] | 230 | |
| 231 | TEST(TemplateCharReplace, singleHex) |
| 232 | { |
| 233 | nlohmann::json j = {{"foo", "0x54"}}; |
| 234 | auto it = j.begin(); |
Andrew Jeffery | 1983d2f | 2022-04-05 14:55:13 +0930 | [diff] [blame] | 235 | DBusInterface data; |
James Feist | c296c80 | 2019-08-28 09:26:47 -0700 | [diff] [blame] | 236 | |
Christopher Meis | 59ef1e7 | 2025-04-16 08:53:25 +0200 | [diff] [blame] | 237 | em_utils::templateCharReplace(it, data, 0); |
James Feist | c296c80 | 2019-08-28 09:26:47 -0700 | [diff] [blame] | 238 | |
| 239 | nlohmann::json expected = 84; |
| 240 | EXPECT_EQ(expected, j["foo"]); |
| 241 | } |
Brad Bishop | 9d2ef08 | 2020-08-26 15:17:55 -0400 | [diff] [blame] | 242 | |
| 243 | TEST(MatchProbe, stringEqString) |
| 244 | { |
| 245 | nlohmann::json j = R"("foo")"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 246 | DBusValueVariant v = "foo"s; |
Brad Bishop | 9d2ef08 | 2020-08-26 15:17:55 -0400 | [diff] [blame] | 247 | EXPECT_TRUE(matchProbe(j, v)); |
| 248 | } |
| 249 | |
| 250 | TEST(MatchProbe, stringRegexEqString) |
| 251 | { |
| 252 | nlohmann::json j = R"("foo*")"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 253 | DBusValueVariant v = "foobar"s; |
Brad Bishop | 9d2ef08 | 2020-08-26 15:17:55 -0400 | [diff] [blame] | 254 | EXPECT_TRUE(matchProbe(j, v)); |
| 255 | } |
| 256 | |
| 257 | TEST(MatchProbe, stringNeqString) |
| 258 | { |
| 259 | nlohmann::json j = R"("foobar")"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 260 | DBusValueVariant v = "foo"s; |
Brad Bishop | 9d2ef08 | 2020-08-26 15:17:55 -0400 | [diff] [blame] | 261 | EXPECT_FALSE(matchProbe(j, v)); |
| 262 | } |
| 263 | |
| 264 | TEST(MatchProbe, stringRegexError) |
| 265 | { |
| 266 | nlohmann::json j = R"("foo[")"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 267 | DBusValueVariant v = "foobar"s; |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 268 | EXPECT_FALSE(matchProbe(j, v)); |
Brad Bishop | 9d2ef08 | 2020-08-26 15:17:55 -0400 | [diff] [blame] | 269 | } |
| 270 | |
Patrick Rudolph | 1c39d7b | 2023-09-21 15:50:20 +0200 | [diff] [blame] | 271 | TEST(MatchProbe, stringRegexNotPrefix) |
| 272 | { |
| 273 | nlohmann::json j = R"("foo(?!bar)...foo")"_json; |
| 274 | DBusValueVariant v1 = "foobarfoo"s; |
| 275 | DBusValueVariant v2 = "foofoofoo"s; |
| 276 | EXPECT_FALSE(matchProbe(j, v1)); |
| 277 | EXPECT_TRUE(matchProbe(j, v2)); |
| 278 | } |
| 279 | |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 280 | TEST(MatchProbe, stringZeroNeqFalse) |
Brad Bishop | 9d2ef08 | 2020-08-26 15:17:55 -0400 | [diff] [blame] | 281 | { |
| 282 | nlohmann::json j = R"("0")"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 283 | DBusValueVariant v = false; |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 284 | EXPECT_FALSE(matchProbe(j, v)); |
Brad Bishop | 9d2ef08 | 2020-08-26 15:17:55 -0400 | [diff] [blame] | 285 | } |
| 286 | |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 287 | TEST(MatchProbe, stringOneNeqTrue) |
Brad Bishop | 9d2ef08 | 2020-08-26 15:17:55 -0400 | [diff] [blame] | 288 | { |
| 289 | nlohmann::json j = R"("1")"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 290 | DBusValueVariant v = true; |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 291 | EXPECT_FALSE(matchProbe(j, v)); |
Brad Bishop | 9d2ef08 | 2020-08-26 15:17:55 -0400 | [diff] [blame] | 292 | } |
| 293 | |
| 294 | TEST(MatchProbe, stringElevenNeqTrue) |
| 295 | { |
| 296 | nlohmann::json j = R"("11")"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 297 | DBusValueVariant v = true; |
Brad Bishop | 9d2ef08 | 2020-08-26 15:17:55 -0400 | [diff] [blame] | 298 | EXPECT_FALSE(matchProbe(j, v)); |
| 299 | } |
| 300 | |
| 301 | TEST(MatchProbe, stringFalseNeqFalse) |
| 302 | { |
| 303 | nlohmann::json j = R"("false")"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 304 | DBusValueVariant v = false; |
Brad Bishop | 9d2ef08 | 2020-08-26 15:17:55 -0400 | [diff] [blame] | 305 | EXPECT_FALSE(matchProbe(j, v)); |
| 306 | } |
| 307 | |
| 308 | TEST(MatchProbe, stringTrueNeqTrue) |
| 309 | { |
| 310 | nlohmann::json j = R"("true")"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 311 | DBusValueVariant v = true; |
Brad Bishop | 9d2ef08 | 2020-08-26 15:17:55 -0400 | [diff] [blame] | 312 | EXPECT_FALSE(matchProbe(j, v)); |
| 313 | } |
| 314 | |
| 315 | TEST(MatchProbe, stringFalseNeqTrue) |
| 316 | { |
| 317 | nlohmann::json j = R"("false")"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 318 | DBusValueVariant v = true; |
Brad Bishop | 9d2ef08 | 2020-08-26 15:17:55 -0400 | [diff] [blame] | 319 | EXPECT_FALSE(matchProbe(j, v)); |
| 320 | } |
| 321 | |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 322 | TEST(MatchProbe, stringNeqUint8) |
Brad Bishop | 9d2ef08 | 2020-08-26 15:17:55 -0400 | [diff] [blame] | 323 | { |
| 324 | nlohmann::json j = R"("255")"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 325 | DBusValueVariant v = uint8_t(255); |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 326 | EXPECT_FALSE(matchProbe(j, v)); |
Brad Bishop | 9d2ef08 | 2020-08-26 15:17:55 -0400 | [diff] [blame] | 327 | } |
| 328 | |
| 329 | TEST(MatchProbe, stringNeqUint8Overflow) |
| 330 | { |
| 331 | nlohmann::json j = R"("65535")"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 332 | DBusValueVariant v = uint8_t(255); |
Brad Bishop | 9d2ef08 | 2020-08-26 15:17:55 -0400 | [diff] [blame] | 333 | EXPECT_FALSE(matchProbe(j, v)); |
| 334 | } |
| 335 | |
| 336 | TEST(MatchProbe, stringFalseNeqUint8Zero) |
| 337 | { |
| 338 | nlohmann::json j = R"("false")"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 339 | DBusValueVariant v = uint8_t(0); |
Brad Bishop | 9d2ef08 | 2020-08-26 15:17:55 -0400 | [diff] [blame] | 340 | EXPECT_FALSE(matchProbe(j, v)); |
| 341 | } |
| 342 | |
| 343 | TEST(MatchProbe, stringTrueNeqUint8Zero) |
| 344 | { |
| 345 | nlohmann::json j = R"("true")"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 346 | DBusValueVariant v = uint8_t(1); |
Brad Bishop | 9d2ef08 | 2020-08-26 15:17:55 -0400 | [diff] [blame] | 347 | EXPECT_FALSE(matchProbe(j, v)); |
| 348 | } |
| 349 | |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 350 | TEST(MatchProbe, stringNeqUint32) |
Brad Bishop | 9d2ef08 | 2020-08-26 15:17:55 -0400 | [diff] [blame] | 351 | { |
| 352 | nlohmann::json j = R"("11")"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 353 | DBusValueVariant v = uint32_t(11); |
Brad Bishop | 9d2ef08 | 2020-08-26 15:17:55 -0400 | [diff] [blame] | 354 | EXPECT_FALSE(matchProbe(j, v)); |
| 355 | } |
| 356 | |
Brad Bishop | 9d2ef08 | 2020-08-26 15:17:55 -0400 | [diff] [blame] | 357 | TEST(MatchProbe, stringNeqInt32) |
| 358 | { |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 359 | nlohmann::json j = R"("-11")"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 360 | DBusValueVariant v = int32_t(-11); |
Brad Bishop | 9d2ef08 | 2020-08-26 15:17:55 -0400 | [diff] [blame] | 361 | EXPECT_FALSE(matchProbe(j, v)); |
| 362 | } |
| 363 | |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 364 | TEST(MatchProbe, stringRegexNeqInt32) |
Brad Bishop | 9d2ef08 | 2020-08-26 15:17:55 -0400 | [diff] [blame] | 365 | { |
| 366 | nlohmann::json j = R"("1*4")"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 367 | DBusValueVariant v = int32_t(124); |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 368 | EXPECT_FALSE(matchProbe(j, v)); |
Brad Bishop | 9d2ef08 | 2020-08-26 15:17:55 -0400 | [diff] [blame] | 369 | } |
| 370 | |
| 371 | TEST(MatchProbe, stringNeqUint64) |
| 372 | { |
| 373 | nlohmann::json j = R"("foo")"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 374 | DBusValueVariant v = uint64_t(65535); |
Brad Bishop | 9d2ef08 | 2020-08-26 15:17:55 -0400 | [diff] [blame] | 375 | EXPECT_FALSE(matchProbe(j, v)); |
| 376 | } |
| 377 | |
Brad Bishop | 9d2ef08 | 2020-08-26 15:17:55 -0400 | [diff] [blame] | 378 | TEST(MatchProbe, stringNeqDouble) |
| 379 | { |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 380 | nlohmann::json j = R"("123.4")"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 381 | DBusValueVariant v = double(123.4); |
Brad Bishop | 9d2ef08 | 2020-08-26 15:17:55 -0400 | [diff] [blame] | 382 | EXPECT_FALSE(matchProbe(j, v)); |
| 383 | } |
| 384 | |
| 385 | TEST(MatchProbe, stringNeqEmpty) |
| 386 | { |
| 387 | nlohmann::json j = R"("-123.4")"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 388 | DBusValueVariant v; |
Brad Bishop | 9d2ef08 | 2020-08-26 15:17:55 -0400 | [diff] [blame] | 389 | EXPECT_FALSE(matchProbe(j, v)); |
| 390 | } |
Brad Bishop | c5eba59 | 2020-08-28 10:38:24 -0400 | [diff] [blame] | 391 | |
Brad Bishop | cd1868e | 2020-08-28 17:58:52 -0400 | [diff] [blame] | 392 | TEST(MatchProbe, stringNeqArray) |
| 393 | { |
| 394 | nlohmann::json j = R"("-123.4")"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 395 | DBusValueVariant v = std::vector<uint8_t>{1, 2}; |
Brad Bishop | cd1868e | 2020-08-28 17:58:52 -0400 | [diff] [blame] | 396 | EXPECT_FALSE(matchProbe(j, v)); |
| 397 | } |
| 398 | |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 399 | TEST(MatchProbe, boolNeqString) |
Brad Bishop | c5eba59 | 2020-08-28 10:38:24 -0400 | [diff] [blame] | 400 | { |
| 401 | nlohmann::json j = R"(false)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 402 | DBusValueVariant v = "false"s; |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 403 | EXPECT_FALSE(matchProbe(j, v)); |
Brad Bishop | c5eba59 | 2020-08-28 10:38:24 -0400 | [diff] [blame] | 404 | } |
| 405 | |
| 406 | TEST(MatchProbe, trueEqTrue) |
| 407 | { |
| 408 | nlohmann::json j = R"(true)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 409 | DBusValueVariant v = true; |
Brad Bishop | c5eba59 | 2020-08-28 10:38:24 -0400 | [diff] [blame] | 410 | EXPECT_TRUE(matchProbe(j, v)); |
| 411 | } |
| 412 | |
| 413 | TEST(MatchProbe, falseEqFalse) |
| 414 | { |
| 415 | nlohmann::json j = R"(false)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 416 | DBusValueVariant v = false; |
Brad Bishop | c5eba59 | 2020-08-28 10:38:24 -0400 | [diff] [blame] | 417 | EXPECT_TRUE(matchProbe(j, v)); |
| 418 | } |
| 419 | |
| 420 | TEST(MatchProbe, trueNeqFalse) |
| 421 | { |
| 422 | nlohmann::json j = R"(true)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 423 | DBusValueVariant v = false; |
Brad Bishop | c5eba59 | 2020-08-28 10:38:24 -0400 | [diff] [blame] | 424 | EXPECT_FALSE(matchProbe(j, v)); |
| 425 | } |
| 426 | |
| 427 | TEST(MatchProbe, trueNeqInt32Zero) |
| 428 | { |
| 429 | nlohmann::json j = R"(true)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 430 | DBusValueVariant v = int32_t(0); |
Brad Bishop | c5eba59 | 2020-08-28 10:38:24 -0400 | [diff] [blame] | 431 | EXPECT_FALSE(matchProbe(j, v)); |
| 432 | } |
| 433 | |
| 434 | TEST(MatchProbe, trueNeqInt32NegativeOne) |
| 435 | { |
| 436 | nlohmann::json j = R"(true)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 437 | DBusValueVariant v = int32_t(-1); |
Brad Bishop | c5eba59 | 2020-08-28 10:38:24 -0400 | [diff] [blame] | 438 | EXPECT_FALSE(matchProbe(j, v)); |
| 439 | } |
| 440 | |
| 441 | TEST(MatchProbe, falseNeqUint32One) |
| 442 | { |
| 443 | nlohmann::json j = R"(false)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 444 | DBusValueVariant v = uint32_t(1); |
Brad Bishop | c5eba59 | 2020-08-28 10:38:24 -0400 | [diff] [blame] | 445 | EXPECT_FALSE(matchProbe(j, v)); |
| 446 | } |
| 447 | |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 448 | TEST(MatchProbe, falseNeqUint32Zero) |
Brad Bishop | c5eba59 | 2020-08-28 10:38:24 -0400 | [diff] [blame] | 449 | { |
| 450 | nlohmann::json j = R"(false)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 451 | DBusValueVariant v = uint32_t(0); |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 452 | EXPECT_FALSE(matchProbe(j, v)); |
Brad Bishop | c5eba59 | 2020-08-28 10:38:24 -0400 | [diff] [blame] | 453 | } |
| 454 | |
| 455 | TEST(MatchProbe, trueNeqDoubleNegativeOne) |
| 456 | { |
| 457 | nlohmann::json j = R"(true)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 458 | DBusValueVariant v = double(-1.1); |
Brad Bishop | c5eba59 | 2020-08-28 10:38:24 -0400 | [diff] [blame] | 459 | EXPECT_FALSE(matchProbe(j, v)); |
| 460 | } |
| 461 | |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 462 | TEST(MatchProbe, trueNeqDoubleOne) |
Brad Bishop | c5eba59 | 2020-08-28 10:38:24 -0400 | [diff] [blame] | 463 | { |
| 464 | nlohmann::json j = R"(true)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 465 | DBusValueVariant v = double(1.0); |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 466 | EXPECT_FALSE(matchProbe(j, v)); |
Brad Bishop | c5eba59 | 2020-08-28 10:38:24 -0400 | [diff] [blame] | 467 | } |
| 468 | |
| 469 | TEST(MatchProbe, falseNeqDoubleOne) |
| 470 | { |
| 471 | nlohmann::json j = R"(false)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 472 | DBusValueVariant v = double(1.0); |
Brad Bishop | c5eba59 | 2020-08-28 10:38:24 -0400 | [diff] [blame] | 473 | EXPECT_FALSE(matchProbe(j, v)); |
| 474 | } |
| 475 | |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 476 | TEST(MatchProbe, falseNeqDoubleZero) |
Brad Bishop | c5eba59 | 2020-08-28 10:38:24 -0400 | [diff] [blame] | 477 | { |
| 478 | nlohmann::json j = R"(false)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 479 | DBusValueVariant v = double(0.0); |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 480 | EXPECT_FALSE(matchProbe(j, v)); |
Brad Bishop | c5eba59 | 2020-08-28 10:38:24 -0400 | [diff] [blame] | 481 | } |
| 482 | |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 483 | TEST(MatchProbe, falseNeqEmpty) |
Brad Bishop | c5eba59 | 2020-08-28 10:38:24 -0400 | [diff] [blame] | 484 | { |
| 485 | nlohmann::json j = R"(false)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 486 | DBusValueVariant v; |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 487 | EXPECT_FALSE(matchProbe(j, v)); |
Brad Bishop | c5eba59 | 2020-08-28 10:38:24 -0400 | [diff] [blame] | 488 | } |
| 489 | |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 490 | TEST(MatchProbe, trueNeqEmpty) |
Brad Bishop | c5eba59 | 2020-08-28 10:38:24 -0400 | [diff] [blame] | 491 | { |
| 492 | nlohmann::json j = R"(true)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 493 | DBusValueVariant v; |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 494 | EXPECT_FALSE(matchProbe(j, v)); |
Brad Bishop | c5eba59 | 2020-08-28 10:38:24 -0400 | [diff] [blame] | 495 | } |
Brad Bishop | c2af531 | 2020-08-28 10:39:49 -0400 | [diff] [blame] | 496 | |
Brad Bishop | cd1868e | 2020-08-28 17:58:52 -0400 | [diff] [blame] | 497 | TEST(MatchProbe, trueNeqArray) |
| 498 | { |
| 499 | nlohmann::json j = R"(true)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 500 | DBusValueVariant v = std::vector<uint8_t>{1, 2}; |
Brad Bishop | cd1868e | 2020-08-28 17:58:52 -0400 | [diff] [blame] | 501 | EXPECT_FALSE(matchProbe(j, v)); |
| 502 | } |
| 503 | |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 504 | TEST(MatchProbe, uintNeqString) |
Brad Bishop | c2af531 | 2020-08-28 10:39:49 -0400 | [diff] [blame] | 505 | { |
| 506 | nlohmann::json j = R"(11)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 507 | DBusValueVariant v = "11"s; |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 508 | EXPECT_FALSE(matchProbe(j, v)); |
Brad Bishop | c2af531 | 2020-08-28 10:39:49 -0400 | [diff] [blame] | 509 | } |
| 510 | |
| 511 | TEST(MatchProbe, uintNeqTrue) |
| 512 | { |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 513 | nlohmann::json j = R"(1)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 514 | DBusValueVariant v = true; |
Brad Bishop | c2af531 | 2020-08-28 10:39:49 -0400 | [diff] [blame] | 515 | EXPECT_FALSE(matchProbe(j, v)); |
| 516 | } |
| 517 | |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 518 | TEST(MatchProbe, uintNeqFalse) |
| 519 | { |
| 520 | nlohmann::json j = R"(0)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 521 | DBusValueVariant v = false; |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 522 | EXPECT_FALSE(matchProbe(j, v)); |
| 523 | } |
| 524 | |
Brad Bishop | c2af531 | 2020-08-28 10:39:49 -0400 | [diff] [blame] | 525 | TEST(MatchProbe, uintEqUint8) |
| 526 | { |
| 527 | nlohmann::json j = R"(11)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 528 | DBusValueVariant v = uint8_t(11); |
Brad Bishop | c2af531 | 2020-08-28 10:39:49 -0400 | [diff] [blame] | 529 | EXPECT_TRUE(matchProbe(j, v)); |
| 530 | } |
| 531 | |
| 532 | TEST(MatchProbe, uintNeqUint8) |
| 533 | { |
| 534 | nlohmann::json j = R"(11)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 535 | DBusValueVariant v = uint8_t(12); |
Brad Bishop | c2af531 | 2020-08-28 10:39:49 -0400 | [diff] [blame] | 536 | EXPECT_FALSE(matchProbe(j, v)); |
| 537 | } |
| 538 | |
| 539 | TEST(MatchProbe, uintNeqUint8Overflow) |
| 540 | { |
| 541 | nlohmann::json j = R"(65535)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 542 | DBusValueVariant v = uint8_t(255); |
Brad Bishop | c2af531 | 2020-08-28 10:39:49 -0400 | [diff] [blame] | 543 | EXPECT_FALSE(matchProbe(j, v)); |
| 544 | } |
| 545 | |
| 546 | TEST(MatchProbe, uintEqInt8) |
| 547 | { |
| 548 | nlohmann::json j = R"(11)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 549 | DBusValueVariant v = int8_t(11); |
Brad Bishop | c2af531 | 2020-08-28 10:39:49 -0400 | [diff] [blame] | 550 | EXPECT_TRUE(matchProbe(j, v)); |
| 551 | } |
| 552 | |
| 553 | TEST(MatchProbe, uintEqDouble) |
| 554 | { |
| 555 | nlohmann::json j = R"(11)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 556 | DBusValueVariant v = double(11.0); |
Brad Bishop | c2af531 | 2020-08-28 10:39:49 -0400 | [diff] [blame] | 557 | EXPECT_TRUE(matchProbe(j, v)); |
| 558 | } |
| 559 | |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 560 | TEST(MatchProbe, uintNeqDouble) |
Brad Bishop | c2af531 | 2020-08-28 10:39:49 -0400 | [diff] [blame] | 561 | { |
| 562 | nlohmann::json j = R"(11)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 563 | DBusValueVariant v = double(11.7); |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 564 | EXPECT_FALSE(matchProbe(j, v)); |
Brad Bishop | c2af531 | 2020-08-28 10:39:49 -0400 | [diff] [blame] | 565 | } |
| 566 | |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 567 | TEST(MatchProbe, uintNeqEmpty) |
Brad Bishop | c2af531 | 2020-08-28 10:39:49 -0400 | [diff] [blame] | 568 | { |
| 569 | nlohmann::json j = R"(11)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 570 | DBusValueVariant v; |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 571 | EXPECT_FALSE(matchProbe(j, v)); |
Brad Bishop | c2af531 | 2020-08-28 10:39:49 -0400 | [diff] [blame] | 572 | } |
Brad Bishop | 667e050 | 2020-08-28 10:41:40 -0400 | [diff] [blame] | 573 | |
Brad Bishop | cd1868e | 2020-08-28 17:58:52 -0400 | [diff] [blame] | 574 | TEST(MatchProbe, uintNeqArray) |
| 575 | { |
| 576 | nlohmann::json j = R"(11)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 577 | DBusValueVariant v = std::vector<uint8_t>{11}; |
Brad Bishop | cd1868e | 2020-08-28 17:58:52 -0400 | [diff] [blame] | 578 | EXPECT_FALSE(matchProbe(j, v)); |
| 579 | } |
| 580 | |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 581 | TEST(MatchProbe, intNeqString) |
Brad Bishop | 667e050 | 2020-08-28 10:41:40 -0400 | [diff] [blame] | 582 | { |
| 583 | nlohmann::json j = R"(-11)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 584 | DBusValueVariant v = "-11"s; |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 585 | EXPECT_FALSE(matchProbe(j, v)); |
Brad Bishop | 667e050 | 2020-08-28 10:41:40 -0400 | [diff] [blame] | 586 | } |
| 587 | |
| 588 | TEST(MatchProbe, intNeqTrue) |
| 589 | { |
| 590 | nlohmann::json j = R"(-1)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 591 | DBusValueVariant v = true; |
Brad Bishop | 667e050 | 2020-08-28 10:41:40 -0400 | [diff] [blame] | 592 | EXPECT_FALSE(matchProbe(j, v)); |
| 593 | } |
| 594 | |
| 595 | TEST(MatchProbe, intNeqUint8) |
| 596 | { |
| 597 | nlohmann::json j = R"(-11)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 598 | DBusValueVariant v = uint8_t(11); |
Brad Bishop | 667e050 | 2020-08-28 10:41:40 -0400 | [diff] [blame] | 599 | EXPECT_FALSE(matchProbe(j, v)); |
| 600 | } |
| 601 | |
| 602 | TEST(MatchProbe, intEqInt8) |
| 603 | { |
| 604 | nlohmann::json j = R"(-11)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 605 | DBusValueVariant v = int8_t(-11); |
Brad Bishop | 667e050 | 2020-08-28 10:41:40 -0400 | [diff] [blame] | 606 | EXPECT_TRUE(matchProbe(j, v)); |
| 607 | } |
| 608 | |
| 609 | TEST(MatchProbe, intNeqDouble) |
| 610 | { |
| 611 | nlohmann::json j = R"(-124)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 612 | DBusValueVariant v = double(-123.0); |
Brad Bishop | 667e050 | 2020-08-28 10:41:40 -0400 | [diff] [blame] | 613 | EXPECT_FALSE(matchProbe(j, v)); |
| 614 | } |
| 615 | |
| 616 | TEST(MatchProbe, intEqDouble) |
| 617 | { |
| 618 | nlohmann::json j = R"(-11)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 619 | DBusValueVariant v = double(-11.0); |
Brad Bishop | 667e050 | 2020-08-28 10:41:40 -0400 | [diff] [blame] | 620 | EXPECT_TRUE(matchProbe(j, v)); |
| 621 | } |
| 622 | |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 623 | TEST(MatchProbe, intNeqDoubleRound) |
Brad Bishop | 667e050 | 2020-08-28 10:41:40 -0400 | [diff] [blame] | 624 | { |
| 625 | nlohmann::json j = R"(-11)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 626 | DBusValueVariant v = double(-11.7); |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 627 | EXPECT_FALSE(matchProbe(j, v)); |
Brad Bishop | 667e050 | 2020-08-28 10:41:40 -0400 | [diff] [blame] | 628 | } |
| 629 | |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 630 | TEST(MatchProbe, intNeqEmpty) |
Brad Bishop | 667e050 | 2020-08-28 10:41:40 -0400 | [diff] [blame] | 631 | { |
| 632 | nlohmann::json j = R"(-11)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 633 | DBusValueVariant v; |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 634 | EXPECT_FALSE(matchProbe(j, v)); |
Brad Bishop | 667e050 | 2020-08-28 10:41:40 -0400 | [diff] [blame] | 635 | } |
Brad Bishop | 3bd8e8d | 2020-08-28 10:42:27 -0400 | [diff] [blame] | 636 | |
Brad Bishop | cd1868e | 2020-08-28 17:58:52 -0400 | [diff] [blame] | 637 | TEST(MatchProbe, intNeqArray) |
| 638 | { |
| 639 | nlohmann::json j = R"(-11)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 640 | DBusValueVariant v = std::vector<uint8_t>{11}; |
Brad Bishop | cd1868e | 2020-08-28 17:58:52 -0400 | [diff] [blame] | 641 | EXPECT_FALSE(matchProbe(j, v)); |
| 642 | } |
| 643 | |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 644 | TEST(MatchProbe, doubleNeqString) |
Brad Bishop | 3bd8e8d | 2020-08-28 10:42:27 -0400 | [diff] [blame] | 645 | { |
| 646 | nlohmann::json j = R"(0.0)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 647 | DBusValueVariant v = "0.0"s; |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 648 | EXPECT_FALSE(matchProbe(j, v)); |
Brad Bishop | 3bd8e8d | 2020-08-28 10:42:27 -0400 | [diff] [blame] | 649 | } |
| 650 | |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 651 | TEST(MatchProbe, doubleNeqFalse) |
Brad Bishop | 3bd8e8d | 2020-08-28 10:42:27 -0400 | [diff] [blame] | 652 | { |
| 653 | nlohmann::json j = R"(0.0)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 654 | DBusValueVariant v = false; |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 655 | EXPECT_FALSE(matchProbe(j, v)); |
Brad Bishop | 3bd8e8d | 2020-08-28 10:42:27 -0400 | [diff] [blame] | 656 | } |
| 657 | |
| 658 | TEST(MatchProbe, doubleNeqTrue) |
| 659 | { |
Brad Bishop | 3bd8e8d | 2020-08-28 10:42:27 -0400 | [diff] [blame] | 660 | nlohmann::json j = R"(1.0)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 661 | DBusValueVariant v = true; |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 662 | EXPECT_FALSE(matchProbe(j, v)); |
Brad Bishop | 3bd8e8d | 2020-08-28 10:42:27 -0400 | [diff] [blame] | 663 | } |
| 664 | |
| 665 | TEST(MatchProbe, doubleEqInt32) |
| 666 | { |
| 667 | nlohmann::json j = R"(-124.0)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 668 | DBusValueVariant v = int32_t(-124); |
Brad Bishop | 3bd8e8d | 2020-08-28 10:42:27 -0400 | [diff] [blame] | 669 | EXPECT_TRUE(matchProbe(j, v)); |
| 670 | } |
| 671 | |
| 672 | TEST(MatchProbe, doubleNeqInt32) |
| 673 | { |
| 674 | nlohmann::json j = R"(-124.0)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 675 | DBusValueVariant v = int32_t(-123); |
Brad Bishop | 3bd8e8d | 2020-08-28 10:42:27 -0400 | [diff] [blame] | 676 | EXPECT_FALSE(matchProbe(j, v)); |
| 677 | } |
| 678 | |
| 679 | TEST(MatchProbe, doubleRoundNeqInt) |
| 680 | { |
| 681 | nlohmann::json j = R"(124.7)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 682 | DBusValueVariant v = int32_t(124); |
Brad Bishop | 3bd8e8d | 2020-08-28 10:42:27 -0400 | [diff] [blame] | 683 | EXPECT_FALSE(matchProbe(j, v)); |
| 684 | } |
| 685 | TEST(MatchProbe, doubleEqDouble) |
| 686 | { |
| 687 | nlohmann::json j = R"(-124.2)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 688 | DBusValueVariant v = double(-124.2); |
Brad Bishop | 3bd8e8d | 2020-08-28 10:42:27 -0400 | [diff] [blame] | 689 | EXPECT_TRUE(matchProbe(j, v)); |
| 690 | } |
| 691 | |
| 692 | TEST(MatchProbe, doubleNeqDouble) |
| 693 | { |
| 694 | nlohmann::json j = R"(-124.3)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 695 | DBusValueVariant v = double(-124.2); |
Brad Bishop | 3bd8e8d | 2020-08-28 10:42:27 -0400 | [diff] [blame] | 696 | EXPECT_FALSE(matchProbe(j, v)); |
| 697 | } |
| 698 | |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 699 | TEST(MatchProbe, doubleNeqEmpty) |
Brad Bishop | 3bd8e8d | 2020-08-28 10:42:27 -0400 | [diff] [blame] | 700 | { |
| 701 | nlohmann::json j = R"(-11.0)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 702 | DBusValueVariant v; |
Brad Bishop | 5d52541 | 2020-08-26 08:50:50 -0400 | [diff] [blame] | 703 | EXPECT_FALSE(matchProbe(j, v)); |
Brad Bishop | 3bd8e8d | 2020-08-28 10:42:27 -0400 | [diff] [blame] | 704 | } |
Brad Bishop | d14c2e2 | 2020-08-28 10:43:40 -0400 | [diff] [blame] | 705 | |
Brad Bishop | cd1868e | 2020-08-28 17:58:52 -0400 | [diff] [blame] | 706 | TEST(MatchProbe, doubleNeqArray) |
| 707 | { |
| 708 | nlohmann::json j = R"(-11.2)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 709 | DBusValueVariant v = std::vector<uint8_t>{11}; |
Brad Bishop | cd1868e | 2020-08-28 17:58:52 -0400 | [diff] [blame] | 710 | EXPECT_FALSE(matchProbe(j, v)); |
| 711 | } |
| 712 | |
Brad Bishop | d14c2e2 | 2020-08-28 10:43:40 -0400 | [diff] [blame] | 713 | TEST(MatchProbe, arrayNeqString) |
| 714 | { |
| 715 | nlohmann::json j = R"([1, 2])"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 716 | DBusValueVariant v = "hello"s; |
Brad Bishop | d14c2e2 | 2020-08-28 10:43:40 -0400 | [diff] [blame] | 717 | EXPECT_FALSE(matchProbe(j, v)); |
| 718 | } |
| 719 | |
| 720 | TEST(MatchProbe, arrayNeqFalse) |
| 721 | { |
| 722 | nlohmann::json j = R"([1, 2])"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 723 | DBusValueVariant v = false; |
Brad Bishop | d14c2e2 | 2020-08-28 10:43:40 -0400 | [diff] [blame] | 724 | EXPECT_FALSE(matchProbe(j, v)); |
| 725 | } |
| 726 | |
| 727 | TEST(MatchProbe, arrayNeqTrue) |
| 728 | { |
| 729 | nlohmann::json j = R"([1, 2])"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 730 | DBusValueVariant v = true; |
Brad Bishop | d14c2e2 | 2020-08-28 10:43:40 -0400 | [diff] [blame] | 731 | EXPECT_FALSE(matchProbe(j, v)); |
| 732 | } |
| 733 | |
| 734 | TEST(MatchProbe, arrayNeqUint8) |
| 735 | { |
| 736 | nlohmann::json j = R"([1, 2])"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 737 | DBusValueVariant v = uint8_t(1); |
Brad Bishop | d14c2e2 | 2020-08-28 10:43:40 -0400 | [diff] [blame] | 738 | EXPECT_FALSE(matchProbe(j, v)); |
| 739 | } |
| 740 | |
| 741 | TEST(MatchProbe, arrayNeqInt32) |
| 742 | { |
| 743 | nlohmann::json j = R"([1, 2])"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 744 | DBusValueVariant v = int32_t(-1); |
Brad Bishop | d14c2e2 | 2020-08-28 10:43:40 -0400 | [diff] [blame] | 745 | EXPECT_FALSE(matchProbe(j, v)); |
| 746 | } |
| 747 | |
| 748 | TEST(MatchProbe, arrayNeqDouble) |
| 749 | { |
| 750 | nlohmann::json j = R"([1, 2])"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 751 | DBusValueVariant v = double(1.1); |
Brad Bishop | d14c2e2 | 2020-08-28 10:43:40 -0400 | [diff] [blame] | 752 | EXPECT_FALSE(matchProbe(j, v)); |
| 753 | } |
Brad Bishop | 6660e2a | 2020-08-28 10:44:41 -0400 | [diff] [blame] | 754 | |
Brad Bishop | cd1868e | 2020-08-28 17:58:52 -0400 | [diff] [blame] | 755 | TEST(MatchProbe, arrayEqArray) |
| 756 | { |
| 757 | nlohmann::json j = R"([1, 2])"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 758 | DBusValueVariant v = std::vector<uint8_t>{1, 2}; |
Brad Bishop | cd1868e | 2020-08-28 17:58:52 -0400 | [diff] [blame] | 759 | EXPECT_TRUE(matchProbe(j, v)); |
| 760 | } |
| 761 | |
| 762 | TEST(MatchProbe, arrayNeqArrayDiffSize1) |
| 763 | { |
| 764 | nlohmann::json j = R"([1, 2, 3])"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 765 | DBusValueVariant v = std::vector<uint8_t>{1, 2}; |
Brad Bishop | cd1868e | 2020-08-28 17:58:52 -0400 | [diff] [blame] | 766 | EXPECT_FALSE(matchProbe(j, v)); |
| 767 | } |
| 768 | |
| 769 | TEST(MatchProbe, arrayNeqArrayDiffSize2) |
| 770 | { |
| 771 | nlohmann::json j = R"([1, 2])"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 772 | DBusValueVariant v = std::vector<uint8_t>{1, 2, 3}; |
Brad Bishop | cd1868e | 2020-08-28 17:58:52 -0400 | [diff] [blame] | 773 | EXPECT_FALSE(matchProbe(j, v)); |
| 774 | } |
| 775 | |
| 776 | TEST(MatchProbe, emptyArrayEqEmptyArray) |
| 777 | { |
| 778 | nlohmann::json j = R"([])"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 779 | DBusValueVariant v = std::vector<uint8_t>{}; |
Brad Bishop | cd1868e | 2020-08-28 17:58:52 -0400 | [diff] [blame] | 780 | EXPECT_TRUE(matchProbe(j, v)); |
| 781 | } |
| 782 | |
| 783 | TEST(MatchProbe, emptyArrayNeqArray) |
| 784 | { |
| 785 | nlohmann::json j = R"([])"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 786 | DBusValueVariant v = std::vector<uint8_t>{1}; |
Brad Bishop | cd1868e | 2020-08-28 17:58:52 -0400 | [diff] [blame] | 787 | EXPECT_FALSE(matchProbe(j, v)); |
| 788 | } |
| 789 | |
| 790 | TEST(MatchProbe, arrayNeqEmptyArray) |
| 791 | { |
| 792 | nlohmann::json j = R"([1])"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 793 | DBusValueVariant v = std::vector<uint8_t>{}; |
Brad Bishop | cd1868e | 2020-08-28 17:58:52 -0400 | [diff] [blame] | 794 | EXPECT_FALSE(matchProbe(j, v)); |
| 795 | } |
| 796 | |
Brad Bishop | 6660e2a | 2020-08-28 10:44:41 -0400 | [diff] [blame] | 797 | TEST(MatchProbe, objNeqString) |
| 798 | { |
| 799 | nlohmann::json j = R"({"foo": "bar"})"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 800 | DBusValueVariant v = "hello"s; |
Brad Bishop | 6660e2a | 2020-08-28 10:44:41 -0400 | [diff] [blame] | 801 | EXPECT_FALSE(matchProbe(j, v)); |
| 802 | } |
| 803 | |
| 804 | TEST(MatchProbe, objNeqFalse) |
| 805 | { |
| 806 | nlohmann::json j = R"({"foo": "bar"})"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 807 | DBusValueVariant v = false; |
Brad Bishop | 6660e2a | 2020-08-28 10:44:41 -0400 | [diff] [blame] | 808 | EXPECT_FALSE(matchProbe(j, v)); |
| 809 | } |
| 810 | |
| 811 | TEST(MatchProbe, objNeqTrue) |
| 812 | { |
| 813 | nlohmann::json j = R"({"foo": "bar"})"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 814 | DBusValueVariant v = true; |
Brad Bishop | 6660e2a | 2020-08-28 10:44:41 -0400 | [diff] [blame] | 815 | EXPECT_FALSE(matchProbe(j, v)); |
| 816 | } |
| 817 | |
| 818 | TEST(MatchProbe, objNeqUint8) |
| 819 | { |
| 820 | nlohmann::json j = R"({"foo": "bar"})"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 821 | DBusValueVariant v = uint8_t(1); |
Brad Bishop | 6660e2a | 2020-08-28 10:44:41 -0400 | [diff] [blame] | 822 | EXPECT_FALSE(matchProbe(j, v)); |
| 823 | } |
| 824 | |
| 825 | TEST(MatchProbe, objNeqInt32) |
| 826 | { |
| 827 | nlohmann::json j = R"({"foo": "bar"})"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 828 | DBusValueVariant v = int32_t(-1); |
Brad Bishop | 6660e2a | 2020-08-28 10:44:41 -0400 | [diff] [blame] | 829 | EXPECT_FALSE(matchProbe(j, v)); |
| 830 | } |
| 831 | |
| 832 | TEST(MatchProbe, objNeqDouble) |
| 833 | { |
| 834 | nlohmann::json j = R"({"foo": "bar"})"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 835 | DBusValueVariant v = double(1.1); |
Brad Bishop | 6660e2a | 2020-08-28 10:44:41 -0400 | [diff] [blame] | 836 | EXPECT_FALSE(matchProbe(j, v)); |
| 837 | } |
Brad Bishop | c776c41 | 2020-08-28 10:45:25 -0400 | [diff] [blame] | 838 | |
Brad Bishop | cd1868e | 2020-08-28 17:58:52 -0400 | [diff] [blame] | 839 | TEST(MatchProbe, objNeqArray) |
| 840 | { |
| 841 | nlohmann::json j = R"({"foo": "bar"})"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 842 | DBusValueVariant v = std::vector<uint8_t>{1, 2}; |
Brad Bishop | cd1868e | 2020-08-28 17:58:52 -0400 | [diff] [blame] | 843 | EXPECT_FALSE(matchProbe(j, v)); |
| 844 | } |
| 845 | |
Brad Bishop | c776c41 | 2020-08-28 10:45:25 -0400 | [diff] [blame] | 846 | TEST(MatchProbe, nullNeqString) |
| 847 | { |
| 848 | nlohmann::json j = R"(null)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 849 | DBusValueVariant v = "hello"s; |
Brad Bishop | c776c41 | 2020-08-28 10:45:25 -0400 | [diff] [blame] | 850 | EXPECT_FALSE(matchProbe(j, v)); |
| 851 | } |
| 852 | |
| 853 | TEST(MatchProbe, nullNeqFalse) |
| 854 | { |
| 855 | nlohmann::json j = R"(null)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 856 | DBusValueVariant v = false; |
Brad Bishop | c776c41 | 2020-08-28 10:45:25 -0400 | [diff] [blame] | 857 | EXPECT_FALSE(matchProbe(j, v)); |
| 858 | } |
| 859 | |
| 860 | TEST(MatchProbe, nullNeqTrue) |
| 861 | { |
| 862 | nlohmann::json j = R"(null)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 863 | DBusValueVariant v = true; |
Brad Bishop | c776c41 | 2020-08-28 10:45:25 -0400 | [diff] [blame] | 864 | EXPECT_FALSE(matchProbe(j, v)); |
| 865 | } |
| 866 | |
| 867 | TEST(MatchProbe, nullNeqUint8) |
| 868 | { |
| 869 | nlohmann::json j = R"(null)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 870 | DBusValueVariant v = uint8_t(1); |
Brad Bishop | c776c41 | 2020-08-28 10:45:25 -0400 | [diff] [blame] | 871 | EXPECT_FALSE(matchProbe(j, v)); |
| 872 | } |
| 873 | |
| 874 | TEST(MatchProbe, nullNeqInt32) |
| 875 | { |
| 876 | nlohmann::json j = R"(null)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 877 | DBusValueVariant v = int32_t(-1); |
Brad Bishop | c776c41 | 2020-08-28 10:45:25 -0400 | [diff] [blame] | 878 | EXPECT_FALSE(matchProbe(j, v)); |
| 879 | } |
| 880 | |
| 881 | TEST(MatchProbe, nullNeqDouble) |
| 882 | { |
| 883 | nlohmann::json j = R"(null)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 884 | DBusValueVariant v = double(1.1); |
Brad Bishop | c776c41 | 2020-08-28 10:45:25 -0400 | [diff] [blame] | 885 | EXPECT_FALSE(matchProbe(j, v)); |
| 886 | } |
Brad Bishop | cd1868e | 2020-08-28 17:58:52 -0400 | [diff] [blame] | 887 | |
| 888 | TEST(MatchProbe, nullNeqArray) |
| 889 | { |
| 890 | nlohmann::json j = R"(null)"_json; |
Andrew Jeffery | eab4929 | 2022-04-05 14:42:20 +0930 | [diff] [blame] | 891 | DBusValueVariant v = std::vector<uint8_t>{}; |
Brad Bishop | cd1868e | 2020-08-28 17:58:52 -0400 | [diff] [blame] | 892 | EXPECT_FALSE(matchProbe(j, v)); |
| 893 | } |