1 #include "Utils.hpp" 2 3 #include <boost/container/flat_map.hpp> 4 #include <nlohmann/json.hpp> 5 6 #include <regex> 7 #include <string> 8 #include <variant> 9 10 #include "gtest/gtest.h" 11 12 using namespace std::string_literals; 13 14 TEST(TemplateCharReplace, replaceOneInt) 15 { 16 nlohmann::json j = {{"foo", "$bus"}}; 17 auto it = j.begin(); 18 boost::container::flat_map<std::string, BasicVariantType> data; 19 data["BUS"] = 23; 20 21 templateCharReplace(it, data, 0); 22 23 nlohmann::json expected = 23; 24 EXPECT_EQ(expected, j["foo"]); 25 } 26 27 TEST(TemplateCharReplace, replaceOneStr) 28 { 29 nlohmann::json j = {{"foo", "$TEST"}}; 30 auto it = j.begin(); 31 boost::container::flat_map<std::string, BasicVariantType> data; 32 data["TEST"] = std::string("Test"); 33 34 templateCharReplace(it, data, 0); 35 36 nlohmann::json expected = "Test"; 37 EXPECT_EQ(expected, j["foo"]); 38 } 39 40 TEST(TemplateCharReplace, replaceSecondStr) 41 { 42 nlohmann::json j = {{"foo", "the $TEST"}}; 43 auto it = j.begin(); 44 boost::container::flat_map<std::string, BasicVariantType> data; 45 data["TEST"] = std::string("Test"); 46 47 templateCharReplace(it, data, 0); 48 49 nlohmann::json expected = "the Test"; 50 EXPECT_EQ(expected, j["foo"]); 51 } 52 53 TEST(TemplateCharReplace, replaceMiddleStr) 54 { 55 nlohmann::json j = {{"foo", "the $TEST worked"}}; 56 auto it = j.begin(); 57 boost::container::flat_map<std::string, BasicVariantType> data; 58 data["TEST"] = std::string("Test"); 59 60 templateCharReplace(it, data, 0); 61 62 nlohmann::json expected = "the Test worked"; 63 EXPECT_EQ(expected, j["foo"]); 64 } 65 66 TEST(TemplateCharReplace, replaceLastStr) 67 { 68 nlohmann::json j = {{"foo", "the Test $TEST"}}; 69 auto it = j.begin(); 70 boost::container::flat_map<std::string, BasicVariantType> data; 71 data["TEST"] = 23; 72 73 templateCharReplace(it, data, 0); 74 75 nlohmann::json expected = "the Test 23"; 76 EXPECT_EQ(expected, j["foo"]); 77 } 78 79 TEST(TemplateCharReplace, increment) 80 { 81 nlohmann::json j = {{"foo", "3 plus 1 equals $TEST + 1"}}; 82 auto it = j.begin(); 83 boost::container::flat_map<std::string, BasicVariantType> data; 84 data["TEST"] = 3; 85 86 templateCharReplace(it, data, 0); 87 88 nlohmann::json expected = "3 plus 1 equals 4"; 89 EXPECT_EQ(expected, j["foo"]); 90 } 91 92 TEST(TemplateCharReplace, decrement) 93 { 94 nlohmann::json j = {{"foo", "3 minus 1 equals $TEST - 1 !"}}; 95 auto it = j.begin(); 96 boost::container::flat_map<std::string, BasicVariantType> data; 97 data["TEST"] = 3; 98 99 templateCharReplace(it, data, 0); 100 101 nlohmann::json expected = "3 minus 1 equals 2 !"; 102 EXPECT_EQ(expected, j["foo"]); 103 } 104 105 TEST(TemplateCharReplace, modulus) 106 { 107 nlohmann::json j = {{"foo", "3 mod 2 equals $TEST % 2"}}; 108 auto it = j.begin(); 109 boost::container::flat_map<std::string, BasicVariantType> data; 110 data["TEST"] = 3; 111 112 templateCharReplace(it, data, 0); 113 114 nlohmann::json expected = "3 mod 2 equals 1"; 115 EXPECT_EQ(expected, j["foo"]); 116 } 117 118 TEST(TemplateCharReplace, multiply) 119 { 120 nlohmann::json j = {{"foo", "3 * 2 equals $TEST * 2"}}; 121 auto it = j.begin(); 122 boost::container::flat_map<std::string, BasicVariantType> data; 123 data["TEST"] = 3; 124 125 templateCharReplace(it, data, 0); 126 127 nlohmann::json expected = "3 * 2 equals 6"; 128 EXPECT_EQ(expected, j["foo"]); 129 } 130 131 TEST(TemplateCharReplace, divide) 132 { 133 nlohmann::json j = {{"foo", "4 / 2 equals $TEST / 2"}}; 134 auto it = j.begin(); 135 boost::container::flat_map<std::string, BasicVariantType> data; 136 data["TEST"] = 4; 137 138 templateCharReplace(it, data, 0); 139 140 nlohmann::json expected = "4 / 2 equals 2"; 141 EXPECT_EQ(expected, j["foo"]); 142 } 143 144 TEST(TemplateCharReplace, multiMath) 145 { 146 nlohmann::json j = {{"foo", "4 * 2 % 6 equals $TEST * 2 % 6"}}; 147 auto it = j.begin(); 148 boost::container::flat_map<std::string, BasicVariantType> data; 149 data["TEST"] = 4; 150 151 templateCharReplace(it, data, 0); 152 153 nlohmann::json expected = "4 * 2 % 6 equals 2"; 154 EXPECT_EQ(expected, j["foo"]); 155 } 156 157 TEST(TemplateCharReplace, twoReplacements) 158 { 159 nlohmann::json j = {{"foo", "$FOO $BAR"}}; 160 auto it = j.begin(); 161 boost::container::flat_map<std::string, BasicVariantType> data; 162 data["FOO"] = std::string("foo"); 163 data["BAR"] = std::string("bar"); 164 165 templateCharReplace(it, data, 0); 166 167 nlohmann::json expected = "foo bar"; 168 EXPECT_EQ(expected, j["foo"]); 169 } 170 171 TEST(TemplateCharReplace, twoReplacementsWithMath) 172 { 173 nlohmann::json j = {{"foo", "4 / 2 equals $TEST / 2 $BAR"}}; 174 auto it = j.begin(); 175 boost::container::flat_map<std::string, BasicVariantType> data; 176 data["TEST"] = 4; 177 data["BAR"] = std::string("bar"); 178 179 templateCharReplace(it, data, 0); 180 181 nlohmann::json expected = "4 / 2 equals 2 bar"; 182 EXPECT_EQ(expected, j["foo"]); 183 } 184 185 TEST(TemplateCharReplace, hexAndWrongCase) 186 { 187 nlohmann::json j = {{"Address", "0x54"}, 188 {"Bus", 15}, 189 {"Name", "$bus sensor 0"}, 190 {"Type", "SomeType"}}; 191 192 boost::container::flat_map<std::string, BasicVariantType> data; 193 data["BUS"] = 15; 194 195 for (auto it = j.begin(); it != j.end(); it++) 196 { 197 templateCharReplace(it, data, 0); 198 } 199 nlohmann::json expected = {{"Address", 84}, 200 {"Bus", 15}, 201 {"Name", "15 sensor 0"}, 202 {"Type", "SomeType"}}; 203 EXPECT_EQ(expected, j); 204 } 205 206 TEST(TemplateCharReplace, replaceSecondAsInt) 207 { 208 nlohmann::json j = {{"foo", "twelve is $TEST"}}; 209 auto it = j.begin(); 210 boost::container::flat_map<std::string, BasicVariantType> data; 211 data["test"] = 12; 212 213 templateCharReplace(it, data, 0); 214 215 nlohmann::json expected = "twelve is 12"; 216 EXPECT_EQ(expected, j["foo"]); 217 } 218 219 TEST(TemplateCharReplace, singleHex) 220 { 221 nlohmann::json j = {{"foo", "0x54"}}; 222 auto it = j.begin(); 223 boost::container::flat_map<std::string, BasicVariantType> data; 224 225 templateCharReplace(it, data, 0); 226 227 nlohmann::json expected = 84; 228 EXPECT_EQ(expected, j["foo"]); 229 } 230 231 TEST(MatchProbe, stringEqString) 232 { 233 nlohmann::json j = R"("foo")"_json; 234 BasicVariantType v = "foo"s; 235 EXPECT_TRUE(matchProbe(j, v)); 236 } 237 238 TEST(MatchProbe, stringRegexEqString) 239 { 240 nlohmann::json j = R"("foo*")"_json; 241 BasicVariantType v = "foobar"s; 242 EXPECT_TRUE(matchProbe(j, v)); 243 } 244 245 TEST(MatchProbe, stringNeqString) 246 { 247 nlohmann::json j = R"("foobar")"_json; 248 BasicVariantType v = "foo"s; 249 EXPECT_FALSE(matchProbe(j, v)); 250 } 251 252 TEST(MatchProbe, stringRegexError) 253 { 254 nlohmann::json j = R"("foo[")"_json; 255 BasicVariantType v = "foobar"s; 256 EXPECT_THROW(matchProbe(j, v), std::regex_error); 257 } 258 259 TEST(MatchProbe, stringZeroEqFalse) 260 { 261 nlohmann::json j = R"("0")"_json; 262 BasicVariantType v = false; 263 EXPECT_TRUE(matchProbe(j, v)); 264 } 265 266 TEST(MatchProbe, stringOneEqTrue) 267 { 268 nlohmann::json j = R"("1")"_json; 269 BasicVariantType v = true; 270 EXPECT_TRUE(matchProbe(j, v)); 271 } 272 273 TEST(MatchProbe, stringElevenNeqTrue) 274 { 275 nlohmann::json j = R"("11")"_json; 276 BasicVariantType v = true; 277 EXPECT_FALSE(matchProbe(j, v)); 278 } 279 280 TEST(MatchProbe, stringFalseNeqFalse) 281 { 282 nlohmann::json j = R"("false")"_json; 283 BasicVariantType v = false; 284 EXPECT_FALSE(matchProbe(j, v)); 285 } 286 287 TEST(MatchProbe, stringTrueNeqTrue) 288 { 289 nlohmann::json j = R"("true")"_json; 290 BasicVariantType v = true; 291 EXPECT_FALSE(matchProbe(j, v)); 292 } 293 294 TEST(MatchProbe, stringFalseNeqTrue) 295 { 296 nlohmann::json j = R"("false")"_json; 297 BasicVariantType v = true; 298 EXPECT_FALSE(matchProbe(j, v)); 299 } 300 301 TEST(MatchProbe, stringEqUint8) 302 { 303 nlohmann::json j = R"("255")"_json; 304 BasicVariantType v = uint8_t(255); 305 EXPECT_TRUE(matchProbe(j, v)); 306 } 307 308 TEST(MatchProbe, stringNeqUint8Overflow) 309 { 310 nlohmann::json j = R"("65535")"_json; 311 BasicVariantType v = uint8_t(255); 312 EXPECT_FALSE(matchProbe(j, v)); 313 } 314 315 TEST(MatchProbe, stringFalseNeqUint8Zero) 316 { 317 nlohmann::json j = R"("false")"_json; 318 BasicVariantType v = uint8_t(0); 319 EXPECT_FALSE(matchProbe(j, v)); 320 } 321 322 TEST(MatchProbe, stringTrueNeqUint8Zero) 323 { 324 nlohmann::json j = R"("true")"_json; 325 BasicVariantType v = uint8_t(1); 326 EXPECT_FALSE(matchProbe(j, v)); 327 } 328 329 TEST(MatchProbe, stringEqUint32) 330 { 331 nlohmann::json j = R"("11")"_json; 332 BasicVariantType v = uint32_t(11); 333 EXPECT_TRUE(matchProbe(j, v)); 334 } 335 336 TEST(MatchProbe, stringNeqUint32) 337 { 338 nlohmann::json j = R"("12")"_json; 339 BasicVariantType v = uint32_t(11); 340 EXPECT_FALSE(matchProbe(j, v)); 341 } 342 343 TEST(MatchProbe, stringEqInt32) 344 { 345 nlohmann::json j = R"("-11")"_json; 346 BasicVariantType v = int32_t(-11); 347 EXPECT_TRUE(matchProbe(j, v)); 348 } 349 350 TEST(MatchProbe, stringNeqInt32) 351 { 352 nlohmann::json j = R"("-12")"_json; 353 BasicVariantType v = int32_t(-11); 354 EXPECT_FALSE(matchProbe(j, v)); 355 } 356 357 TEST(MatchProbe, stringRegexEqInt32) 358 { 359 nlohmann::json j = R"("1*4")"_json; 360 BasicVariantType v = int32_t(124); 361 EXPECT_TRUE(matchProbe(j, v)); 362 } 363 364 TEST(MatchProbe, stringNeqUint64) 365 { 366 nlohmann::json j = R"("foo")"_json; 367 BasicVariantType v = uint64_t(65535); 368 EXPECT_FALSE(matchProbe(j, v)); 369 } 370 371 TEST(MatchProbe, stringEqDouble) 372 { 373 nlohmann::json j = R"("123.4")"_json; 374 BasicVariantType v = double(123.4); 375 EXPECT_TRUE(matchProbe(j, v)); 376 } 377 378 TEST(MatchProbe, stringNeqDouble) 379 { 380 nlohmann::json j = R"("-123.4")"_json; 381 BasicVariantType v = double(123.4); 382 EXPECT_FALSE(matchProbe(j, v)); 383 } 384 385 TEST(MatchProbe, stringNeqEmpty) 386 { 387 nlohmann::json j = R"("-123.4")"_json; 388 BasicVariantType v; 389 EXPECT_FALSE(matchProbe(j, v)); 390 } 391 392 TEST(MatchProbe, boolStringError) 393 { 394 nlohmann::json j = R"(false)"_json; 395 BasicVariantType v = "false"s; 396 EXPECT_THROW(matchProbe(j, v), std::invalid_argument); 397 } 398 399 TEST(MatchProbe, trueEqTrue) 400 { 401 nlohmann::json j = R"(true)"_json; 402 BasicVariantType v = true; 403 EXPECT_TRUE(matchProbe(j, v)); 404 } 405 406 TEST(MatchProbe, falseEqFalse) 407 { 408 nlohmann::json j = R"(false)"_json; 409 BasicVariantType v = false; 410 EXPECT_TRUE(matchProbe(j, v)); 411 } 412 413 TEST(MatchProbe, trueNeqFalse) 414 { 415 nlohmann::json j = R"(true)"_json; 416 BasicVariantType v = false; 417 EXPECT_FALSE(matchProbe(j, v)); 418 } 419 420 TEST(MatchProbe, trueNeqInt32Zero) 421 { 422 nlohmann::json j = R"(true)"_json; 423 BasicVariantType v = int32_t(0); 424 EXPECT_FALSE(matchProbe(j, v)); 425 } 426 427 TEST(MatchProbe, trueNeqInt32NegativeOne) 428 { 429 nlohmann::json j = R"(true)"_json; 430 BasicVariantType v = int32_t(-1); 431 EXPECT_FALSE(matchProbe(j, v)); 432 } 433 434 TEST(MatchProbe, falseNeqUint32One) 435 { 436 nlohmann::json j = R"(false)"_json; 437 BasicVariantType v = uint32_t(1); 438 EXPECT_FALSE(matchProbe(j, v)); 439 } 440 441 TEST(MatchProbe, falseEqUint32Zero) 442 { 443 nlohmann::json j = R"(false)"_json; 444 BasicVariantType v = uint32_t(0); 445 EXPECT_TRUE(matchProbe(j, v)); 446 } 447 448 TEST(MatchProbe, trueNeqDoubleNegativeOne) 449 { 450 nlohmann::json j = R"(true)"_json; 451 BasicVariantType v = double(-1.1); 452 EXPECT_FALSE(matchProbe(j, v)); 453 } 454 455 TEST(MatchProbe, trueEqDoubleOne) 456 { 457 nlohmann::json j = R"(true)"_json; 458 BasicVariantType v = double(1.0); 459 EXPECT_TRUE(matchProbe(j, v)); 460 } 461 462 TEST(MatchProbe, falseNeqDoubleOne) 463 { 464 nlohmann::json j = R"(false)"_json; 465 BasicVariantType v = double(1.0); 466 EXPECT_FALSE(matchProbe(j, v)); 467 } 468 469 TEST(MatchProbe, falseEqDoubleZero) 470 { 471 nlohmann::json j = R"(false)"_json; 472 BasicVariantType v = double(0.0); 473 EXPECT_TRUE(matchProbe(j, v)); 474 } 475 476 TEST(MatchProbe, falseEmptyError) 477 { 478 nlohmann::json j = R"(false)"_json; 479 BasicVariantType v; 480 EXPECT_THROW(matchProbe(j, v), std::invalid_argument); 481 } 482 483 TEST(MatchProbe, trueEmptyError) 484 { 485 nlohmann::json j = R"(true)"_json; 486 BasicVariantType v; 487 EXPECT_THROW(matchProbe(j, v), std::invalid_argument); 488 } 489 490 TEST(MatchProbe, uintStringError) 491 { 492 nlohmann::json j = R"(11)"_json; 493 BasicVariantType v = "11"s; 494 EXPECT_THROW(matchProbe(j, v), std::invalid_argument); 495 } 496 497 TEST(MatchProbe, uintEqTrue) 498 { 499 nlohmann::json j = R"(1)"_json; 500 BasicVariantType v = true; 501 EXPECT_TRUE(matchProbe(j, v)); 502 } 503 504 TEST(MatchProbe, uintEqFalse) 505 { 506 nlohmann::json j = R"(0)"_json; 507 BasicVariantType v = false; 508 EXPECT_TRUE(matchProbe(j, v)); 509 } 510 511 TEST(MatchProbe, uintNeqTrue) 512 { 513 nlohmann::json j = R"(11)"_json; 514 BasicVariantType v = true; 515 EXPECT_FALSE(matchProbe(j, v)); 516 } 517 518 TEST(MatchProbe, uintEqUint8) 519 { 520 nlohmann::json j = R"(11)"_json; 521 BasicVariantType v = uint8_t(11); 522 EXPECT_TRUE(matchProbe(j, v)); 523 } 524 525 TEST(MatchProbe, uintNeqUint8) 526 { 527 nlohmann::json j = R"(11)"_json; 528 BasicVariantType v = uint8_t(12); 529 EXPECT_FALSE(matchProbe(j, v)); 530 } 531 532 TEST(MatchProbe, uintNeqUint8Overflow) 533 { 534 nlohmann::json j = R"(65535)"_json; 535 BasicVariantType v = uint8_t(255); 536 EXPECT_FALSE(matchProbe(j, v)); 537 } 538 539 TEST(MatchProbe, uintEqInt8) 540 { 541 nlohmann::json j = R"(11)"_json; 542 BasicVariantType v = int8_t(11); 543 EXPECT_TRUE(matchProbe(j, v)); 544 } 545 546 TEST(MatchProbe, uintEqDouble) 547 { 548 nlohmann::json j = R"(11)"_json; 549 BasicVariantType v = double(11.0); 550 EXPECT_TRUE(matchProbe(j, v)); 551 } 552 553 TEST(MatchProbe, uintEqDoubleRound) 554 { 555 nlohmann::json j = R"(11)"_json; 556 BasicVariantType v = double(11.7); 557 EXPECT_TRUE(matchProbe(j, v)); 558 } 559 560 TEST(MatchProbe, uintEmptyError) 561 { 562 nlohmann::json j = R"(11)"_json; 563 BasicVariantType v; 564 EXPECT_THROW(matchProbe(j, v), std::invalid_argument); 565 } 566 567 TEST(MatchProbe, intStringError) 568 { 569 nlohmann::json j = R"(-11)"_json; 570 BasicVariantType v = "-11"s; 571 EXPECT_THROW(matchProbe(j, v), std::invalid_argument); 572 } 573 574 TEST(MatchProbe, intNeqTrue) 575 { 576 nlohmann::json j = R"(-1)"_json; 577 BasicVariantType v = true; 578 EXPECT_FALSE(matchProbe(j, v)); 579 } 580 581 TEST(MatchProbe, intNeqUint8) 582 { 583 nlohmann::json j = R"(-11)"_json; 584 BasicVariantType v = uint8_t(11); 585 EXPECT_FALSE(matchProbe(j, v)); 586 } 587 588 TEST(MatchProbe, intEqInt8) 589 { 590 nlohmann::json j = R"(-11)"_json; 591 BasicVariantType v = int8_t(-11); 592 EXPECT_TRUE(matchProbe(j, v)); 593 } 594 595 TEST(MatchProbe, intNeqDouble) 596 { 597 nlohmann::json j = R"(-124)"_json; 598 BasicVariantType v = double(-123.0); 599 EXPECT_FALSE(matchProbe(j, v)); 600 } 601 602 TEST(MatchProbe, intEqDouble) 603 { 604 nlohmann::json j = R"(-11)"_json; 605 BasicVariantType v = double(-11.0); 606 EXPECT_TRUE(matchProbe(j, v)); 607 } 608 609 TEST(MatchProbe, intEqDoubleRound) 610 { 611 nlohmann::json j = R"(-11)"_json; 612 BasicVariantType v = double(-11.7); 613 EXPECT_TRUE(matchProbe(j, v)); 614 } 615 616 TEST(MatchProbe, intEmptyError) 617 { 618 nlohmann::json j = R"(-11)"_json; 619 BasicVariantType v; 620 EXPECT_THROW(matchProbe(j, v), std::invalid_argument); 621 } 622 623 TEST(MatchProbe, doubleStringError) 624 { 625 nlohmann::json j = R"(0.0)"_json; 626 BasicVariantType v = "0.0"s; 627 EXPECT_THROW(matchProbe(j, v), std::invalid_argument); 628 } 629 630 TEST(MatchProbe, doubleEqFalse) 631 { 632 nlohmann::json j = R"(0.0)"_json; 633 BasicVariantType v = false; 634 EXPECT_TRUE(matchProbe(j, v)); 635 } 636 637 TEST(MatchProbe, doubleNeqTrue) 638 { 639 nlohmann::json j = R"(1.1)"_json; 640 BasicVariantType v = true; 641 EXPECT_FALSE(matchProbe(j, v)); 642 } 643 644 TEST(MatchProbe, doubleEqTrue) 645 { 646 nlohmann::json j = R"(1.0)"_json; 647 BasicVariantType v = true; 648 EXPECT_TRUE(matchProbe(j, v)); 649 } 650 651 TEST(MatchProbe, doubleEqInt32) 652 { 653 nlohmann::json j = R"(-124.0)"_json; 654 BasicVariantType v = int32_t(-124); 655 EXPECT_TRUE(matchProbe(j, v)); 656 } 657 658 TEST(MatchProbe, doubleNeqInt32) 659 { 660 nlohmann::json j = R"(-124.0)"_json; 661 BasicVariantType v = int32_t(-123); 662 EXPECT_FALSE(matchProbe(j, v)); 663 } 664 665 TEST(MatchProbe, doubleRoundNeqInt) 666 { 667 nlohmann::json j = R"(124.7)"_json; 668 BasicVariantType v = int32_t(124); 669 EXPECT_FALSE(matchProbe(j, v)); 670 } 671 TEST(MatchProbe, doubleEqDouble) 672 { 673 nlohmann::json j = R"(-124.2)"_json; 674 BasicVariantType v = double(-124.2); 675 EXPECT_TRUE(matchProbe(j, v)); 676 } 677 678 TEST(MatchProbe, doubleNeqDouble) 679 { 680 nlohmann::json j = R"(-124.3)"_json; 681 BasicVariantType v = double(-124.2); 682 EXPECT_FALSE(matchProbe(j, v)); 683 } 684 685 TEST(MatchProbe, doubleEmptyError) 686 { 687 nlohmann::json j = R"(-11.0)"_json; 688 BasicVariantType v; 689 EXPECT_THROW(matchProbe(j, v), std::invalid_argument); 690 } 691 692 TEST(MatchProbe, arrayNeqString) 693 { 694 nlohmann::json j = R"([1, 2])"_json; 695 BasicVariantType v = "hello"s; 696 EXPECT_FALSE(matchProbe(j, v)); 697 } 698 699 TEST(MatchProbe, arrayNeqFalse) 700 { 701 nlohmann::json j = R"([1, 2])"_json; 702 BasicVariantType v = false; 703 EXPECT_FALSE(matchProbe(j, v)); 704 } 705 706 TEST(MatchProbe, arrayNeqTrue) 707 { 708 nlohmann::json j = R"([1, 2])"_json; 709 BasicVariantType v = true; 710 EXPECT_FALSE(matchProbe(j, v)); 711 } 712 713 TEST(MatchProbe, arrayNeqUint8) 714 { 715 nlohmann::json j = R"([1, 2])"_json; 716 BasicVariantType v = uint8_t(1); 717 EXPECT_FALSE(matchProbe(j, v)); 718 } 719 720 TEST(MatchProbe, arrayNeqInt32) 721 { 722 nlohmann::json j = R"([1, 2])"_json; 723 BasicVariantType v = int32_t(-1); 724 EXPECT_FALSE(matchProbe(j, v)); 725 } 726 727 TEST(MatchProbe, arrayNeqDouble) 728 { 729 nlohmann::json j = R"([1, 2])"_json; 730 BasicVariantType v = double(1.1); 731 EXPECT_FALSE(matchProbe(j, v)); 732 } 733 734 TEST(MatchProbe, objNeqString) 735 { 736 nlohmann::json j = R"({"foo": "bar"})"_json; 737 BasicVariantType v = "hello"s; 738 EXPECT_FALSE(matchProbe(j, v)); 739 } 740 741 TEST(MatchProbe, objNeqFalse) 742 { 743 nlohmann::json j = R"({"foo": "bar"})"_json; 744 BasicVariantType v = false; 745 EXPECT_FALSE(matchProbe(j, v)); 746 } 747 748 TEST(MatchProbe, objNeqTrue) 749 { 750 nlohmann::json j = R"({"foo": "bar"})"_json; 751 BasicVariantType v = true; 752 EXPECT_FALSE(matchProbe(j, v)); 753 } 754 755 TEST(MatchProbe, objNeqUint8) 756 { 757 nlohmann::json j = R"({"foo": "bar"})"_json; 758 BasicVariantType v = uint8_t(1); 759 EXPECT_FALSE(matchProbe(j, v)); 760 } 761 762 TEST(MatchProbe, objNeqInt32) 763 { 764 nlohmann::json j = R"({"foo": "bar"})"_json; 765 BasicVariantType v = int32_t(-1); 766 EXPECT_FALSE(matchProbe(j, v)); 767 } 768 769 TEST(MatchProbe, objNeqDouble) 770 { 771 nlohmann::json j = R"({"foo": "bar"})"_json; 772 BasicVariantType v = double(1.1); 773 EXPECT_FALSE(matchProbe(j, v)); 774 } 775