blob: fbef8386d05dc05657dada7bd104211e4aa0d91a [file] [log] [blame]
James Feist481c5d52019-08-13 14:40:40 -07001#include "Utils.hpp"
2
3#include <boost/container/flat_map.hpp>
4#include <nlohmann/json.hpp>
James Feist8c505da2020-05-28 10:06:33 -07005
Brad Bishop9d2ef082020-08-26 15:17:55 -04006#include <string>
James Feist481c5d52019-08-13 14:40:40 -07007#include <variant>
8
9#include "gtest/gtest.h"
10
Brad Bishop9d2ef082020-08-26 15:17:55 -040011using namespace std::string_literals;
12
James Feist481c5d52019-08-13 14:40:40 -070013TEST(TemplateCharReplace, replaceOneInt)
14{
15 nlohmann::json j = {{"foo", "$bus"}};
16 auto it = j.begin();
Andrew Jefferyeab49292022-04-05 14:42:20 +093017 boost::container::flat_map<std::string, DBusValueVariant> data;
James Feist481c5d52019-08-13 14:40:40 -070018 data["BUS"] = 23;
19
20 templateCharReplace(it, data, 0);
21
22 nlohmann::json expected = 23;
23 EXPECT_EQ(expected, j["foo"]);
24}
25
26TEST(TemplateCharReplace, replaceOneStr)
27{
28 nlohmann::json j = {{"foo", "$TEST"}};
29 auto it = j.begin();
Andrew Jefferyeab49292022-04-05 14:42:20 +093030 boost::container::flat_map<std::string, DBusValueVariant> data;
James Feist481c5d52019-08-13 14:40:40 -070031 data["TEST"] = std::string("Test");
32
33 templateCharReplace(it, data, 0);
34
35 nlohmann::json expected = "Test";
36 EXPECT_EQ(expected, j["foo"]);
37}
38
39TEST(TemplateCharReplace, replaceSecondStr)
40{
41 nlohmann::json j = {{"foo", "the $TEST"}};
42 auto it = j.begin();
Andrew Jefferyeab49292022-04-05 14:42:20 +093043 boost::container::flat_map<std::string, DBusValueVariant> data;
James Feist481c5d52019-08-13 14:40:40 -070044 data["TEST"] = std::string("Test");
45
46 templateCharReplace(it, data, 0);
47
48 nlohmann::json expected = "the Test";
49 EXPECT_EQ(expected, j["foo"]);
50}
51
James Feist481c5d52019-08-13 14:40:40 -070052TEST(TemplateCharReplace, replaceMiddleStr)
53{
54 nlohmann::json j = {{"foo", "the $TEST worked"}};
55 auto it = j.begin();
Andrew Jefferyeab49292022-04-05 14:42:20 +093056 boost::container::flat_map<std::string, DBusValueVariant> data;
James Feist481c5d52019-08-13 14:40:40 -070057 data["TEST"] = std::string("Test");
58
59 templateCharReplace(it, data, 0);
60
61 nlohmann::json expected = "the Test worked";
62 EXPECT_EQ(expected, j["foo"]);
63}
James Feist481c5d52019-08-13 14:40:40 -070064
65TEST(TemplateCharReplace, replaceLastStr)
66{
67 nlohmann::json j = {{"foo", "the Test $TEST"}};
68 auto it = j.begin();
Andrew Jefferyeab49292022-04-05 14:42:20 +093069 boost::container::flat_map<std::string, DBusValueVariant> data;
James Feist481c5d52019-08-13 14:40:40 -070070 data["TEST"] = 23;
71
72 templateCharReplace(it, data, 0);
73
74 nlohmann::json expected = "the Test 23";
75 EXPECT_EQ(expected, j["foo"]);
76}
77
78TEST(TemplateCharReplace, increment)
79{
80 nlohmann::json j = {{"foo", "3 plus 1 equals $TEST + 1"}};
81 auto it = j.begin();
Andrew Jefferyeab49292022-04-05 14:42:20 +093082 boost::container::flat_map<std::string, DBusValueVariant> data;
James Feist481c5d52019-08-13 14:40:40 -070083 data["TEST"] = 3;
84
85 templateCharReplace(it, data, 0);
86
87 nlohmann::json expected = "3 plus 1 equals 4";
88 EXPECT_EQ(expected, j["foo"]);
89}
90
91TEST(TemplateCharReplace, decrement)
92{
93 nlohmann::json j = {{"foo", "3 minus 1 equals $TEST - 1 !"}};
94 auto it = j.begin();
Andrew Jefferyeab49292022-04-05 14:42:20 +093095 boost::container::flat_map<std::string, DBusValueVariant> data;
James Feist481c5d52019-08-13 14:40:40 -070096 data["TEST"] = 3;
97
98 templateCharReplace(it, data, 0);
99
100 nlohmann::json expected = "3 minus 1 equals 2 !";
101 EXPECT_EQ(expected, j["foo"]);
102}
103
104TEST(TemplateCharReplace, modulus)
105{
106 nlohmann::json j = {{"foo", "3 mod 2 equals $TEST % 2"}};
107 auto it = j.begin();
Andrew Jefferyeab49292022-04-05 14:42:20 +0930108 boost::container::flat_map<std::string, DBusValueVariant> data;
James Feist481c5d52019-08-13 14:40:40 -0700109 data["TEST"] = 3;
110
111 templateCharReplace(it, data, 0);
112
113 nlohmann::json expected = "3 mod 2 equals 1";
114 EXPECT_EQ(expected, j["foo"]);
115}
116
117TEST(TemplateCharReplace, multiply)
118{
119 nlohmann::json j = {{"foo", "3 * 2 equals $TEST * 2"}};
120 auto it = j.begin();
Andrew Jefferyeab49292022-04-05 14:42:20 +0930121 boost::container::flat_map<std::string, DBusValueVariant> data;
James Feist481c5d52019-08-13 14:40:40 -0700122 data["TEST"] = 3;
123
124 templateCharReplace(it, data, 0);
125
126 nlohmann::json expected = "3 * 2 equals 6";
127 EXPECT_EQ(expected, j["foo"]);
128}
129
130TEST(TemplateCharReplace, divide)
131{
132 nlohmann::json j = {{"foo", "4 / 2 equals $TEST / 2"}};
133 auto it = j.begin();
Andrew Jefferyeab49292022-04-05 14:42:20 +0930134 boost::container::flat_map<std::string, DBusValueVariant> data;
James Feist481c5d52019-08-13 14:40:40 -0700135 data["TEST"] = 4;
136
137 templateCharReplace(it, data, 0);
138
139 nlohmann::json expected = "4 / 2 equals 2";
140 EXPECT_EQ(expected, j["foo"]);
James Feist8c20feb2019-08-14 15:10:11 -0700141}
142
143TEST(TemplateCharReplace, multiMath)
144{
145 nlohmann::json j = {{"foo", "4 * 2 % 6 equals $TEST * 2 % 6"}};
146 auto it = j.begin();
Andrew Jefferyeab49292022-04-05 14:42:20 +0930147 boost::container::flat_map<std::string, DBusValueVariant> data;
James Feist8c20feb2019-08-14 15:10:11 -0700148 data["TEST"] = 4;
149
150 templateCharReplace(it, data, 0);
151
152 nlohmann::json expected = "4 * 2 % 6 equals 2";
153 EXPECT_EQ(expected, j["foo"]);
154}
155
156TEST(TemplateCharReplace, twoReplacements)
157{
158 nlohmann::json j = {{"foo", "$FOO $BAR"}};
159 auto it = j.begin();
Andrew Jefferyeab49292022-04-05 14:42:20 +0930160 boost::container::flat_map<std::string, DBusValueVariant> data;
James Feist8c20feb2019-08-14 15:10:11 -0700161 data["FOO"] = std::string("foo");
162 data["BAR"] = std::string("bar");
163
164 templateCharReplace(it, data, 0);
165
166 nlohmann::json expected = "foo bar";
167 EXPECT_EQ(expected, j["foo"]);
168}
169
170TEST(TemplateCharReplace, twoReplacementsWithMath)
171{
172 nlohmann::json j = {{"foo", "4 / 2 equals $TEST / 2 $BAR"}};
173 auto it = j.begin();
Andrew Jefferyeab49292022-04-05 14:42:20 +0930174 boost::container::flat_map<std::string, DBusValueVariant> data;
James Feist8c20feb2019-08-14 15:10:11 -0700175 data["TEST"] = 4;
176 data["BAR"] = std::string("bar");
177
178 templateCharReplace(it, data, 0);
179
180 nlohmann::json expected = "4 / 2 equals 2 bar";
Zhikui Rena0d1b3f2021-10-05 16:21:56 -0700181}
182
183TEST(TemplateCharReplace, twoReplacementsWithMath2)
184{
185 nlohmann::json j = {{"foo", "4 / 2 equals $ADDRESS / 2 $BAR"}};
186 auto it = j.begin();
Andrew Jefferyeab49292022-04-05 14:42:20 +0930187 boost::container::flat_map<std::string, DBusValueVariant> data;
Zhikui Rena0d1b3f2021-10-05 16:21:56 -0700188 data["ADDRESS"] = 4;
189 data["BAR"] = std::string("bar");
190
191 templateCharReplace(it, data, 0);
192
193 nlohmann::json expected = "4 / 2 equals 2 bar";
James Feist8c20feb2019-08-14 15:10:11 -0700194 EXPECT_EQ(expected, j["foo"]);
James Feistb0097d42019-08-15 09:24:13 -0700195}
196
197TEST(TemplateCharReplace, hexAndWrongCase)
198{
199 nlohmann::json j = {{"Address", "0x54"},
200 {"Bus", 15},
201 {"Name", "$bus sensor 0"},
202 {"Type", "SomeType"}};
203
Andrew Jefferyeab49292022-04-05 14:42:20 +0930204 boost::container::flat_map<std::string, DBusValueVariant> data;
James Feistb0097d42019-08-15 09:24:13 -0700205 data["BUS"] = 15;
206
207 for (auto it = j.begin(); it != j.end(); it++)
208 {
209 templateCharReplace(it, data, 0);
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
218TEST(TemplateCharReplace, replaceSecondAsInt)
219{
220 nlohmann::json j = {{"foo", "twelve is $TEST"}};
221 auto it = j.begin();
Andrew Jefferyeab49292022-04-05 14:42:20 +0930222 boost::container::flat_map<std::string, DBusValueVariant> data;
James Feistb0097d42019-08-15 09:24:13 -0700223 data["test"] = 12;
224
225 templateCharReplace(it, data, 0);
226
227 nlohmann::json expected = "twelve is 12";
228 EXPECT_EQ(expected, j["foo"]);
229}
James Feistc296c802019-08-28 09:26:47 -0700230
231TEST(TemplateCharReplace, singleHex)
232{
233 nlohmann::json j = {{"foo", "0x54"}};
234 auto it = j.begin();
Andrew Jefferyeab49292022-04-05 14:42:20 +0930235 boost::container::flat_map<std::string, DBusValueVariant> data;
James Feistc296c802019-08-28 09:26:47 -0700236
237 templateCharReplace(it, data, 0);
238
239 nlohmann::json expected = 84;
240 EXPECT_EQ(expected, j["foo"]);
241}
Brad Bishop9d2ef082020-08-26 15:17:55 -0400242
243TEST(MatchProbe, stringEqString)
244{
245 nlohmann::json j = R"("foo")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930246 DBusValueVariant v = "foo"s;
Brad Bishop9d2ef082020-08-26 15:17:55 -0400247 EXPECT_TRUE(matchProbe(j, v));
248}
249
250TEST(MatchProbe, stringRegexEqString)
251{
252 nlohmann::json j = R"("foo*")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930253 DBusValueVariant v = "foobar"s;
Brad Bishop9d2ef082020-08-26 15:17:55 -0400254 EXPECT_TRUE(matchProbe(j, v));
255}
256
257TEST(MatchProbe, stringNeqString)
258{
259 nlohmann::json j = R"("foobar")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930260 DBusValueVariant v = "foo"s;
Brad Bishop9d2ef082020-08-26 15:17:55 -0400261 EXPECT_FALSE(matchProbe(j, v));
262}
263
264TEST(MatchProbe, stringRegexError)
265{
266 nlohmann::json j = R"("foo[")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930267 DBusValueVariant v = "foobar"s;
Brad Bishop5d525412020-08-26 08:50:50 -0400268 EXPECT_FALSE(matchProbe(j, v));
Brad Bishop9d2ef082020-08-26 15:17:55 -0400269}
270
Brad Bishop5d525412020-08-26 08:50:50 -0400271TEST(MatchProbe, stringZeroNeqFalse)
Brad Bishop9d2ef082020-08-26 15:17:55 -0400272{
273 nlohmann::json j = R"("0")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930274 DBusValueVariant v = false;
Brad Bishop5d525412020-08-26 08:50:50 -0400275 EXPECT_FALSE(matchProbe(j, v));
Brad Bishop9d2ef082020-08-26 15:17:55 -0400276}
277
Brad Bishop5d525412020-08-26 08:50:50 -0400278TEST(MatchProbe, stringOneNeqTrue)
Brad Bishop9d2ef082020-08-26 15:17:55 -0400279{
280 nlohmann::json j = R"("1")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930281 DBusValueVariant v = true;
Brad Bishop5d525412020-08-26 08:50:50 -0400282 EXPECT_FALSE(matchProbe(j, v));
Brad Bishop9d2ef082020-08-26 15:17:55 -0400283}
284
285TEST(MatchProbe, stringElevenNeqTrue)
286{
287 nlohmann::json j = R"("11")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930288 DBusValueVariant v = true;
Brad Bishop9d2ef082020-08-26 15:17:55 -0400289 EXPECT_FALSE(matchProbe(j, v));
290}
291
292TEST(MatchProbe, stringFalseNeqFalse)
293{
294 nlohmann::json j = R"("false")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930295 DBusValueVariant v = false;
Brad Bishop9d2ef082020-08-26 15:17:55 -0400296 EXPECT_FALSE(matchProbe(j, v));
297}
298
299TEST(MatchProbe, stringTrueNeqTrue)
300{
301 nlohmann::json j = R"("true")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930302 DBusValueVariant v = true;
Brad Bishop9d2ef082020-08-26 15:17:55 -0400303 EXPECT_FALSE(matchProbe(j, v));
304}
305
306TEST(MatchProbe, stringFalseNeqTrue)
307{
308 nlohmann::json j = R"("false")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930309 DBusValueVariant v = true;
Brad Bishop9d2ef082020-08-26 15:17:55 -0400310 EXPECT_FALSE(matchProbe(j, v));
311}
312
Brad Bishop5d525412020-08-26 08:50:50 -0400313TEST(MatchProbe, stringNeqUint8)
Brad Bishop9d2ef082020-08-26 15:17:55 -0400314{
315 nlohmann::json j = R"("255")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930316 DBusValueVariant v = uint8_t(255);
Brad Bishop5d525412020-08-26 08:50:50 -0400317 EXPECT_FALSE(matchProbe(j, v));
Brad Bishop9d2ef082020-08-26 15:17:55 -0400318}
319
320TEST(MatchProbe, stringNeqUint8Overflow)
321{
322 nlohmann::json j = R"("65535")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930323 DBusValueVariant v = uint8_t(255);
Brad Bishop9d2ef082020-08-26 15:17:55 -0400324 EXPECT_FALSE(matchProbe(j, v));
325}
326
327TEST(MatchProbe, stringFalseNeqUint8Zero)
328{
329 nlohmann::json j = R"("false")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930330 DBusValueVariant v = uint8_t(0);
Brad Bishop9d2ef082020-08-26 15:17:55 -0400331 EXPECT_FALSE(matchProbe(j, v));
332}
333
334TEST(MatchProbe, stringTrueNeqUint8Zero)
335{
336 nlohmann::json j = R"("true")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930337 DBusValueVariant v = uint8_t(1);
Brad Bishop9d2ef082020-08-26 15:17:55 -0400338 EXPECT_FALSE(matchProbe(j, v));
339}
340
Brad Bishop5d525412020-08-26 08:50:50 -0400341TEST(MatchProbe, stringNeqUint32)
Brad Bishop9d2ef082020-08-26 15:17:55 -0400342{
343 nlohmann::json j = R"("11")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930344 DBusValueVariant v = uint32_t(11);
Brad Bishop9d2ef082020-08-26 15:17:55 -0400345 EXPECT_FALSE(matchProbe(j, v));
346}
347
Brad Bishop9d2ef082020-08-26 15:17:55 -0400348TEST(MatchProbe, stringNeqInt32)
349{
Brad Bishop5d525412020-08-26 08:50:50 -0400350 nlohmann::json j = R"("-11")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930351 DBusValueVariant v = int32_t(-11);
Brad Bishop9d2ef082020-08-26 15:17:55 -0400352 EXPECT_FALSE(matchProbe(j, v));
353}
354
Brad Bishop5d525412020-08-26 08:50:50 -0400355TEST(MatchProbe, stringRegexNeqInt32)
Brad Bishop9d2ef082020-08-26 15:17:55 -0400356{
357 nlohmann::json j = R"("1*4")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930358 DBusValueVariant v = int32_t(124);
Brad Bishop5d525412020-08-26 08:50:50 -0400359 EXPECT_FALSE(matchProbe(j, v));
Brad Bishop9d2ef082020-08-26 15:17:55 -0400360}
361
362TEST(MatchProbe, stringNeqUint64)
363{
364 nlohmann::json j = R"("foo")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930365 DBusValueVariant v = uint64_t(65535);
Brad Bishop9d2ef082020-08-26 15:17:55 -0400366 EXPECT_FALSE(matchProbe(j, v));
367}
368
Brad Bishop9d2ef082020-08-26 15:17:55 -0400369TEST(MatchProbe, stringNeqDouble)
370{
Brad Bishop5d525412020-08-26 08:50:50 -0400371 nlohmann::json j = R"("123.4")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930372 DBusValueVariant v = double(123.4);
Brad Bishop9d2ef082020-08-26 15:17:55 -0400373 EXPECT_FALSE(matchProbe(j, v));
374}
375
376TEST(MatchProbe, stringNeqEmpty)
377{
378 nlohmann::json j = R"("-123.4")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930379 DBusValueVariant v;
Brad Bishop9d2ef082020-08-26 15:17:55 -0400380 EXPECT_FALSE(matchProbe(j, v));
381}
Brad Bishopc5eba592020-08-28 10:38:24 -0400382
Brad Bishopcd1868e2020-08-28 17:58:52 -0400383TEST(MatchProbe, stringNeqArray)
384{
385 nlohmann::json j = R"("-123.4")"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930386 DBusValueVariant v = std::vector<uint8_t>{1, 2};
Brad Bishopcd1868e2020-08-28 17:58:52 -0400387 EXPECT_FALSE(matchProbe(j, v));
388}
389
Brad Bishop5d525412020-08-26 08:50:50 -0400390TEST(MatchProbe, boolNeqString)
Brad Bishopc5eba592020-08-28 10:38:24 -0400391{
392 nlohmann::json j = R"(false)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930393 DBusValueVariant v = "false"s;
Brad Bishop5d525412020-08-26 08:50:50 -0400394 EXPECT_FALSE(matchProbe(j, v));
Brad Bishopc5eba592020-08-28 10:38:24 -0400395}
396
397TEST(MatchProbe, trueEqTrue)
398{
399 nlohmann::json j = R"(true)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930400 DBusValueVariant v = true;
Brad Bishopc5eba592020-08-28 10:38:24 -0400401 EXPECT_TRUE(matchProbe(j, v));
402}
403
404TEST(MatchProbe, falseEqFalse)
405{
406 nlohmann::json j = R"(false)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930407 DBusValueVariant v = false;
Brad Bishopc5eba592020-08-28 10:38:24 -0400408 EXPECT_TRUE(matchProbe(j, v));
409}
410
411TEST(MatchProbe, trueNeqFalse)
412{
413 nlohmann::json j = R"(true)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930414 DBusValueVariant v = false;
Brad Bishopc5eba592020-08-28 10:38:24 -0400415 EXPECT_FALSE(matchProbe(j, v));
416}
417
418TEST(MatchProbe, trueNeqInt32Zero)
419{
420 nlohmann::json j = R"(true)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930421 DBusValueVariant v = int32_t(0);
Brad Bishopc5eba592020-08-28 10:38:24 -0400422 EXPECT_FALSE(matchProbe(j, v));
423}
424
425TEST(MatchProbe, trueNeqInt32NegativeOne)
426{
427 nlohmann::json j = R"(true)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930428 DBusValueVariant v = int32_t(-1);
Brad Bishopc5eba592020-08-28 10:38:24 -0400429 EXPECT_FALSE(matchProbe(j, v));
430}
431
432TEST(MatchProbe, falseNeqUint32One)
433{
434 nlohmann::json j = R"(false)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930435 DBusValueVariant v = uint32_t(1);
Brad Bishopc5eba592020-08-28 10:38:24 -0400436 EXPECT_FALSE(matchProbe(j, v));
437}
438
Brad Bishop5d525412020-08-26 08:50:50 -0400439TEST(MatchProbe, falseNeqUint32Zero)
Brad Bishopc5eba592020-08-28 10:38:24 -0400440{
441 nlohmann::json j = R"(false)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930442 DBusValueVariant v = uint32_t(0);
Brad Bishop5d525412020-08-26 08:50:50 -0400443 EXPECT_FALSE(matchProbe(j, v));
Brad Bishopc5eba592020-08-28 10:38:24 -0400444}
445
446TEST(MatchProbe, trueNeqDoubleNegativeOne)
447{
448 nlohmann::json j = R"(true)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930449 DBusValueVariant v = double(-1.1);
Brad Bishopc5eba592020-08-28 10:38:24 -0400450 EXPECT_FALSE(matchProbe(j, v));
451}
452
Brad Bishop5d525412020-08-26 08:50:50 -0400453TEST(MatchProbe, trueNeqDoubleOne)
Brad Bishopc5eba592020-08-28 10:38:24 -0400454{
455 nlohmann::json j = R"(true)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930456 DBusValueVariant v = double(1.0);
Brad Bishop5d525412020-08-26 08:50:50 -0400457 EXPECT_FALSE(matchProbe(j, v));
Brad Bishopc5eba592020-08-28 10:38:24 -0400458}
459
460TEST(MatchProbe, falseNeqDoubleOne)
461{
462 nlohmann::json j = R"(false)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930463 DBusValueVariant v = double(1.0);
Brad Bishopc5eba592020-08-28 10:38:24 -0400464 EXPECT_FALSE(matchProbe(j, v));
465}
466
Brad Bishop5d525412020-08-26 08:50:50 -0400467TEST(MatchProbe, falseNeqDoubleZero)
Brad Bishopc5eba592020-08-28 10:38:24 -0400468{
469 nlohmann::json j = R"(false)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930470 DBusValueVariant v = double(0.0);
Brad Bishop5d525412020-08-26 08:50:50 -0400471 EXPECT_FALSE(matchProbe(j, v));
Brad Bishopc5eba592020-08-28 10:38:24 -0400472}
473
Brad Bishop5d525412020-08-26 08:50:50 -0400474TEST(MatchProbe, falseNeqEmpty)
Brad Bishopc5eba592020-08-28 10:38:24 -0400475{
476 nlohmann::json j = R"(false)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930477 DBusValueVariant v;
Brad Bishop5d525412020-08-26 08:50:50 -0400478 EXPECT_FALSE(matchProbe(j, v));
Brad Bishopc5eba592020-08-28 10:38:24 -0400479}
480
Brad Bishop5d525412020-08-26 08:50:50 -0400481TEST(MatchProbe, trueNeqEmpty)
Brad Bishopc5eba592020-08-28 10:38:24 -0400482{
483 nlohmann::json j = R"(true)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930484 DBusValueVariant v;
Brad Bishop5d525412020-08-26 08:50:50 -0400485 EXPECT_FALSE(matchProbe(j, v));
Brad Bishopc5eba592020-08-28 10:38:24 -0400486}
Brad Bishopc2af5312020-08-28 10:39:49 -0400487
Brad Bishopcd1868e2020-08-28 17:58:52 -0400488TEST(MatchProbe, trueNeqArray)
489{
490 nlohmann::json j = R"(true)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930491 DBusValueVariant v = std::vector<uint8_t>{1, 2};
Brad Bishopcd1868e2020-08-28 17:58:52 -0400492 EXPECT_FALSE(matchProbe(j, v));
493}
494
Brad Bishop5d525412020-08-26 08:50:50 -0400495TEST(MatchProbe, uintNeqString)
Brad Bishopc2af5312020-08-28 10:39:49 -0400496{
497 nlohmann::json j = R"(11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930498 DBusValueVariant v = "11"s;
Brad Bishop5d525412020-08-26 08:50:50 -0400499 EXPECT_FALSE(matchProbe(j, v));
Brad Bishopc2af5312020-08-28 10:39:49 -0400500}
501
502TEST(MatchProbe, uintNeqTrue)
503{
Brad Bishop5d525412020-08-26 08:50:50 -0400504 nlohmann::json j = R"(1)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930505 DBusValueVariant v = true;
Brad Bishopc2af5312020-08-28 10:39:49 -0400506 EXPECT_FALSE(matchProbe(j, v));
507}
508
Brad Bishop5d525412020-08-26 08:50:50 -0400509TEST(MatchProbe, uintNeqFalse)
510{
511 nlohmann::json j = R"(0)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930512 DBusValueVariant v = false;
Brad Bishop5d525412020-08-26 08:50:50 -0400513 EXPECT_FALSE(matchProbe(j, v));
514}
515
Brad Bishopc2af5312020-08-28 10:39:49 -0400516TEST(MatchProbe, uintEqUint8)
517{
518 nlohmann::json j = R"(11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930519 DBusValueVariant v = uint8_t(11);
Brad Bishopc2af5312020-08-28 10:39:49 -0400520 EXPECT_TRUE(matchProbe(j, v));
521}
522
523TEST(MatchProbe, uintNeqUint8)
524{
525 nlohmann::json j = R"(11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930526 DBusValueVariant v = uint8_t(12);
Brad Bishopc2af5312020-08-28 10:39:49 -0400527 EXPECT_FALSE(matchProbe(j, v));
528}
529
530TEST(MatchProbe, uintNeqUint8Overflow)
531{
532 nlohmann::json j = R"(65535)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930533 DBusValueVariant v = uint8_t(255);
Brad Bishopc2af5312020-08-28 10:39:49 -0400534 EXPECT_FALSE(matchProbe(j, v));
535}
536
537TEST(MatchProbe, uintEqInt8)
538{
539 nlohmann::json j = R"(11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930540 DBusValueVariant v = int8_t(11);
Brad Bishopc2af5312020-08-28 10:39:49 -0400541 EXPECT_TRUE(matchProbe(j, v));
542}
543
544TEST(MatchProbe, uintEqDouble)
545{
546 nlohmann::json j = R"(11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930547 DBusValueVariant v = double(11.0);
Brad Bishopc2af5312020-08-28 10:39:49 -0400548 EXPECT_TRUE(matchProbe(j, v));
549}
550
Brad Bishop5d525412020-08-26 08:50:50 -0400551TEST(MatchProbe, uintNeqDouble)
Brad Bishopc2af5312020-08-28 10:39:49 -0400552{
553 nlohmann::json j = R"(11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930554 DBusValueVariant v = double(11.7);
Brad Bishop5d525412020-08-26 08:50:50 -0400555 EXPECT_FALSE(matchProbe(j, v));
Brad Bishopc2af5312020-08-28 10:39:49 -0400556}
557
Brad Bishop5d525412020-08-26 08:50:50 -0400558TEST(MatchProbe, uintNeqEmpty)
Brad Bishopc2af5312020-08-28 10:39:49 -0400559{
560 nlohmann::json j = R"(11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930561 DBusValueVariant v;
Brad Bishop5d525412020-08-26 08:50:50 -0400562 EXPECT_FALSE(matchProbe(j, v));
Brad Bishopc2af5312020-08-28 10:39:49 -0400563}
Brad Bishop667e0502020-08-28 10:41:40 -0400564
Brad Bishopcd1868e2020-08-28 17:58:52 -0400565TEST(MatchProbe, uintNeqArray)
566{
567 nlohmann::json j = R"(11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930568 DBusValueVariant v = std::vector<uint8_t>{11};
Brad Bishopcd1868e2020-08-28 17:58:52 -0400569 EXPECT_FALSE(matchProbe(j, v));
570}
571
Brad Bishop5d525412020-08-26 08:50:50 -0400572TEST(MatchProbe, intNeqString)
Brad Bishop667e0502020-08-28 10:41:40 -0400573{
574 nlohmann::json j = R"(-11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930575 DBusValueVariant v = "-11"s;
Brad Bishop5d525412020-08-26 08:50:50 -0400576 EXPECT_FALSE(matchProbe(j, v));
Brad Bishop667e0502020-08-28 10:41:40 -0400577}
578
579TEST(MatchProbe, intNeqTrue)
580{
581 nlohmann::json j = R"(-1)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930582 DBusValueVariant v = true;
Brad Bishop667e0502020-08-28 10:41:40 -0400583 EXPECT_FALSE(matchProbe(j, v));
584}
585
586TEST(MatchProbe, intNeqUint8)
587{
588 nlohmann::json j = R"(-11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930589 DBusValueVariant v = uint8_t(11);
Brad Bishop667e0502020-08-28 10:41:40 -0400590 EXPECT_FALSE(matchProbe(j, v));
591}
592
593TEST(MatchProbe, intEqInt8)
594{
595 nlohmann::json j = R"(-11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930596 DBusValueVariant v = int8_t(-11);
Brad Bishop667e0502020-08-28 10:41:40 -0400597 EXPECT_TRUE(matchProbe(j, v));
598}
599
600TEST(MatchProbe, intNeqDouble)
601{
602 nlohmann::json j = R"(-124)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930603 DBusValueVariant v = double(-123.0);
Brad Bishop667e0502020-08-28 10:41:40 -0400604 EXPECT_FALSE(matchProbe(j, v));
605}
606
607TEST(MatchProbe, intEqDouble)
608{
609 nlohmann::json j = R"(-11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930610 DBusValueVariant v = double(-11.0);
Brad Bishop667e0502020-08-28 10:41:40 -0400611 EXPECT_TRUE(matchProbe(j, v));
612}
613
Brad Bishop5d525412020-08-26 08:50:50 -0400614TEST(MatchProbe, intNeqDoubleRound)
Brad Bishop667e0502020-08-28 10:41:40 -0400615{
616 nlohmann::json j = R"(-11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930617 DBusValueVariant v = double(-11.7);
Brad Bishop5d525412020-08-26 08:50:50 -0400618 EXPECT_FALSE(matchProbe(j, v));
Brad Bishop667e0502020-08-28 10:41:40 -0400619}
620
Brad Bishop5d525412020-08-26 08:50:50 -0400621TEST(MatchProbe, intNeqEmpty)
Brad Bishop667e0502020-08-28 10:41:40 -0400622{
623 nlohmann::json j = R"(-11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930624 DBusValueVariant v;
Brad Bishop5d525412020-08-26 08:50:50 -0400625 EXPECT_FALSE(matchProbe(j, v));
Brad Bishop667e0502020-08-28 10:41:40 -0400626}
Brad Bishop3bd8e8d2020-08-28 10:42:27 -0400627
Brad Bishopcd1868e2020-08-28 17:58:52 -0400628TEST(MatchProbe, intNeqArray)
629{
630 nlohmann::json j = R"(-11)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930631 DBusValueVariant v = std::vector<uint8_t>{11};
Brad Bishopcd1868e2020-08-28 17:58:52 -0400632 EXPECT_FALSE(matchProbe(j, v));
633}
634
Brad Bishop5d525412020-08-26 08:50:50 -0400635TEST(MatchProbe, doubleNeqString)
Brad Bishop3bd8e8d2020-08-28 10:42:27 -0400636{
637 nlohmann::json j = R"(0.0)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930638 DBusValueVariant v = "0.0"s;
Brad Bishop5d525412020-08-26 08:50:50 -0400639 EXPECT_FALSE(matchProbe(j, v));
Brad Bishop3bd8e8d2020-08-28 10:42:27 -0400640}
641
Brad Bishop5d525412020-08-26 08:50:50 -0400642TEST(MatchProbe, doubleNeqFalse)
Brad Bishop3bd8e8d2020-08-28 10:42:27 -0400643{
644 nlohmann::json j = R"(0.0)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930645 DBusValueVariant v = false;
Brad Bishop5d525412020-08-26 08:50:50 -0400646 EXPECT_FALSE(matchProbe(j, v));
Brad Bishop3bd8e8d2020-08-28 10:42:27 -0400647}
648
649TEST(MatchProbe, doubleNeqTrue)
650{
Brad Bishop3bd8e8d2020-08-28 10:42:27 -0400651 nlohmann::json j = R"(1.0)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930652 DBusValueVariant v = true;
Brad Bishop5d525412020-08-26 08:50:50 -0400653 EXPECT_FALSE(matchProbe(j, v));
Brad Bishop3bd8e8d2020-08-28 10:42:27 -0400654}
655
656TEST(MatchProbe, doubleEqInt32)
657{
658 nlohmann::json j = R"(-124.0)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930659 DBusValueVariant v = int32_t(-124);
Brad Bishop3bd8e8d2020-08-28 10:42:27 -0400660 EXPECT_TRUE(matchProbe(j, v));
661}
662
663TEST(MatchProbe, doubleNeqInt32)
664{
665 nlohmann::json j = R"(-124.0)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930666 DBusValueVariant v = int32_t(-123);
Brad Bishop3bd8e8d2020-08-28 10:42:27 -0400667 EXPECT_FALSE(matchProbe(j, v));
668}
669
670TEST(MatchProbe, doubleRoundNeqInt)
671{
672 nlohmann::json j = R"(124.7)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930673 DBusValueVariant v = int32_t(124);
Brad Bishop3bd8e8d2020-08-28 10:42:27 -0400674 EXPECT_FALSE(matchProbe(j, v));
675}
676TEST(MatchProbe, doubleEqDouble)
677{
678 nlohmann::json j = R"(-124.2)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930679 DBusValueVariant v = double(-124.2);
Brad Bishop3bd8e8d2020-08-28 10:42:27 -0400680 EXPECT_TRUE(matchProbe(j, v));
681}
682
683TEST(MatchProbe, doubleNeqDouble)
684{
685 nlohmann::json j = R"(-124.3)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930686 DBusValueVariant v = double(-124.2);
Brad Bishop3bd8e8d2020-08-28 10:42:27 -0400687 EXPECT_FALSE(matchProbe(j, v));
688}
689
Brad Bishop5d525412020-08-26 08:50:50 -0400690TEST(MatchProbe, doubleNeqEmpty)
Brad Bishop3bd8e8d2020-08-28 10:42:27 -0400691{
692 nlohmann::json j = R"(-11.0)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930693 DBusValueVariant v;
Brad Bishop5d525412020-08-26 08:50:50 -0400694 EXPECT_FALSE(matchProbe(j, v));
Brad Bishop3bd8e8d2020-08-28 10:42:27 -0400695}
Brad Bishopd14c2e22020-08-28 10:43:40 -0400696
Brad Bishopcd1868e2020-08-28 17:58:52 -0400697TEST(MatchProbe, doubleNeqArray)
698{
699 nlohmann::json j = R"(-11.2)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930700 DBusValueVariant v = std::vector<uint8_t>{11};
Brad Bishopcd1868e2020-08-28 17:58:52 -0400701 EXPECT_FALSE(matchProbe(j, v));
702}
703
Brad Bishopd14c2e22020-08-28 10:43:40 -0400704TEST(MatchProbe, arrayNeqString)
705{
706 nlohmann::json j = R"([1, 2])"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930707 DBusValueVariant v = "hello"s;
Brad Bishopd14c2e22020-08-28 10:43:40 -0400708 EXPECT_FALSE(matchProbe(j, v));
709}
710
711TEST(MatchProbe, arrayNeqFalse)
712{
713 nlohmann::json j = R"([1, 2])"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930714 DBusValueVariant v = false;
Brad Bishopd14c2e22020-08-28 10:43:40 -0400715 EXPECT_FALSE(matchProbe(j, v));
716}
717
718TEST(MatchProbe, arrayNeqTrue)
719{
720 nlohmann::json j = R"([1, 2])"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930721 DBusValueVariant v = true;
Brad Bishopd14c2e22020-08-28 10:43:40 -0400722 EXPECT_FALSE(matchProbe(j, v));
723}
724
725TEST(MatchProbe, arrayNeqUint8)
726{
727 nlohmann::json j = R"([1, 2])"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930728 DBusValueVariant v = uint8_t(1);
Brad Bishopd14c2e22020-08-28 10:43:40 -0400729 EXPECT_FALSE(matchProbe(j, v));
730}
731
732TEST(MatchProbe, arrayNeqInt32)
733{
734 nlohmann::json j = R"([1, 2])"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930735 DBusValueVariant v = int32_t(-1);
Brad Bishopd14c2e22020-08-28 10:43:40 -0400736 EXPECT_FALSE(matchProbe(j, v));
737}
738
739TEST(MatchProbe, arrayNeqDouble)
740{
741 nlohmann::json j = R"([1, 2])"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930742 DBusValueVariant v = double(1.1);
Brad Bishopd14c2e22020-08-28 10:43:40 -0400743 EXPECT_FALSE(matchProbe(j, v));
744}
Brad Bishop6660e2a2020-08-28 10:44:41 -0400745
Brad Bishopcd1868e2020-08-28 17:58:52 -0400746TEST(MatchProbe, arrayEqArray)
747{
748 nlohmann::json j = R"([1, 2])"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930749 DBusValueVariant v = std::vector<uint8_t>{1, 2};
Brad Bishopcd1868e2020-08-28 17:58:52 -0400750 EXPECT_TRUE(matchProbe(j, v));
751}
752
753TEST(MatchProbe, arrayNeqArrayDiffSize1)
754{
755 nlohmann::json j = R"([1, 2, 3])"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930756 DBusValueVariant v = std::vector<uint8_t>{1, 2};
Brad Bishopcd1868e2020-08-28 17:58:52 -0400757 EXPECT_FALSE(matchProbe(j, v));
758}
759
760TEST(MatchProbe, arrayNeqArrayDiffSize2)
761{
762 nlohmann::json j = R"([1, 2])"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930763 DBusValueVariant v = std::vector<uint8_t>{1, 2, 3};
Brad Bishopcd1868e2020-08-28 17:58:52 -0400764 EXPECT_FALSE(matchProbe(j, v));
765}
766
767TEST(MatchProbe, emptyArrayEqEmptyArray)
768{
769 nlohmann::json j = R"([])"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930770 DBusValueVariant v = std::vector<uint8_t>{};
Brad Bishopcd1868e2020-08-28 17:58:52 -0400771 EXPECT_TRUE(matchProbe(j, v));
772}
773
774TEST(MatchProbe, emptyArrayNeqArray)
775{
776 nlohmann::json j = R"([])"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930777 DBusValueVariant v = std::vector<uint8_t>{1};
Brad Bishopcd1868e2020-08-28 17:58:52 -0400778 EXPECT_FALSE(matchProbe(j, v));
779}
780
781TEST(MatchProbe, arrayNeqEmptyArray)
782{
783 nlohmann::json j = R"([1])"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930784 DBusValueVariant v = std::vector<uint8_t>{};
Brad Bishopcd1868e2020-08-28 17:58:52 -0400785 EXPECT_FALSE(matchProbe(j, v));
786}
787
Brad Bishop6660e2a2020-08-28 10:44:41 -0400788TEST(MatchProbe, objNeqString)
789{
790 nlohmann::json j = R"({"foo": "bar"})"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930791 DBusValueVariant v = "hello"s;
Brad Bishop6660e2a2020-08-28 10:44:41 -0400792 EXPECT_FALSE(matchProbe(j, v));
793}
794
795TEST(MatchProbe, objNeqFalse)
796{
797 nlohmann::json j = R"({"foo": "bar"})"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930798 DBusValueVariant v = false;
Brad Bishop6660e2a2020-08-28 10:44:41 -0400799 EXPECT_FALSE(matchProbe(j, v));
800}
801
802TEST(MatchProbe, objNeqTrue)
803{
804 nlohmann::json j = R"({"foo": "bar"})"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930805 DBusValueVariant v = true;
Brad Bishop6660e2a2020-08-28 10:44:41 -0400806 EXPECT_FALSE(matchProbe(j, v));
807}
808
809TEST(MatchProbe, objNeqUint8)
810{
811 nlohmann::json j = R"({"foo": "bar"})"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930812 DBusValueVariant v = uint8_t(1);
Brad Bishop6660e2a2020-08-28 10:44:41 -0400813 EXPECT_FALSE(matchProbe(j, v));
814}
815
816TEST(MatchProbe, objNeqInt32)
817{
818 nlohmann::json j = R"({"foo": "bar"})"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930819 DBusValueVariant v = int32_t(-1);
Brad Bishop6660e2a2020-08-28 10:44:41 -0400820 EXPECT_FALSE(matchProbe(j, v));
821}
822
823TEST(MatchProbe, objNeqDouble)
824{
825 nlohmann::json j = R"({"foo": "bar"})"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930826 DBusValueVariant v = double(1.1);
Brad Bishop6660e2a2020-08-28 10:44:41 -0400827 EXPECT_FALSE(matchProbe(j, v));
828}
Brad Bishopc776c412020-08-28 10:45:25 -0400829
Brad Bishopcd1868e2020-08-28 17:58:52 -0400830TEST(MatchProbe, objNeqArray)
831{
832 nlohmann::json j = R"({"foo": "bar"})"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930833 DBusValueVariant v = std::vector<uint8_t>{1, 2};
Brad Bishopcd1868e2020-08-28 17:58:52 -0400834 EXPECT_FALSE(matchProbe(j, v));
835}
836
Brad Bishopc776c412020-08-28 10:45:25 -0400837TEST(MatchProbe, nullNeqString)
838{
839 nlohmann::json j = R"(null)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930840 DBusValueVariant v = "hello"s;
Brad Bishopc776c412020-08-28 10:45:25 -0400841 EXPECT_FALSE(matchProbe(j, v));
842}
843
844TEST(MatchProbe, nullNeqFalse)
845{
846 nlohmann::json j = R"(null)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930847 DBusValueVariant v = false;
Brad Bishopc776c412020-08-28 10:45:25 -0400848 EXPECT_FALSE(matchProbe(j, v));
849}
850
851TEST(MatchProbe, nullNeqTrue)
852{
853 nlohmann::json j = R"(null)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930854 DBusValueVariant v = true;
Brad Bishopc776c412020-08-28 10:45:25 -0400855 EXPECT_FALSE(matchProbe(j, v));
856}
857
858TEST(MatchProbe, nullNeqUint8)
859{
860 nlohmann::json j = R"(null)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930861 DBusValueVariant v = uint8_t(1);
Brad Bishopc776c412020-08-28 10:45:25 -0400862 EXPECT_FALSE(matchProbe(j, v));
863}
864
865TEST(MatchProbe, nullNeqInt32)
866{
867 nlohmann::json j = R"(null)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930868 DBusValueVariant v = int32_t(-1);
Brad Bishopc776c412020-08-28 10:45:25 -0400869 EXPECT_FALSE(matchProbe(j, v));
870}
871
872TEST(MatchProbe, nullNeqDouble)
873{
874 nlohmann::json j = R"(null)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930875 DBusValueVariant v = double(1.1);
Brad Bishopc776c412020-08-28 10:45:25 -0400876 EXPECT_FALSE(matchProbe(j, v));
877}
Brad Bishopcd1868e2020-08-28 17:58:52 -0400878
879TEST(MatchProbe, nullNeqArray)
880{
881 nlohmann::json j = R"(null)"_json;
Andrew Jefferyeab49292022-04-05 14:42:20 +0930882 DBusValueVariant v = std::vector<uint8_t>{};
Brad Bishopcd1868e2020-08-28 17:58:52 -0400883 EXPECT_FALSE(matchProbe(j, v));
884}