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