MCPcopy Create free account
hub / github.com/boostorg/json / testParser

Function testParser

test/basic_parser.cpp:702–798  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

700 }
701
702 void
703 testParser()
704 {
705 auto const check =
706 [this]( string_view s,
707 bool done)
708 {
709 fail_parser p;
710 system::error_code ec;
711 p.write_some(
712 true,
713 s.data(), s.size(),
714 ec);
715 if(! BOOST_TEST(! ec))
716 {
717 log << " failed to parse: " << s << '\n';
718 return;
719 }
720 BOOST_TEST(done == p.done());
721 };
722
723 // done()
724
725 check("{}", true);
726 check("{} ", true);
727 check("{}x", true);
728 check("{} x", true);
729
730 check("[]", true);
731 check("[] ", true);
732 check("[]x", true);
733 check("[] x", true);
734
735 check("\"a\"", true);
736 check("\"a\" ", true);
737 check("\"a\"x", true);
738 check("\"a\" x", true);
739
740 check("0", false);
741 check("0 ", true);
742 check("0x", true);
743 check("0 x", true);
744 check("0.", false);
745 check("0.0", false);
746 check("0.0 ", true);
747 check("0.0 x", true);
748
749 check("true", true);
750 check("true ", true);
751 check("truex", true);
752 check("true x", true);
753
754 check("false", true);
755 check("false ", true);
756 check("falsex", true);
757 check("false x", true);
758
759 check("null", true);

Callers 2

runFunction · 0.85
runMethod · 0.85

Calls 7

checkFunction · 0.85
stringClass · 0.50
write_someMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
doneMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected