blob: 4cd841afa3bdd9faba7e427979524c57adbd185f [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
Brad Bishop5d525412020-08-26 08:50:50 -0400270TEST(MatchProbe, stringZeroNeqFalse)
Brad Bishop9d2ef082020-08-26 15:17:55 -0400271{
272 nlohmann::json j = R"("0")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930273 DBusValueVariant v = false;
Brad Bishop5d525412020-08-26 08:50:50 -0400274 EXPECT_FALSE(matchProbe(j, v));
Brad Bishop9d2ef082020-08-26 15:17:55 -0400275}
276
Brad Bishop5d525412020-08-26 08:50:50 -0400277TEST(MatchProbe, stringOneNeqTrue)
Brad Bishop9d2ef082020-08-26 15:17:55 -0400278{
279 nlohmann::json j = R"("1")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930280 DBusValueVariant v = true;
Brad Bishop5d525412020-08-26 08:50:50 -0400281 EXPECT_FALSE(matchProbe(j, v));
Brad Bishop9d2ef082020-08-26 15:17:55 -0400282}
283
284TEST(MatchProbe, stringElevenNeqTrue)
285{
286 nlohmann::json j = R"("11")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930287 DBusValueVariant v = true;
Brad Bishop9d2ef082020-08-26 15:17:55 -0400288 EXPECT_FALSE(matchProbe(j, v));
289}
290
291TEST(MatchProbe, stringFalseNeqFalse)
292{
293 nlohmann::json j = R"("false")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930294 DBusValueVariant v = false;
Brad Bishop9d2ef082020-08-26 15:17:55 -0400295 EXPECT_FALSE(matchProbe(j, v));
296}
297
298TEST(MatchProbe, stringTrueNeqTrue)
299{
300 nlohmann::json j = R"("true")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930301 DBusValueVariant v = true;
Brad Bishop9d2ef082020-08-26 15:17:55 -0400302 EXPECT_FALSE(matchProbe(j, v));
303}
304
305TEST(MatchProbe, stringFalseNeqTrue)
306{
307 nlohmann::json j = R"("false")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930308 DBusValueVariant v = true;
Brad Bishop9d2ef082020-08-26 15:17:55 -0400309 EXPECT_FALSE(matchProbe(j, v));
310}
311
Brad Bishop5d525412020-08-26 08:50:50 -0400312TEST(MatchProbe, stringNeqUint8)
Brad Bishop9d2ef082020-08-26 15:17:55 -0400313{
314 nlohmann::json j = R"("255")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930315 DBusValueVariant v = uint8_t(255);
Brad Bishop5d525412020-08-26 08:50:50 -0400316 EXPECT_FALSE(matchProbe(j, v));
Brad Bishop9d2ef082020-08-26 15:17:55 -0400317}
318
319TEST(MatchProbe, stringNeqUint8Overflow)
320{
321 nlohmann::json j = R"("65535")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930322 DBusValueVariant v = uint8_t(255);
Brad Bishop9d2ef082020-08-26 15:17:55 -0400323 EXPECT_FALSE(matchProbe(j, v));
324}
325
326TEST(MatchProbe, stringFalseNeqUint8Zero)
327{
328 nlohmann::json j = R"("false")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930329 DBusValueVariant v = uint8_t(0);
Brad Bishop9d2ef082020-08-26 15:17:55 -0400330 EXPECT_FALSE(matchProbe(j, v));
331}
332
333TEST(MatchProbe, stringTrueNeqUint8Zero)
334{
335 nlohmann::json j = R"("true")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930336 DBusValueVariant v = uint8_t(1);
Brad Bishop9d2ef082020-08-26 15:17:55 -0400337 EXPECT_FALSE(matchProbe(j, v));
338}
339
Brad Bishop5d525412020-08-26 08:50:50 -0400340TEST(MatchProbe, stringNeqUint32)
Brad Bishop9d2ef082020-08-26 15:17:55 -0400341{
342 nlohmann::json j = R"("11")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930343 DBusValueVariant v = uint32_t(11);
Brad Bishop9d2ef082020-08-26 15:17:55 -0400344 EXPECT_FALSE(matchProbe(j, v));
345}
346
Brad Bishop9d2ef082020-08-26 15:17:55 -0400347TEST(MatchProbe, stringNeqInt32)
348{
Brad Bishop5d525412020-08-26 08:50:50 -0400349 nlohmann::json j = R"("-11")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930350 DBusValueVariant v = int32_t(-11);
Brad Bishop9d2ef082020-08-26 15:17:55 -0400351 EXPECT_FALSE(matchProbe(j, v));
352}
353
Brad Bishop5d525412020-08-26 08:50:50 -0400354TEST(MatchProbe, stringRegexNeqInt32)
Brad Bishop9d2ef082020-08-26 15:17:55 -0400355{
356 nlohmann::json j = R"("1*4")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930357 DBusValueVariant v = int32_t(124);
Brad Bishop5d525412020-08-26 08:50:50 -0400358 EXPECT_FALSE(matchProbe(j, v));
Brad Bishop9d2ef082020-08-26 15:17:55 -0400359}
360
361TEST(MatchProbe, stringNeqUint64)
362{
363 nlohmann::json j = R"("foo")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930364 DBusValueVariant v = uint64_t(65535);
Brad Bishop9d2ef082020-08-26 15:17:55 -0400365 EXPECT_FALSE(matchProbe(j, v));
366}
367
Brad Bishop9d2ef082020-08-26 15:17:55 -0400368TEST(MatchProbe, stringNeqDouble)
369{
Brad Bishop5d525412020-08-26 08:50:50 -0400370 nlohmann::json j = R"("123.4")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930371 DBusValueVariant v = double(123.4);
Brad Bishop9d2ef082020-08-26 15:17:55 -0400372 EXPECT_FALSE(matchProbe(j, v));
373}
374
375TEST(MatchProbe, stringNeqEmpty)
376{
377 nlohmann::json j = R"("-123.4")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930378 DBusValueVariant v;
Brad Bishop9d2ef082020-08-26 15:17:55 -0400379 EXPECT_FALSE(matchProbe(j, v));
380}
Brad Bishopc5eba592020-08-28 10:38:24 -0400381
Brad Bishopcd1868e2020-08-28 17:58:52 -0400382TEST(MatchProbe, stringNeqArray)
383{
384 nlohmann::json j = R"("-123.4")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930385 DBusValueVariant v = std::vector<uint8_t>{1, 2};
Brad Bishopcd1868e2020-08-28 17:58:52 -0400386 EXPECT_FALSE(matchProbe(j, v));
387}
388
Brad Bishop5d525412020-08-26 08:50:50 -0400389TEST(MatchProbe, boolNeqString)
Brad Bishopc5eba592020-08-28 10:38:24 -0400390{
391 nlohmann::json j = R"(false)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930392 DBusValueVariant v = "false"s;
Brad Bishop5d525412020-08-26 08:50:50 -0400393 EXPECT_FALSE(matchProbe(j, v));
Brad Bishopc5eba592020-08-28 10:38:24 -0400394}
395
396TEST(MatchProbe, trueEqTrue)
397{
398 nlohmann::json j = R"(true)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930399 DBusValueVariant v = true;
Brad Bishopc5eba592020-08-28 10:38:24 -0400400 EXPECT_TRUE(matchProbe(j, v));
401}
402
403TEST(MatchProbe, falseEqFalse)
404{
405 nlohmann::json j = R"(false)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930406 DBusValueVariant v = false;
Brad Bishopc5eba592020-08-28 10:38:24 -0400407 EXPECT_TRUE(matchProbe(j, v));
408}
409
410TEST(MatchProbe, trueNeqFalse)
411{
412 nlohmann::json j = R"(true)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930413 DBusValueVariant v = false;
Brad Bishopc5eba592020-08-28 10:38:24 -0400414 EXPECT_FALSE(matchProbe(j, v));
415}
416
417TEST(MatchProbe, trueNeqInt32Zero)
418{
419 nlohmann::json j = R"(true)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930420 DBusValueVariant v = int32_t(0);
Brad Bishopc5eba592020-08-28 10:38:24 -0400421 EXPECT_FALSE(matchProbe(j, v));
422}
423
424TEST(MatchProbe, trueNeqInt32NegativeOne)
425{
426 nlohmann::json j = R"(true)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930427 DBusValueVariant v = int32_t(-1);
Brad Bishopc5eba592020-08-28 10:38:24 -0400428 EXPECT_FALSE(matchProbe(j, v));
429}
430
431TEST(MatchProbe, falseNeqUint32One)
432{
433 nlohmann::json j = R"(false)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930434 DBusValueVariant v = uint32_t(1);
Brad Bishopc5eba592020-08-28 10:38:24 -0400435 EXPECT_FALSE(matchProbe(j, v));
436}
437
Brad Bishop5d525412020-08-26 08:50:50 -0400438TEST(MatchProbe, falseNeqUint32Zero)
Brad Bishopc5eba592020-08-28 10:38:24 -0400439{
440 nlohmann::json j = R"(false)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930441 DBusValueVariant v = uint32_t(0);
Brad Bishop5d525412020-08-26 08:50:50 -0400442 EXPECT_FALSE(matchProbe(j, v));
Brad Bishopc5eba592020-08-28 10:38:24 -0400443}
444
445TEST(MatchProbe, trueNeqDoubleNegativeOne)
446{
447 nlohmann::json j = R"(true)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930448 DBusValueVariant v = double(-1.1);
Brad Bishopc5eba592020-08-28 10:38:24 -0400449 EXPECT_FALSE(matchProbe(j, v));
450}
451
Brad Bishop5d525412020-08-26 08:50:50 -0400452TEST(MatchProbe, trueNeqDoubleOne)
Brad Bishopc5eba592020-08-28 10:38:24 -0400453{
454 nlohmann::json j = R"(true)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930455 DBusValueVariant v = double(1.0);
Brad Bishop5d525412020-08-26 08:50:50 -0400456 EXPECT_FALSE(matchProbe(j, v));
Brad Bishopc5eba592020-08-28 10:38:24 -0400457}
458
459TEST(MatchProbe, falseNeqDoubleOne)
460{
461 nlohmann::json j = R"(false)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930462 DBusValueVariant v = double(1.0);
Brad Bishopc5eba592020-08-28 10:38:24 -0400463 EXPECT_FALSE(matchProbe(j, v));
464}
465
Brad Bishop5d525412020-08-26 08:50:50 -0400466TEST(MatchProbe, falseNeqDoubleZero)
Brad Bishopc5eba592020-08-28 10:38:24 -0400467{
468 nlohmann::json j = R"(false)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930469 DBusValueVariant v = double(0.0);
Brad Bishop5d525412020-08-26 08:50:50 -0400470 EXPECT_FALSE(matchProbe(j, v));
Brad Bishopc5eba592020-08-28 10:38:24 -0400471}
472
Brad Bishop5d525412020-08-26 08:50:50 -0400473TEST(MatchProbe, falseNeqEmpty)
Brad Bishopc5eba592020-08-28 10:38:24 -0400474{
475 nlohmann::json j = R"(false)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930476 DBusValueVariant v;
Brad Bishop5d525412020-08-26 08:50:50 -0400477 EXPECT_FALSE(matchProbe(j, v));
Brad Bishopc5eba592020-08-28 10:38:24 -0400478}
479
Brad Bishop5d525412020-08-26 08:50:50 -0400480TEST(MatchProbe, trueNeqEmpty)
Brad Bishopc5eba592020-08-28 10:38:24 -0400481{
482 nlohmann::json j = R"(true)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930483 DBusValueVariant v;
Brad Bishop5d525412020-08-26 08:50:50 -0400484 EXPECT_FALSE(matchProbe(j, v));
Brad Bishopc5eba592020-08-28 10:38:24 -0400485}
Brad Bishopc2af5312020-08-28 10:39:49 -0400486
Brad Bishopcd1868e2020-08-28 17:58:52 -0400487TEST(MatchProbe, trueNeqArray)
488{
489 nlohmann::json j = R"(true)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930490 DBusValueVariant v = std::vector<uint8_t>{1, 2};
Brad Bishopcd1868e2020-08-28 17:58:52 -0400491 EXPECT_FALSE(matchProbe(j, v));
492}
493
Brad Bishop5d525412020-08-26 08:50:50 -0400494TEST(MatchProbe, uintNeqString)
Brad Bishopc2af5312020-08-28 10:39:49 -0400495{
496 nlohmann::json j = R"(11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930497 DBusValueVariant v = "11"s;
Brad Bishop5d525412020-08-26 08:50:50 -0400498 EXPECT_FALSE(matchProbe(j, v));
Brad Bishopc2af5312020-08-28 10:39:49 -0400499}
500
501TEST(MatchProbe, uintNeqTrue)
502{
Brad Bishop5d525412020-08-26 08:50:50 -0400503 nlohmann::json j = R"(1)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930504 DBusValueVariant v = true;
Brad Bishopc2af5312020-08-28 10:39:49 -0400505 EXPECT_FALSE(matchProbe(j, v));
506}
507
Brad Bishop5d525412020-08-26 08:50:50 -0400508TEST(MatchProbe, uintNeqFalse)
509{
510 nlohmann::json j = R"(0)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930511 DBusValueVariant v = false;
Brad Bishop5d525412020-08-26 08:50:50 -0400512 EXPECT_FALSE(matchProbe(j, v));
513}
514
Brad Bishopc2af5312020-08-28 10:39:49 -0400515TEST(MatchProbe, uintEqUint8)
516{
517 nlohmann::json j = R"(11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930518 DBusValueVariant v = uint8_t(11);
Brad Bishopc2af5312020-08-28 10:39:49 -0400519 EXPECT_TRUE(matchProbe(j, v));
520}
521
522TEST(MatchProbe, uintNeqUint8)
523{
524 nlohmann::json j = R"(11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930525 DBusValueVariant v = uint8_t(12);
Brad Bishopc2af5312020-08-28 10:39:49 -0400526 EXPECT_FALSE(matchProbe(j, v));
527}
528
529TEST(MatchProbe, uintNeqUint8Overflow)
530{
531 nlohmann::json j = R"(65535)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930532 DBusValueVariant v = uint8_t(255);
Brad Bishopc2af5312020-08-28 10:39:49 -0400533 EXPECT_FALSE(matchProbe(j, v));
534}
535
536TEST(MatchProbe, uintEqInt8)
537{
538 nlohmann::json j = R"(11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930539 DBusValueVariant v = int8_t(11);
Brad Bishopc2af5312020-08-28 10:39:49 -0400540 EXPECT_TRUE(matchProbe(j, v));
541}
542
543TEST(MatchProbe, uintEqDouble)
544{
545 nlohmann::json j = R"(11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930546 DBusValueVariant v = double(11.0);
Brad Bishopc2af5312020-08-28 10:39:49 -0400547 EXPECT_TRUE(matchProbe(j, v));
548}
549
Brad Bishop5d525412020-08-26 08:50:50 -0400550TEST(MatchProbe, uintNeqDouble)
Brad Bishopc2af5312020-08-28 10:39:49 -0400551{
552 nlohmann::json j = R"(11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930553 DBusValueVariant v = double(11.7);
Brad Bishop5d525412020-08-26 08:50:50 -0400554 EXPECT_FALSE(matchProbe(j, v));
Brad Bishopc2af5312020-08-28 10:39:49 -0400555}
556
Brad Bishop5d525412020-08-26 08:50:50 -0400557TEST(MatchProbe, uintNeqEmpty)
Brad Bishopc2af5312020-08-28 10:39:49 -0400558{
559 nlohmann::json j = R"(11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930560 DBusValueVariant v;
Brad Bishop5d525412020-08-26 08:50:50 -0400561 EXPECT_FALSE(matchProbe(j, v));
Brad Bishopc2af5312020-08-28 10:39:49 -0400562}
Brad Bishop667e0502020-08-28 10:41:40 -0400563
Brad Bishopcd1868e2020-08-28 17:58:52 -0400564TEST(MatchProbe, uintNeqArray)
565{
566 nlohmann::json j = R"(11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930567 DBusValueVariant v = std::vector<uint8_t>{11};
Brad Bishopcd1868e2020-08-28 17:58:52 -0400568 EXPECT_FALSE(matchProbe(j, v));
569}
570
Brad Bishop5d525412020-08-26 08:50:50 -0400571TEST(MatchProbe, intNeqString)
Brad Bishop667e0502020-08-28 10:41:40 -0400572{
573 nlohmann::json j = R"(-11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930574 DBusValueVariant v = "-11"s;
Brad Bishop5d525412020-08-26 08:50:50 -0400575 EXPECT_FALSE(matchProbe(j, v));
Brad Bishop667e0502020-08-28 10:41:40 -0400576}
577
578TEST(MatchProbe, intNeqTrue)
579{
580 nlohmann::json j = R"(-1)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930581 DBusValueVariant v = true;
Brad Bishop667e0502020-08-28 10:41:40 -0400582 EXPECT_FALSE(matchProbe(j, v));
583}
584
585TEST(MatchProbe, intNeqUint8)
586{
587 nlohmann::json j = R"(-11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930588 DBusValueVariant v = uint8_t(11);
Brad Bishop667e0502020-08-28 10:41:40 -0400589 EXPECT_FALSE(matchProbe(j, v));
590}
591
592TEST(MatchProbe, intEqInt8)
593{
594 nlohmann::json j = R"(-11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930595 DBusValueVariant v = int8_t(-11);
Brad Bishop667e0502020-08-28 10:41:40 -0400596 EXPECT_TRUE(matchProbe(j, v));
597}
598
599TEST(MatchProbe, intNeqDouble)
600{
601 nlohmann::json j = R"(-124)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930602 DBusValueVariant v = double(-123.0);
Brad Bishop667e0502020-08-28 10:41:40 -0400603 EXPECT_FALSE(matchProbe(j, v));
604}
605
606TEST(MatchProbe, intEqDouble)
607{
608 nlohmann::json j = R"(-11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930609 DBusValueVariant v = double(-11.0);
Brad Bishop667e0502020-08-28 10:41:40 -0400610 EXPECT_TRUE(matchProbe(j, v));
611}
612
Brad Bishop5d525412020-08-26 08:50:50 -0400613TEST(MatchProbe, intNeqDoubleRound)
Brad Bishop667e0502020-08-28 10:41:40 -0400614{
615 nlohmann::json j = R"(-11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930616 DBusValueVariant v = double(-11.7);
Brad Bishop5d525412020-08-26 08:50:50 -0400617 EXPECT_FALSE(matchProbe(j, v));
Brad Bishop667e0502020-08-28 10:41:40 -0400618}
619
Brad Bishop5d525412020-08-26 08:50:50 -0400620TEST(MatchProbe, intNeqEmpty)
Brad Bishop667e0502020-08-28 10:41:40 -0400621{
622 nlohmann::json j = R"(-11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930623 DBusValueVariant v;
Brad Bishop5d525412020-08-26 08:50:50 -0400624 EXPECT_FALSE(matchProbe(j, v));
Brad Bishop667e0502020-08-28 10:41:40 -0400625}
Brad Bishop3bd8e8d2020-08-28 10:42:27 -0400626
Brad Bishopcd1868e2020-08-28 17:58:52 -0400627TEST(MatchProbe, intNeqArray)
628{
629 nlohmann::json j = R"(-11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930630 DBusValueVariant v = std::vector<uint8_t>{11};
Brad Bishopcd1868e2020-08-28 17:58:52 -0400631 EXPECT_FALSE(matchProbe(j, v));
632}
633
Brad Bishop5d525412020-08-26 08:50:50 -0400634TEST(MatchProbe, doubleNeqString)
Brad Bishop3bd8e8d2020-08-28 10:42:27 -0400635{
636 nlohmann::json j = R"(0.0)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930637 DBusValueVariant v = "0.0"s;
Brad Bishop5d525412020-08-26 08:50:50 -0400638 EXPECT_FALSE(matchProbe(j, v));
Brad Bishop3bd8e8d2020-08-28 10:42:27 -0400639}
640
Brad Bishop5d525412020-08-26 08:50:50 -0400641TEST(MatchProbe, doubleNeqFalse)
Brad Bishop3bd8e8d2020-08-28 10:42:27 -0400642{
643 nlohmann::json j = R"(0.0)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930644 DBusValueVariant v = false;
Brad Bishop5d525412020-08-26 08:50:50 -0400645 EXPECT_FALSE(matchProbe(j, v));
Brad Bishop3bd8e8d2020-08-28 10:42:27 -0400646}
647
648TEST(MatchProbe, doubleNeqTrue)
649{
Brad Bishop3bd8e8d2020-08-28 10:42:27 -0400650 nlohmann::json j = R"(1.0)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930651 DBusValueVariant v = true;
Brad Bishop5d525412020-08-26 08:50:50 -0400652 EXPECT_FALSE(matchProbe(j, v));
Brad Bishop3bd8e8d2020-08-28 10:42:27 -0400653}
654
655TEST(MatchProbe, doubleEqInt32)
656{
657 nlohmann::json j = R"(-124.0)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930658 DBusValueVariant v = int32_t(-124);
Brad Bishop3bd8e8d2020-08-28 10:42:27 -0400659 EXPECT_TRUE(matchProbe(j, v));
660}
661
662TEST(MatchProbe, doubleNeqInt32)
663{
664 nlohmann::json j = R"(-124.0)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930665 DBusValueVariant v = int32_t(-123);
Brad Bishop3bd8e8d2020-08-28 10:42:27 -0400666 EXPECT_FALSE(matchProbe(j, v));
667}
668
669TEST(MatchProbe, doubleRoundNeqInt)
670{
671 nlohmann::json j = R"(124.7)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930672 DBusValueVariant v = int32_t(124);
Brad Bishop3bd8e8d2020-08-28 10:42:27 -0400673 EXPECT_FALSE(matchProbe(j, v));
674}
675TEST(MatchProbe, doubleEqDouble)
676{
677 nlohmann::json j = R"(-124.2)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930678 DBusValueVariant v = double(-124.2);
Brad Bishop3bd8e8d2020-08-28 10:42:27 -0400679 EXPECT_TRUE(matchProbe(j, v));
680}
681
682TEST(MatchProbe, doubleNeqDouble)
683{
684 nlohmann::json j = R"(-124.3)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930685 DBusValueVariant v = double(-124.2);
Brad Bishop3bd8e8d2020-08-28 10:42:27 -0400686 EXPECT_FALSE(matchProbe(j, v));
687}
688
Brad Bishop5d525412020-08-26 08:50:50 -0400689TEST(MatchProbe, doubleNeqEmpty)
Brad Bishop3bd8e8d2020-08-28 10:42:27 -0400690{
691 nlohmann::json j = R"(-11.0)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930692 DBusValueVariant v;
Brad Bishop5d525412020-08-26 08:50:50 -0400693 EXPECT_FALSE(matchProbe(j, v));
Brad Bishop3bd8e8d2020-08-28 10:42:27 -0400694}
Brad Bishopd14c2e22020-08-28 10:43:40 -0400695
Brad Bishopcd1868e2020-08-28 17:58:52 -0400696TEST(MatchProbe, doubleNeqArray)
697{
698 nlohmann::json j = R"(-11.2)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930699 DBusValueVariant v = std::vector<uint8_t>{11};
Brad Bishopcd1868e2020-08-28 17:58:52 -0400700 EXPECT_FALSE(matchProbe(j, v));
701}
702
Brad Bishopd14c2e22020-08-28 10:43:40 -0400703TEST(MatchProbe, arrayNeqString)
704{
705 nlohmann::json j = R"([1, 2])"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930706 DBusValueVariant v = "hello"s;
Brad Bishopd14c2e22020-08-28 10:43:40 -0400707 EXPECT_FALSE(matchProbe(j, v));
708}
709
710TEST(MatchProbe, arrayNeqFalse)
711{
712 nlohmann::json j = R"([1, 2])"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930713 DBusValueVariant v = false;
Brad Bishopd14c2e22020-08-28 10:43:40 -0400714 EXPECT_FALSE(matchProbe(j, v));
715}
716
717TEST(MatchProbe, arrayNeqTrue)
718{
719 nlohmann::json j = R"([1, 2])"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930720 DBusValueVariant v = true;
Brad Bishopd14c2e22020-08-28 10:43:40 -0400721 EXPECT_FALSE(matchProbe(j, v));
722}
723
724TEST(MatchProbe, arrayNeqUint8)
725{
726 nlohmann::json j = R"([1, 2])"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930727 DBusValueVariant v = uint8_t(1);
Brad Bishopd14c2e22020-08-28 10:43:40 -0400728 EXPECT_FALSE(matchProbe(j, v));
729}
730
731TEST(MatchProbe, arrayNeqInt32)
732{
733 nlohmann::json j = R"([1, 2])"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930734 DBusValueVariant v = int32_t(-1);
Brad Bishopd14c2e22020-08-28 10:43:40 -0400735 EXPECT_FALSE(matchProbe(j, v));
736}
737
738TEST(MatchProbe, arrayNeqDouble)
739{
740 nlohmann::json j = R"([1, 2])"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930741 DBusValueVariant v = double(1.1);
Brad Bishopd14c2e22020-08-28 10:43:40 -0400742 EXPECT_FALSE(matchProbe(j, v));
743}
Brad Bishop6660e2a2020-08-28 10:44:41 -0400744
Brad Bishopcd1868e2020-08-28 17:58:52 -0400745TEST(MatchProbe, arrayEqArray)
746{
747 nlohmann::json j = R"([1, 2])"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930748 DBusValueVariant v = std::vector<uint8_t>{1, 2};
Brad Bishopcd1868e2020-08-28 17:58:52 -0400749 EXPECT_TRUE(matchProbe(j, v));
750}
751
752TEST(MatchProbe, arrayNeqArrayDiffSize1)
753{
754 nlohmann::json j = R"([1, 2, 3])"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930755 DBusValueVariant v = std::vector<uint8_t>{1, 2};
Brad Bishopcd1868e2020-08-28 17:58:52 -0400756 EXPECT_FALSE(matchProbe(j, v));
757}
758
759TEST(MatchProbe, arrayNeqArrayDiffSize2)
760{
761 nlohmann::json j = R"([1, 2])"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930762 DBusValueVariant v = std::vector<uint8_t>{1, 2, 3};
Brad Bishopcd1868e2020-08-28 17:58:52 -0400763 EXPECT_FALSE(matchProbe(j, v));
764}
765
766TEST(MatchProbe, emptyArrayEqEmptyArray)
767{
768 nlohmann::json j = R"([])"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930769 DBusValueVariant v = std::vector<uint8_t>{};
Brad Bishopcd1868e2020-08-28 17:58:52 -0400770 EXPECT_TRUE(matchProbe(j, v));
771}
772
773TEST(MatchProbe, emptyArrayNeqArray)
774{
775 nlohmann::json j = R"([])"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930776 DBusValueVariant v = std::vector<uint8_t>{1};
Brad Bishopcd1868e2020-08-28 17:58:52 -0400777 EXPECT_FALSE(matchProbe(j, v));
778}
779
780TEST(MatchProbe, arrayNeqEmptyArray)
781{
782 nlohmann::json j = R"([1])"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930783 DBusValueVariant v = std::vector<uint8_t>{};
Brad Bishopcd1868e2020-08-28 17:58:52 -0400784 EXPECT_FALSE(matchProbe(j, v));
785}
786
Brad Bishop6660e2a2020-08-28 10:44:41 -0400787TEST(MatchProbe, objNeqString)
788{
789 nlohmann::json j = R"({"foo": "bar"})"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930790 DBusValueVariant v = "hello"s;
Brad Bishop6660e2a2020-08-28 10:44:41 -0400791 EXPECT_FALSE(matchProbe(j, v));
792}
793
794TEST(MatchProbe, objNeqFalse)
795{
796 nlohmann::json j = R"({"foo": "bar"})"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930797 DBusValueVariant v = false;
Brad Bishop6660e2a2020-08-28 10:44:41 -0400798 EXPECT_FALSE(matchProbe(j, v));
799}
800
801TEST(MatchProbe, objNeqTrue)
802{
803 nlohmann::json j = R"({"foo": "bar"})"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930804 DBusValueVariant v = true;
Brad Bishop6660e2a2020-08-28 10:44:41 -0400805 EXPECT_FALSE(matchProbe(j, v));
806}
807
808TEST(MatchProbe, objNeqUint8)
809{
810 nlohmann::json j = R"({"foo": "bar"})"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930811 DBusValueVariant v = uint8_t(1);
Brad Bishop6660e2a2020-08-28 10:44:41 -0400812 EXPECT_FALSE(matchProbe(j, v));
813}
814
815TEST(MatchProbe, objNeqInt32)
816{
817 nlohmann::json j = R"({"foo": "bar"})"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930818 DBusValueVariant v = int32_t(-1);
Brad Bishop6660e2a2020-08-28 10:44:41 -0400819 EXPECT_FALSE(matchProbe(j, v));
820}
821
822TEST(MatchProbe, objNeqDouble)
823{
824 nlohmann::json j = R"({"foo": "bar"})"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930825 DBusValueVariant v = double(1.1);
Brad Bishop6660e2a2020-08-28 10:44:41 -0400826 EXPECT_FALSE(matchProbe(j, v));
827}
Brad Bishopc776c412020-08-28 10:45:25 -0400828
Brad Bishopcd1868e2020-08-28 17:58:52 -0400829TEST(MatchProbe, objNeqArray)
830{
831 nlohmann::json j = R"({"foo": "bar"})"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930832 DBusValueVariant v = std::vector<uint8_t>{1, 2};
Brad Bishopcd1868e2020-08-28 17:58:52 -0400833 EXPECT_FALSE(matchProbe(j, v));
834}
835
Brad Bishopc776c412020-08-28 10:45:25 -0400836TEST(MatchProbe, nullNeqString)
837{
838 nlohmann::json j = R"(null)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930839 DBusValueVariant v = "hello"s;
Brad Bishopc776c412020-08-28 10:45:25 -0400840 EXPECT_FALSE(matchProbe(j, v));
841}
842
843TEST(MatchProbe, nullNeqFalse)
844{
845 nlohmann::json j = R"(null)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930846 DBusValueVariant v = false;
Brad Bishopc776c412020-08-28 10:45:25 -0400847 EXPECT_FALSE(matchProbe(j, v));
848}
849
850TEST(MatchProbe, nullNeqTrue)
851{
852 nlohmann::json j = R"(null)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930853 DBusValueVariant v = true;
Brad Bishopc776c412020-08-28 10:45:25 -0400854 EXPECT_FALSE(matchProbe(j, v));
855}
856
857TEST(MatchProbe, nullNeqUint8)
858{
859 nlohmann::json j = R"(null)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930860 DBusValueVariant v = uint8_t(1);
Brad Bishopc776c412020-08-28 10:45:25 -0400861 EXPECT_FALSE(matchProbe(j, v));
862}
863
864TEST(MatchProbe, nullNeqInt32)
865{
866 nlohmann::json j = R"(null)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930867 DBusValueVariant v = int32_t(-1);
Brad Bishopc776c412020-08-28 10:45:25 -0400868 EXPECT_FALSE(matchProbe(j, v));
869}
870
871TEST(MatchProbe, nullNeqDouble)
872{
873 nlohmann::json j = R"(null)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930874 DBusValueVariant v = double(1.1);
Brad Bishopc776c412020-08-28 10:45:25 -0400875 EXPECT_FALSE(matchProbe(j, v));
876}
Brad Bishopcd1868e2020-08-28 17:58:52 -0400877
878TEST(MatchProbe, nullNeqArray)
879{
880 nlohmann::json j = R"(null)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930881 DBusValueVariant v = std::vector<uint8_t>{};
Brad Bishopcd1868e2020-08-28 17:58:52 -0400882 EXPECT_FALSE(matchProbe(j, v));
883}