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

Method testUDT

test/serializer.cpp:774–895  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

772 }
773
774 void
775 testUDT()
776 {
777 {
778 check_udt(nullptr, "null");
779
780 auto np = nullptr;
781 check_udt(np, "null");
782 }
783 {
784 bool b = true;
785 check_udt(b, "true");
786
787 b = false;
788 check_udt(b, "false");
789 }
790 {
791 std::uint64_t u = 1;
792 check_udt(u, "1");
793
794 u = (std::numeric_limits<std::int64_t>::max)();
795 u += 1;
796 check_udt(u, "9223372036854775808");
797
798 std::int64_t i = -1;
799 check_udt(i, "-1");
800
801 double d = 3.12;
802 check_udt(d, "3.12E0");
803
804#if defined(BOOST_HAS_INT128) && defined(__GLIBCXX_TYPE_INT_N_0)
805 boost::int128_type ii =
806 (std::numeric_limits<std::uint64_t>::max)();
807 ii += 1;
808 d = ii;
809 check_udt( ii, serialize(value(d)) );
810
811 ii = (std::numeric_limits<std::int64_t>::min)();
812 ii -= 1;
813 d = ii;
814 check_udt( ii, serialize(value(d)) );
815#endif
816 }
817 {
818 std::string s = "fairly long string which avoids SBO";
819 check_udt(s, "\"fairly long string which avoids SBO\"");
820 }
821 {
822 std::vector<int> v = {1,2,3,4,5};
823 check_udt(v, "[1,2,3,4,5]");
824 }
825 {
826 std::map<std::string, int> v = {
827 {"a", 1}, {"b", 2}, {"c", 3}, {"d", 4}, {"e", 5}};
828 check_udt(v, R"({"a":1,"b":2,"c":3,"d":4,"e":5})");
829 }
830 {
831 check_udt(

Callers

nothing calls this directly

Calls 3

serializeFunction · 0.85
my_enumEnum · 0.85
valueClass · 0.70

Tested by

no test coverage detected