blob: 1f736075b49938d45a1c406c496659897a8c5d1e [file] [log] [blame]
Brad Bishope45d8c72022-05-25 15:12:53 -04001#include "utils.hpp"
James Feist481c5d52019-08-13 14:40:40 -07002
James Feist481c5d52019-08-13 14:40:40 -07003#include <nlohmann/json.hpp>
James Feist8c505da2020-05-28 10:06:33 -07004
Brad Bishop9d2ef082020-08-26 15:17:55 -04005#include <string>
James Feist481c5d52019-08-13 14:40:40 -07006#include <variant>
7
8#include "gtest/gtest.h"
9
Brad Bishop9d2ef082020-08-26 15:17:55 -040010using namespace std::string_literals;
11
James Feist481c5d52019-08-13 14:40:40 -070012TEST(TemplateCharReplace, replaceOneInt)
13{
14 nlohmann::json j = {{"foo", "$bus"}};
15 auto it = j.begin();
Andrew Jeffery1983d2f2022-04-05 14:55:13 +093016 DBusInterface data;
James Feist481c5d52019-08-13 14:40:40 -070017 data["BUS"] = 23;
18
19 templateCharReplace(it, data, 0);
20
21 nlohmann::json expected = 23;
22 EXPECT_EQ(expected, j["foo"]);
23}
24
25TEST(TemplateCharReplace, replaceOneStr)
26{
27 nlohmann::json j = {{"foo", "$TEST"}};
28 auto it = j.begin();
Andrew Jeffery1983d2f2022-04-05 14:55:13 +093029 DBusInterface data;
James Feist481c5d52019-08-13 14:40:40 -070030 data["TEST"] = std::string("Test");
31
32 templateCharReplace(it, data, 0);
33
34 nlohmann::json expected = "Test";
35 EXPECT_EQ(expected, j["foo"]);
36}
37
38TEST(TemplateCharReplace, replaceSecondStr)
39{
40 nlohmann::json j = {{"foo", "the $TEST"}};
41 auto it = j.begin();
Andrew Jeffery1983d2f2022-04-05 14:55:13 +093042 DBusInterface data;
James Feist481c5d52019-08-13 14:40:40 -070043 data["TEST"] = std::string("Test");
44
45 templateCharReplace(it, data, 0);
46
47 nlohmann::json expected = "the Test";
48 EXPECT_EQ(expected, j["foo"]);
49}
50
James Feist481c5d52019-08-13 14:40:40 -070051TEST(TemplateCharReplace, replaceMiddleStr)
52{
53 nlohmann::json j = {{"foo", "the $TEST worked"}};
54 auto it = j.begin();
Andrew Jeffery1983d2f2022-04-05 14:55:13 +093055 DBusInterface data;
James Feist481c5d52019-08-13 14:40:40 -070056 data["TEST"] = std::string("Test");
57
58 templateCharReplace(it, data, 0);
59
60 nlohmann::json expected = "the Test worked";
61 EXPECT_EQ(expected, j["foo"]);
62}
James Feist481c5d52019-08-13 14:40:40 -070063
64TEST(TemplateCharReplace, replaceLastStr)
65{
66 nlohmann::json j = {{"foo", "the Test $TEST"}};
67 auto it = j.begin();
Andrew Jeffery1983d2f2022-04-05 14:55:13 +093068 DBusInterface data;
James Feist481c5d52019-08-13 14:40:40 -070069 data["TEST"] = 23;
70
71 templateCharReplace(it, data, 0);
72
73 nlohmann::json expected = "the Test 23";
74 EXPECT_EQ(expected, j["foo"]);
75}
76
77TEST(TemplateCharReplace, increment)
78{
79 nlohmann::json j = {{"foo", "3 plus 1 equals $TEST + 1"}};
80 auto it = j.begin();
Andrew Jeffery1983d2f2022-04-05 14:55:13 +093081 DBusInterface data;
James Feist481c5d52019-08-13 14:40:40 -070082 data["TEST"] = 3;
83
84 templateCharReplace(it, data, 0);
85
86 nlohmann::json expected = "3 plus 1 equals 4";
87 EXPECT_EQ(expected, j["foo"]);
88}
89
90TEST(TemplateCharReplace, decrement)
91{
92 nlohmann::json j = {{"foo", "3 minus 1 equals $TEST - 1 !"}};
93 auto it = j.begin();
Andrew Jeffery1983d2f2022-04-05 14:55:13 +093094 DBusInterface data;
James Feist481c5d52019-08-13 14:40:40 -070095 data["TEST"] = 3;
96
97 templateCharReplace(it, data, 0);
98
99 nlohmann::json expected = "3 minus 1 equals 2 !";
100 EXPECT_EQ(expected, j["foo"]);
101}
102
103TEST(TemplateCharReplace, modulus)
104{
105 nlohmann::json j = {{"foo", "3 mod 2 equals $TEST % 2"}};
106 auto it = j.begin();
Andrew Jeffery1983d2f2022-04-05 14:55:13 +0930107 DBusInterface data;
James Feist481c5d52019-08-13 14:40:40 -0700108 data["TEST"] = 3;
109
110 templateCharReplace(it, data, 0);
111
112 nlohmann::json expected = "3 mod 2 equals 1";
113 EXPECT_EQ(expected, j["foo"]);
114}
115
116TEST(TemplateCharReplace, multiply)
117{
118 nlohmann::json j = {{"foo", "3 * 2 equals $TEST * 2"}};
119 auto it = j.begin();
Andrew Jeffery1983d2f2022-04-05 14:55:13 +0930120 DBusInterface data;
James Feist481c5d52019-08-13 14:40:40 -0700121 data["TEST"] = 3;
122
123 templateCharReplace(it, data, 0);
124
125 nlohmann::json expected = "3 * 2 equals 6";
126 EXPECT_EQ(expected, j["foo"]);
127}
128
129TEST(TemplateCharReplace, divide)
130{
131 nlohmann::json j = {{"foo", "4 / 2 equals $TEST / 2"}};
132 auto it = j.begin();
Andrew Jeffery1983d2f2022-04-05 14:55:13 +0930133 DBusInterface data;
James Feist481c5d52019-08-13 14:40:40 -0700134 data["TEST"] = 4;
135
136 templateCharReplace(it, data, 0);
137
138 nlohmann::json expected = "4 / 2 equals 2";
139 EXPECT_EQ(expected, j["foo"]);
James Feist8c20feb2019-08-14 15:10:11 -0700140}
141
142TEST(TemplateCharReplace, multiMath)
143{
144 nlohmann::json j = {{"foo", "4 * 2 % 6 equals $TEST * 2 % 6"}};
145 auto it = j.begin();
Andrew Jeffery1983d2f2022-04-05 14:55:13 +0930146 DBusInterface data;
James Feist8c20feb2019-08-14 15:10:11 -0700147 data["TEST"] = 4;
148
149 templateCharReplace(it, data, 0);
150
151 nlohmann::json expected = "4 * 2 % 6 equals 2";
152 EXPECT_EQ(expected, j["foo"]);
153}
154
155TEST(TemplateCharReplace, twoReplacements)
156{
157 nlohmann::json j = {{"foo", "$FOO $BAR"}};
158 auto it = j.begin();
Andrew Jeffery1983d2f2022-04-05 14:55:13 +0930159 DBusInterface data;
James Feist8c20feb2019-08-14 15:10:11 -0700160 data["FOO"] = std::string("foo");
161 data["BAR"] = std::string("bar");
162
163 templateCharReplace(it, data, 0);
164
165 nlohmann::json expected = "foo bar";
166 EXPECT_EQ(expected, j["foo"]);
167}
168
169TEST(TemplateCharReplace, twoReplacementsWithMath)
170{
171 nlohmann::json j = {{"foo", "4 / 2 equals $TEST / 2 $BAR"}};
172 auto it = j.begin();
Andrew Jeffery1983d2f2022-04-05 14:55:13 +0930173 DBusInterface data;
James Feist8c20feb2019-08-14 15:10:11 -0700174 data["TEST"] = 4;
175 data["BAR"] = std::string("bar");
176
177 templateCharReplace(it, data, 0);
178
179 nlohmann::json expected = "4 / 2 equals 2 bar";
Zhikui Rena0d1b3f2021-10-05 16:21:56 -0700180}
181
182TEST(TemplateCharReplace, twoReplacementsWithMath2)
183{
184 nlohmann::json j = {{"foo", "4 / 2 equals $ADDRESS / 2 $BAR"}};
185 auto it = j.begin();
Andrew Jeffery1983d2f2022-04-05 14:55:13 +0930186 DBusInterface data;
Zhikui Rena0d1b3f2021-10-05 16:21:56 -0700187 data["ADDRESS"] = 4;
188 data["BAR"] = std::string("bar");
189
190 templateCharReplace(it, data, 0);
191
192 nlohmann::json expected = "4 / 2 equals 2 bar";
James Feist8c20feb2019-08-14 15:10:11 -0700193 EXPECT_EQ(expected, j["foo"]);
James Feistb0097d42019-08-15 09:24:13 -0700194}
195
196TEST(TemplateCharReplace, hexAndWrongCase)
197{
198 nlohmann::json j = {{"Address", "0x54"},
199 {"Bus", 15},
200 {"Name", "$bus sensor 0"},
201 {"Type", "SomeType"}};
202
Andrew Jeffery1983d2f2022-04-05 14:55:13 +0930203 DBusInterface data;
James Feistb0097d42019-08-15 09:24:13 -0700204 data["BUS"] = 15;
205
206 for (auto it = j.begin(); it != j.end(); it++)
207 {
208 templateCharReplace(it, data, 0);
209 }
210 nlohmann::json expected = {{"Address", 84},
211 {"Bus", 15},
212 {"Name", "15 sensor 0"},
213 {"Type", "SomeType"}};
214 EXPECT_EQ(expected, j);
215}
216
217TEST(TemplateCharReplace, replaceSecondAsInt)
218{
219 nlohmann::json j = {{"foo", "twelve is $TEST"}};
220 auto it = j.begin();
Andrew Jeffery1983d2f2022-04-05 14:55:13 +0930221 DBusInterface data;
James Feistb0097d42019-08-15 09:24:13 -0700222 data["test"] = 12;
223
224 templateCharReplace(it, data, 0);
225
226 nlohmann::json expected = "twelve is 12";
227 EXPECT_EQ(expected, j["foo"]);
228}
James Feistc296c802019-08-28 09:26:47 -0700229
230TEST(TemplateCharReplace, singleHex)
231{
232 nlohmann::json j = {{"foo", "0x54"}};
233 auto it = j.begin();
Andrew Jeffery1983d2f2022-04-05 14:55:13 +0930234 DBusInterface data;
James Feistc296c802019-08-28 09:26:47 -0700235
236 templateCharReplace(it, data, 0);
237
238 nlohmann::json expected = 84;
239 EXPECT_EQ(expected, j["foo"]);
240}
Brad Bishop9d2ef082020-08-26 15:17:55 -0400241
242TEST(MatchProbe, stringEqString)
243{
244 nlohmann::json j = R"("foo")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930245 DBusValueVariant v = "foo"s;
Brad Bishop9d2ef082020-08-26 15:17:55 -0400246 EXPECT_TRUE(matchProbe(j, v));
247}
248
249TEST(MatchProbe, stringRegexEqString)
250{
251 nlohmann::json j = R"("foo*")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930252 DBusValueVariant v = "foobar"s;
Brad Bishop9d2ef082020-08-26 15:17:55 -0400253 EXPECT_TRUE(matchProbe(j, v));
254}
255
256TEST(MatchProbe, stringNeqString)
257{
258 nlohmann::json j = R"("foobar")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930259 DBusValueVariant v = "foo"s;
Brad Bishop9d2ef082020-08-26 15:17:55 -0400260 EXPECT_FALSE(matchProbe(j, v));
261}
262
263TEST(MatchProbe, stringRegexError)
264{
265 nlohmann::json j = R"("foo[")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930266 DBusValueVariant v = "foobar"s;
Brad Bishop5d525412020-08-26 08:50:50 -0400267 EXPECT_FALSE(matchProbe(j, v));
Brad Bishop9d2ef082020-08-26 15:17:55 -0400268}
269
Patrick Rudolph1c39d7b2023-09-21 15:50:20 +0200270TEST(MatchProbe, stringRegexNotPrefix)
271{
272 nlohmann::json j = R"("foo(?!bar)...foo")"_json;
273 DBusValueVariant v1 = "foobarfoo"s;
274 DBusValueVariant v2 = "foofoofoo"s;
275 EXPECT_FALSE(matchProbe(j, v1));
276 EXPECT_TRUE(matchProbe(j, v2));
277}
278
Brad Bishop5d525412020-08-26 08:50:50 -0400279TEST(MatchProbe, stringZeroNeqFalse)
Brad Bishop9d2ef082020-08-26 15:17:55 -0400280{
281 nlohmann::json j = R"("0")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930282 DBusValueVariant v = false;
Brad Bishop5d525412020-08-26 08:50:50 -0400283 EXPECT_FALSE(matchProbe(j, v));
Brad Bishop9d2ef082020-08-26 15:17:55 -0400284}
285
Brad Bishop5d525412020-08-26 08:50:50 -0400286TEST(MatchProbe, stringOneNeqTrue)
Brad Bishop9d2ef082020-08-26 15:17:55 -0400287{
288 nlohmann::json j = R"("1")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930289 DBusValueVariant v = true;
Brad Bishop5d525412020-08-26 08:50:50 -0400290 EXPECT_FALSE(matchProbe(j, v));
Brad Bishop9d2ef082020-08-26 15:17:55 -0400291}
292
293TEST(MatchProbe, stringElevenNeqTrue)
294{
295 nlohmann::json j = R"("11")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930296 DBusValueVariant v = true;
Brad Bishop9d2ef082020-08-26 15:17:55 -0400297 EXPECT_FALSE(matchProbe(j, v));
298}
299
300TEST(MatchProbe, stringFalseNeqFalse)
301{
302 nlohmann::json j = R"("false")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930303 DBusValueVariant v = false;
Brad Bishop9d2ef082020-08-26 15:17:55 -0400304 EXPECT_FALSE(matchProbe(j, v));
305}
306
307TEST(MatchProbe, stringTrueNeqTrue)
308{
309 nlohmann::json j = R"("true")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930310 DBusValueVariant v = true;
Brad Bishop9d2ef082020-08-26 15:17:55 -0400311 EXPECT_FALSE(matchProbe(j, v));
312}
313
314TEST(MatchProbe, stringFalseNeqTrue)
315{
316 nlohmann::json j = R"("false")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930317 DBusValueVariant v = true;
Brad Bishop9d2ef082020-08-26 15:17:55 -0400318 EXPECT_FALSE(matchProbe(j, v));
319}
320
Brad Bishop5d525412020-08-26 08:50:50 -0400321TEST(MatchProbe, stringNeqUint8)
Brad Bishop9d2ef082020-08-26 15:17:55 -0400322{
323 nlohmann::json j = R"("255")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930324 DBusValueVariant v = uint8_t(255);
Brad Bishop5d525412020-08-26 08:50:50 -0400325 EXPECT_FALSE(matchProbe(j, v));
Brad Bishop9d2ef082020-08-26 15:17:55 -0400326}
327
328TEST(MatchProbe, stringNeqUint8Overflow)
329{
330 nlohmann::json j = R"("65535")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930331 DBusValueVariant v = uint8_t(255);
Brad Bishop9d2ef082020-08-26 15:17:55 -0400332 EXPECT_FALSE(matchProbe(j, v));
333}
334
335TEST(MatchProbe, stringFalseNeqUint8Zero)
336{
337 nlohmann::json j = R"("false")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930338 DBusValueVariant v = uint8_t(0);
Brad Bishop9d2ef082020-08-26 15:17:55 -0400339 EXPECT_FALSE(matchProbe(j, v));
340}
341
342TEST(MatchProbe, stringTrueNeqUint8Zero)
343{
344 nlohmann::json j = R"("true")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930345 DBusValueVariant v = uint8_t(1);
Brad Bishop9d2ef082020-08-26 15:17:55 -0400346 EXPECT_FALSE(matchProbe(j, v));
347}
348
Brad Bishop5d525412020-08-26 08:50:50 -0400349TEST(MatchProbe, stringNeqUint32)
Brad Bishop9d2ef082020-08-26 15:17:55 -0400350{
351 nlohmann::json j = R"("11")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930352 DBusValueVariant v = uint32_t(11);
Brad Bishop9d2ef082020-08-26 15:17:55 -0400353 EXPECT_FALSE(matchProbe(j, v));
354}
355
Brad Bishop9d2ef082020-08-26 15:17:55 -0400356TEST(MatchProbe, stringNeqInt32)
357{
Brad Bishop5d525412020-08-26 08:50:50 -0400358 nlohmann::json j = R"("-11")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930359 DBusValueVariant v = int32_t(-11);
Brad Bishop9d2ef082020-08-26 15:17:55 -0400360 EXPECT_FALSE(matchProbe(j, v));
361}
362
Brad Bishop5d525412020-08-26 08:50:50 -0400363TEST(MatchProbe, stringRegexNeqInt32)
Brad Bishop9d2ef082020-08-26 15:17:55 -0400364{
365 nlohmann::json j = R"("1*4")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930366 DBusValueVariant v = int32_t(124);
Brad Bishop5d525412020-08-26 08:50:50 -0400367 EXPECT_FALSE(matchProbe(j, v));
Brad Bishop9d2ef082020-08-26 15:17:55 -0400368}
369
370TEST(MatchProbe, stringNeqUint64)
371{
372 nlohmann::json j = R"("foo")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930373 DBusValueVariant v = uint64_t(65535);
Brad Bishop9d2ef082020-08-26 15:17:55 -0400374 EXPECT_FALSE(matchProbe(j, v));
375}
376
Brad Bishop9d2ef082020-08-26 15:17:55 -0400377TEST(MatchProbe, stringNeqDouble)
378{
Brad Bishop5d525412020-08-26 08:50:50 -0400379 nlohmann::json j = R"("123.4")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930380 DBusValueVariant v = double(123.4);
Brad Bishop9d2ef082020-08-26 15:17:55 -0400381 EXPECT_FALSE(matchProbe(j, v));
382}
383
384TEST(MatchProbe, stringNeqEmpty)
385{
386 nlohmann::json j = R"("-123.4")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930387 DBusValueVariant v;
Brad Bishop9d2ef082020-08-26 15:17:55 -0400388 EXPECT_FALSE(matchProbe(j, v));
389}
Brad Bishopc5eba592020-08-28 10:38:24 -0400390
Brad Bishopcd1868e2020-08-28 17:58:52 -0400391TEST(MatchProbe, stringNeqArray)
392{
393 nlohmann::json j = R"("-123.4")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930394 DBusValueVariant v = std::vector<uint8_t>{1, 2};
Brad Bishopcd1868e2020-08-28 17:58:52 -0400395 EXPECT_FALSE(matchProbe(j, v));
396}
397
Brad Bishop5d525412020-08-26 08:50:50 -0400398TEST(MatchProbe, boolNeqString)
Brad Bishopc5eba592020-08-28 10:38:24 -0400399{
400 nlohmann::json j = R"(false)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930401 DBusValueVariant v = "false"s;
Brad Bishop5d525412020-08-26 08:50:50 -0400402 EXPECT_FALSE(matchProbe(j, v));
Brad Bishopc5eba592020-08-28 10:38:24 -0400403}
404
405TEST(MatchProbe, trueEqTrue)
406{
407 nlohmann::json j = R"(true)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930408 DBusValueVariant v = true;
Brad Bishopc5eba592020-08-28 10:38:24 -0400409 EXPECT_TRUE(matchProbe(j, v));
410}
411
412TEST(MatchProbe, falseEqFalse)
413{
414 nlohmann::json j = R"(false)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930415 DBusValueVariant v = false;
Brad Bishopc5eba592020-08-28 10:38:24 -0400416 EXPECT_TRUE(matchProbe(j, v));
417}
418
419TEST(MatchProbe, trueNeqFalse)
420{
421 nlohmann::json j = R"(true)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930422 DBusValueVariant v = false;
Brad Bishopc5eba592020-08-28 10:38:24 -0400423 EXPECT_FALSE(matchProbe(j, v));
424}
425
426TEST(MatchProbe, trueNeqInt32Zero)
427{
428 nlohmann::json j = R"(true)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930429 DBusValueVariant v = int32_t(0);
Brad Bishopc5eba592020-08-28 10:38:24 -0400430 EXPECT_FALSE(matchProbe(j, v));
431}
432
433TEST(MatchProbe, trueNeqInt32NegativeOne)
434{
435 nlohmann::json j = R"(true)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930436 DBusValueVariant v = int32_t(-1);
Brad Bishopc5eba592020-08-28 10:38:24 -0400437 EXPECT_FALSE(matchProbe(j, v));
438}
439
440TEST(MatchProbe, falseNeqUint32One)
441{
442 nlohmann::json j = R"(false)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930443 DBusValueVariant v = uint32_t(1);
Brad Bishopc5eba592020-08-28 10:38:24 -0400444 EXPECT_FALSE(matchProbe(j, v));
445}
446
Brad Bishop5d525412020-08-26 08:50:50 -0400447TEST(MatchProbe, falseNeqUint32Zero)
Brad Bishopc5eba592020-08-28 10:38:24 -0400448{
449 nlohmann::json j = R"(false)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930450 DBusValueVariant v = uint32_t(0);
Brad Bishop5d525412020-08-26 08:50:50 -0400451 EXPECT_FALSE(matchProbe(j, v));
Brad Bishopc5eba592020-08-28 10:38:24 -0400452}
453
454TEST(MatchProbe, trueNeqDoubleNegativeOne)
455{
456 nlohmann::json j = R"(true)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930457 DBusValueVariant v = double(-1.1);
Brad Bishopc5eba592020-08-28 10:38:24 -0400458 EXPECT_FALSE(matchProbe(j, v));
459}
460
Brad Bishop5d525412020-08-26 08:50:50 -0400461TEST(MatchProbe, trueNeqDoubleOne)
Brad Bishopc5eba592020-08-28 10:38:24 -0400462{
463 nlohmann::json j = R"(true)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930464 DBusValueVariant v = double(1.0);
Brad Bishop5d525412020-08-26 08:50:50 -0400465 EXPECT_FALSE(matchProbe(j, v));
Brad Bishopc5eba592020-08-28 10:38:24 -0400466}
467
468TEST(MatchProbe, falseNeqDoubleOne)
469{
470 nlohmann::json j = R"(false)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930471 DBusValueVariant v = double(1.0);
Brad Bishopc5eba592020-08-28 10:38:24 -0400472 EXPECT_FALSE(matchProbe(j, v));
473}
474
Brad Bishop5d525412020-08-26 08:50:50 -0400475TEST(MatchProbe, falseNeqDoubleZero)
Brad Bishopc5eba592020-08-28 10:38:24 -0400476{
477 nlohmann::json j = R"(false)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930478 DBusValueVariant v = double(0.0);
Brad Bishop5d525412020-08-26 08:50:50 -0400479 EXPECT_FALSE(matchProbe(j, v));
Brad Bishopc5eba592020-08-28 10:38:24 -0400480}
481
Brad Bishop5d525412020-08-26 08:50:50 -0400482TEST(MatchProbe, falseNeqEmpty)
Brad Bishopc5eba592020-08-28 10:38:24 -0400483{
484 nlohmann::json j = R"(false)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930485 DBusValueVariant v;
Brad Bishop5d525412020-08-26 08:50:50 -0400486 EXPECT_FALSE(matchProbe(j, v));
Brad Bishopc5eba592020-08-28 10:38:24 -0400487}
488
Brad Bishop5d525412020-08-26 08:50:50 -0400489TEST(MatchProbe, trueNeqEmpty)
Brad Bishopc5eba592020-08-28 10:38:24 -0400490{
491 nlohmann::json j = R"(true)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930492 DBusValueVariant v;
Brad Bishop5d525412020-08-26 08:50:50 -0400493 EXPECT_FALSE(matchProbe(j, v));
Brad Bishopc5eba592020-08-28 10:38:24 -0400494}
Brad Bishopc2af5312020-08-28 10:39:49 -0400495
Brad Bishopcd1868e2020-08-28 17:58:52 -0400496TEST(MatchProbe, trueNeqArray)
497{
498 nlohmann::json j = R"(true)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930499 DBusValueVariant v = std::vector<uint8_t>{1, 2};
Brad Bishopcd1868e2020-08-28 17:58:52 -0400500 EXPECT_FALSE(matchProbe(j, v));
501}
502
Brad Bishop5d525412020-08-26 08:50:50 -0400503TEST(MatchProbe, uintNeqString)
Brad Bishopc2af5312020-08-28 10:39:49 -0400504{
505 nlohmann::json j = R"(11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930506 DBusValueVariant v = "11"s;
Brad Bishop5d525412020-08-26 08:50:50 -0400507 EXPECT_FALSE(matchProbe(j, v));
Brad Bishopc2af5312020-08-28 10:39:49 -0400508}
509
510TEST(MatchProbe, uintNeqTrue)
511{
Brad Bishop5d525412020-08-26 08:50:50 -0400512 nlohmann::json j = R"(1)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930513 DBusValueVariant v = true;
Brad Bishopc2af5312020-08-28 10:39:49 -0400514 EXPECT_FALSE(matchProbe(j, v));
515}
516
Brad Bishop5d525412020-08-26 08:50:50 -0400517TEST(MatchProbe, uintNeqFalse)
518{
519 nlohmann::json j = R"(0)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930520 DBusValueVariant v = false;
Brad Bishop5d525412020-08-26 08:50:50 -0400521 EXPECT_FALSE(matchProbe(j, v));
522}
523
Brad Bishopc2af5312020-08-28 10:39:49 -0400524TEST(MatchProbe, uintEqUint8)
525{
526 nlohmann::json j = R"(11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930527 DBusValueVariant v = uint8_t(11);
Brad Bishopc2af5312020-08-28 10:39:49 -0400528 EXPECT_TRUE(matchProbe(j, v));
529}
530
531TEST(MatchProbe, uintNeqUint8)
532{
533 nlohmann::json j = R"(11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930534 DBusValueVariant v = uint8_t(12);
Brad Bishopc2af5312020-08-28 10:39:49 -0400535 EXPECT_FALSE(matchProbe(j, v));
536}
537
538TEST(MatchProbe, uintNeqUint8Overflow)
539{
540 nlohmann::json j = R"(65535)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930541 DBusValueVariant v = uint8_t(255);
Brad Bishopc2af5312020-08-28 10:39:49 -0400542 EXPECT_FALSE(matchProbe(j, v));
543}
544
545TEST(MatchProbe, uintEqInt8)
546{
547 nlohmann::json j = R"(11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930548 DBusValueVariant v = int8_t(11);
Brad Bishopc2af5312020-08-28 10:39:49 -0400549 EXPECT_TRUE(matchProbe(j, v));
550}
551
552TEST(MatchProbe, uintEqDouble)
553{
554 nlohmann::json j = R"(11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930555 DBusValueVariant v = double(11.0);
Brad Bishopc2af5312020-08-28 10:39:49 -0400556 EXPECT_TRUE(matchProbe(j, v));
557}
558
Brad Bishop5d525412020-08-26 08:50:50 -0400559TEST(MatchProbe, uintNeqDouble)
Brad Bishopc2af5312020-08-28 10:39:49 -0400560{
561 nlohmann::json j = R"(11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930562 DBusValueVariant v = double(11.7);
Brad Bishop5d525412020-08-26 08:50:50 -0400563 EXPECT_FALSE(matchProbe(j, v));
Brad Bishopc2af5312020-08-28 10:39:49 -0400564}
565
Brad Bishop5d525412020-08-26 08:50:50 -0400566TEST(MatchProbe, uintNeqEmpty)
Brad Bishopc2af5312020-08-28 10:39:49 -0400567{
568 nlohmann::json j = R"(11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930569 DBusValueVariant v;
Brad Bishop5d525412020-08-26 08:50:50 -0400570 EXPECT_FALSE(matchProbe(j, v));
Brad Bishopc2af5312020-08-28 10:39:49 -0400571}
Brad Bishop667e0502020-08-28 10:41:40 -0400572
Brad Bishopcd1868e2020-08-28 17:58:52 -0400573TEST(MatchProbe, uintNeqArray)
574{
575 nlohmann::json j = R"(11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930576 DBusValueVariant v = std::vector<uint8_t>{11};
Brad Bishopcd1868e2020-08-28 17:58:52 -0400577 EXPECT_FALSE(matchProbe(j, v));
578}
579
Brad Bishop5d525412020-08-26 08:50:50 -0400580TEST(MatchProbe, intNeqString)
Brad Bishop667e0502020-08-28 10:41:40 -0400581{
582 nlohmann::json j = R"(-11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930583 DBusValueVariant v = "-11"s;
Brad Bishop5d525412020-08-26 08:50:50 -0400584 EXPECT_FALSE(matchProbe(j, v));
Brad Bishop667e0502020-08-28 10:41:40 -0400585}
586
587TEST(MatchProbe, intNeqTrue)
588{
589 nlohmann::json j = R"(-1)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930590 DBusValueVariant v = true;
Brad Bishop667e0502020-08-28 10:41:40 -0400591 EXPECT_FALSE(matchProbe(j, v));
592}
593
594TEST(MatchProbe, intNeqUint8)
595{
596 nlohmann::json j = R"(-11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930597 DBusValueVariant v = uint8_t(11);
Brad Bishop667e0502020-08-28 10:41:40 -0400598 EXPECT_FALSE(matchProbe(j, v));
599}
600
601TEST(MatchProbe, intEqInt8)
602{
603 nlohmann::json j = R"(-11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930604 DBusValueVariant v = int8_t(-11);
Brad Bishop667e0502020-08-28 10:41:40 -0400605 EXPECT_TRUE(matchProbe(j, v));
606}
607
608TEST(MatchProbe, intNeqDouble)
609{
610 nlohmann::json j = R"(-124)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930611 DBusValueVariant v = double(-123.0);
Brad Bishop667e0502020-08-28 10:41:40 -0400612 EXPECT_FALSE(matchProbe(j, v));
613}
614
615TEST(MatchProbe, intEqDouble)
616{
617 nlohmann::json j = R"(-11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930618 DBusValueVariant v = double(-11.0);
Brad Bishop667e0502020-08-28 10:41:40 -0400619 EXPECT_TRUE(matchProbe(j, v));
620}
621
Brad Bishop5d525412020-08-26 08:50:50 -0400622TEST(MatchProbe, intNeqDoubleRound)
Brad Bishop667e0502020-08-28 10:41:40 -0400623{
624 nlohmann::json j = R"(-11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930625 DBusValueVariant v = double(-11.7);
Brad Bishop5d525412020-08-26 08:50:50 -0400626 EXPECT_FALSE(matchProbe(j, v));
Brad Bishop667e0502020-08-28 10:41:40 -0400627}
628
Brad Bishop5d525412020-08-26 08:50:50 -0400629TEST(MatchProbe, intNeqEmpty)
Brad Bishop667e0502020-08-28 10:41:40 -0400630{
631 nlohmann::json j = R"(-11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930632 DBusValueVariant v;
Brad Bishop5d525412020-08-26 08:50:50 -0400633 EXPECT_FALSE(matchProbe(j, v));
Brad Bishop667e0502020-08-28 10:41:40 -0400634}
Brad Bishop3bd8e8d2020-08-28 10:42:27 -0400635
Brad Bishopcd1868e2020-08-28 17:58:52 -0400636TEST(MatchProbe, intNeqArray)
637{
638 nlohmann::json j = R"(-11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930639 DBusValueVariant v = std::vector<uint8_t>{11};
Brad Bishopcd1868e2020-08-28 17:58:52 -0400640 EXPECT_FALSE(matchProbe(j, v));
641}
642
Brad Bishop5d525412020-08-26 08:50:50 -0400643TEST(MatchProbe, doubleNeqString)
Brad Bishop3bd8e8d2020-08-28 10:42:27 -0400644{
645 nlohmann::json j = R"(0.0)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930646 DBusValueVariant v = "0.0"s;
Brad Bishop5d525412020-08-26 08:50:50 -0400647 EXPECT_FALSE(matchProbe(j, v));
Brad Bishop3bd8e8d2020-08-28 10:42:27 -0400648}
649
Brad Bishop5d525412020-08-26 08:50:50 -0400650TEST(MatchProbe, doubleNeqFalse)
Brad Bishop3bd8e8d2020-08-28 10:42:27 -0400651{
652 nlohmann::json j = R"(0.0)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930653 DBusValueVariant v = false;
Brad Bishop5d525412020-08-26 08:50:50 -0400654 EXPECT_FALSE(matchProbe(j, v));
Brad Bishop3bd8e8d2020-08-28 10:42:27 -0400655}
656
657TEST(MatchProbe, doubleNeqTrue)
658{
Brad Bishop3bd8e8d2020-08-28 10:42:27 -0400659 nlohmann::json j = R"(1.0)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930660 DBusValueVariant v = true;
Brad Bishop5d525412020-08-26 08:50:50 -0400661 EXPECT_FALSE(matchProbe(j, v));
Brad Bishop3bd8e8d2020-08-28 10:42:27 -0400662}
663
664TEST(MatchProbe, doubleEqInt32)
665{
666 nlohmann::json j = R"(-124.0)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930667 DBusValueVariant v = int32_t(-124);
Brad Bishop3bd8e8d2020-08-28 10:42:27 -0400668 EXPECT_TRUE(matchProbe(j, v));
669}
670
671TEST(MatchProbe, doubleNeqInt32)
672{
673 nlohmann::json j = R"(-124.0)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930674 DBusValueVariant v = int32_t(-123);
Brad Bishop3bd8e8d2020-08-28 10:42:27 -0400675 EXPECT_FALSE(matchProbe(j, v));
676}
677
678TEST(MatchProbe, doubleRoundNeqInt)
679{
680 nlohmann::json j = R"(124.7)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930681 DBusValueVariant v = int32_t(124);
Brad Bishop3bd8e8d2020-08-28 10:42:27 -0400682 EXPECT_FALSE(matchProbe(j, v));
683}
684TEST(MatchProbe, doubleEqDouble)
685{
686 nlohmann::json j = R"(-124.2)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930687 DBusValueVariant v = double(-124.2);
Brad Bishop3bd8e8d2020-08-28 10:42:27 -0400688 EXPECT_TRUE(matchProbe(j, v));
689}
690
691TEST(MatchProbe, doubleNeqDouble)
692{
693 nlohmann::json j = R"(-124.3)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930694 DBusValueVariant v = double(-124.2);
Brad Bishop3bd8e8d2020-08-28 10:42:27 -0400695 EXPECT_FALSE(matchProbe(j, v));
696}
697
Brad Bishop5d525412020-08-26 08:50:50 -0400698TEST(MatchProbe, doubleNeqEmpty)
Brad Bishop3bd8e8d2020-08-28 10:42:27 -0400699{
700 nlohmann::json j = R"(-11.0)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930701 DBusValueVariant v;
Brad Bishop5d525412020-08-26 08:50:50 -0400702 EXPECT_FALSE(matchProbe(j, v));
Brad Bishop3bd8e8d2020-08-28 10:42:27 -0400703}
Brad Bishopd14c2e22020-08-28 10:43:40 -0400704
Brad Bishopcd1868e2020-08-28 17:58:52 -0400705TEST(MatchProbe, doubleNeqArray)
706{
707 nlohmann::json j = R"(-11.2)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930708 DBusValueVariant v = std::vector<uint8_t>{11};
Brad Bishopcd1868e2020-08-28 17:58:52 -0400709 EXPECT_FALSE(matchProbe(j, v));
710}
711
Brad Bishopd14c2e22020-08-28 10:43:40 -0400712TEST(MatchProbe, arrayNeqString)
713{
714 nlohmann::json j = R"([1, 2])"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930715 DBusValueVariant v = "hello"s;
Brad Bishopd14c2e22020-08-28 10:43:40 -0400716 EXPECT_FALSE(matchProbe(j, v));
717}
718
719TEST(MatchProbe, arrayNeqFalse)
720{
721 nlohmann::json j = R"([1, 2])"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930722 DBusValueVariant v = false;
Brad Bishopd14c2e22020-08-28 10:43:40 -0400723 EXPECT_FALSE(matchProbe(j, v));
724}
725
726TEST(MatchProbe, arrayNeqTrue)
727{
728 nlohmann::json j = R"([1, 2])"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930729 DBusValueVariant v = true;
Brad Bishopd14c2e22020-08-28 10:43:40 -0400730 EXPECT_FALSE(matchProbe(j, v));
731}
732
733TEST(MatchProbe, arrayNeqUint8)
734{
735 nlohmann::json j = R"([1, 2])"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930736 DBusValueVariant v = uint8_t(1);
Brad Bishopd14c2e22020-08-28 10:43:40 -0400737 EXPECT_FALSE(matchProbe(j, v));
738}
739
740TEST(MatchProbe, arrayNeqInt32)
741{
742 nlohmann::json j = R"([1, 2])"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930743 DBusValueVariant v = int32_t(-1);
Brad Bishopd14c2e22020-08-28 10:43:40 -0400744 EXPECT_FALSE(matchProbe(j, v));
745}
746
747TEST(MatchProbe, arrayNeqDouble)
748{
749 nlohmann::json j = R"([1, 2])"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930750 DBusValueVariant v = double(1.1);
Brad Bishopd14c2e22020-08-28 10:43:40 -0400751 EXPECT_FALSE(matchProbe(j, v));
752}
Brad Bishop6660e2a2020-08-28 10:44:41 -0400753
Brad Bishopcd1868e2020-08-28 17:58:52 -0400754TEST(MatchProbe, arrayEqArray)
755{
756 nlohmann::json j = R"([1, 2])"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930757 DBusValueVariant v = std::vector<uint8_t>{1, 2};
Brad Bishopcd1868e2020-08-28 17:58:52 -0400758 EXPECT_TRUE(matchProbe(j, v));
759}
760
761TEST(MatchProbe, arrayNeqArrayDiffSize1)
762{
763 nlohmann::json j = R"([1, 2, 3])"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930764 DBusValueVariant v = std::vector<uint8_t>{1, 2};
Brad Bishopcd1868e2020-08-28 17:58:52 -0400765 EXPECT_FALSE(matchProbe(j, v));
766}
767
768TEST(MatchProbe, arrayNeqArrayDiffSize2)
769{
770 nlohmann::json j = R"([1, 2])"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930771 DBusValueVariant v = std::vector<uint8_t>{1, 2, 3};
Brad Bishopcd1868e2020-08-28 17:58:52 -0400772 EXPECT_FALSE(matchProbe(j, v));
773}
774
775TEST(MatchProbe, emptyArrayEqEmptyArray)
776{
777 nlohmann::json j = R"([])"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930778 DBusValueVariant v = std::vector<uint8_t>{};
Brad Bishopcd1868e2020-08-28 17:58:52 -0400779 EXPECT_TRUE(matchProbe(j, v));
780}
781
782TEST(MatchProbe, emptyArrayNeqArray)
783{
784 nlohmann::json j = R"([])"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930785 DBusValueVariant v = std::vector<uint8_t>{1};
Brad Bishopcd1868e2020-08-28 17:58:52 -0400786 EXPECT_FALSE(matchProbe(j, v));
787}
788
789TEST(MatchProbe, arrayNeqEmptyArray)
790{
791 nlohmann::json j = R"([1])"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930792 DBusValueVariant v = std::vector<uint8_t>{};
Brad Bishopcd1868e2020-08-28 17:58:52 -0400793 EXPECT_FALSE(matchProbe(j, v));
794}
795
Brad Bishop6660e2a2020-08-28 10:44:41 -0400796TEST(MatchProbe, objNeqString)
797{
798 nlohmann::json j = R"({"foo": "bar"})"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930799 DBusValueVariant v = "hello"s;
Brad Bishop6660e2a2020-08-28 10:44:41 -0400800 EXPECT_FALSE(matchProbe(j, v));
801}
802
803TEST(MatchProbe, objNeqFalse)
804{
805 nlohmann::json j = R"({"foo": "bar"})"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930806 DBusValueVariant v = false;
Brad Bishop6660e2a2020-08-28 10:44:41 -0400807 EXPECT_FALSE(matchProbe(j, v));
808}
809
810TEST(MatchProbe, objNeqTrue)
811{
812 nlohmann::json j = R"({"foo": "bar"})"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930813 DBusValueVariant v = true;
Brad Bishop6660e2a2020-08-28 10:44:41 -0400814 EXPECT_FALSE(matchProbe(j, v));
815}
816
817TEST(MatchProbe, objNeqUint8)
818{
819 nlohmann::json j = R"({"foo": "bar"})"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930820 DBusValueVariant v = uint8_t(1);
Brad Bishop6660e2a2020-08-28 10:44:41 -0400821 EXPECT_FALSE(matchProbe(j, v));
822}
823
824TEST(MatchProbe, objNeqInt32)
825{
826 nlohmann::json j = R"({"foo": "bar"})"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930827 DBusValueVariant v = int32_t(-1);
Brad Bishop6660e2a2020-08-28 10:44:41 -0400828 EXPECT_FALSE(matchProbe(j, v));
829}
830
831TEST(MatchProbe, objNeqDouble)
832{
833 nlohmann::json j = R"({"foo": "bar"})"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930834 DBusValueVariant v = double(1.1);
Brad Bishop6660e2a2020-08-28 10:44:41 -0400835 EXPECT_FALSE(matchProbe(j, v));
836}
Brad Bishopc776c412020-08-28 10:45:25 -0400837
Brad Bishopcd1868e2020-08-28 17:58:52 -0400838TEST(MatchProbe, objNeqArray)
839{
840 nlohmann::json j = R"({"foo": "bar"})"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930841 DBusValueVariant v = std::vector<uint8_t>{1, 2};
Brad Bishopcd1868e2020-08-28 17:58:52 -0400842 EXPECT_FALSE(matchProbe(j, v));
843}
844
Brad Bishopc776c412020-08-28 10:45:25 -0400845TEST(MatchProbe, nullNeqString)
846{
847 nlohmann::json j = R"(null)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930848 DBusValueVariant v = "hello"s;
Brad Bishopc776c412020-08-28 10:45:25 -0400849 EXPECT_FALSE(matchProbe(j, v));
850}
851
852TEST(MatchProbe, nullNeqFalse)
853{
854 nlohmann::json j = R"(null)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930855 DBusValueVariant v = false;
Brad Bishopc776c412020-08-28 10:45:25 -0400856 EXPECT_FALSE(matchProbe(j, v));
857}
858
859TEST(MatchProbe, nullNeqTrue)
860{
861 nlohmann::json j = R"(null)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930862 DBusValueVariant v = true;
Brad Bishopc776c412020-08-28 10:45:25 -0400863 EXPECT_FALSE(matchProbe(j, v));
864}
865
866TEST(MatchProbe, nullNeqUint8)
867{
868 nlohmann::json j = R"(null)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930869 DBusValueVariant v = uint8_t(1);
Brad Bishopc776c412020-08-28 10:45:25 -0400870 EXPECT_FALSE(matchProbe(j, v));
871}
872
873TEST(MatchProbe, nullNeqInt32)
874{
875 nlohmann::json j = R"(null)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930876 DBusValueVariant v = int32_t(-1);
Brad Bishopc776c412020-08-28 10:45:25 -0400877 EXPECT_FALSE(matchProbe(j, v));
878}
879
880TEST(MatchProbe, nullNeqDouble)
881{
882 nlohmann::json j = R"(null)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930883 DBusValueVariant v = double(1.1);
Brad Bishopc776c412020-08-28 10:45:25 -0400884 EXPECT_FALSE(matchProbe(j, v));
885}
Brad Bishopcd1868e2020-08-28 17:58:52 -0400886
887TEST(MatchProbe, nullNeqArray)
888{
889 nlohmann::json j = R"(null)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930890 DBusValueVariant v = std::vector<uint8_t>{};
Brad Bishopcd1868e2020-08-28 17:58:52 -0400891 EXPECT_FALSE(matchProbe(j, v));
892}