Lines Matching refs:value
56 struct foo_serializer<T, typename std::enable_if<std::is_same<foo, T>::value>::type>
59 static void to_json(BasicJsonType& j, const T& value)
61 j = BasicJsonType{{"x", value.x}};
64 static void from_json(const BasicJsonType& j, T& value) // !!!
66 nlohmann::from_json(j.at("x"), value.x);
71 struct foo_serializer < T, typename std::enable_if < !std::is_same<foo, T>::value >::type >
74 static void to_json(BasicJsonType& j, const T& value) noexcept // NOLINT(bugprone-exception-escape)
76 ::nlohmann::to_json(j, value);
79 static void from_json(const BasicJsonType& j, T& value) //!!!
81 ::nlohmann::from_json(j, value);
127 // previously, NAN/INFINITY created a null value; now, the values are
129 SECTION("NAN value")
142 // stored properly inside the JSON value (no exception or conversion
144 SECTION("NAN value")
183 // check if the actual value was stored
186 static_assert(std::is_same<decltype(anon_enum_value), decltype(u)>::value, "types must be the same");
287 CHECK(rit.value() == json(2));
293 CHECK(rit.value() == json(2));
330 ss << it.key() << ": " << it.value() << '\n';
335 ss << it.key() << ": " << it.value() << '\n';
364 json o = {{"name", "value"}};
367 CHECK(s1 == "value");
372 CHECK(s2 == "value");
579 json data = {{"key", "value"}};
583 CHECK(data == json({{"key", "value"}, {"key2", "value2"}, {"key3", "value3"}}));
595 SECTION("issue #283 - value() does not work with _json_pointer types")
603 int val_integer = j.value("/object/key2"_json_pointer, 0);
656 SECTION("issue #329 - serialized value not always can be parsed")
724 CHECK_THROWS_WITH_AS(_ = json::parse(f), "[json.exception.parse_error.101] parse error at line 1, column 1: syntax error while parsing value - unexpected end of input; expected '[', '{', or a literal", json::parse_error&);
738 CHECK_THROWS_WITH_AS(ss >> j, "[json.exception.parse_error.101] parse error at line 1, column 1: syntax error while parsing value - unexpected end of input; expected '[', '{', or a literal", json::parse_error&);
747 CHECK_THROWS_WITH_AS(ss >> j, "[json.exception.parse_error.101] parse error at line 1, column 1: syntax error while parsing value - unexpected end of input; expected '[', '{', or a literal", json::parse_error&);
756 "[json.exception.parse_error.101] parse error at line 1, column 4: syntax error while parsing value - unexpected end of input; expected '[', '{', or a literal", json::parse_error&);
759 SECTION("one value")
767 CHECK_THROWS_WITH_AS(ss >> j, "[json.exception.parse_error.101] parse error at line 1, column 1: syntax error while parsing value - unexpected end of input; expected '[', '{', or a literal", json::parse_error&);
770 SECTION("one value + whitespace")
779 "[json.exception.parse_error.101] parse error at line 2, column 1: syntax error while parsing value - unexpected end of input; expected '[', '{', or a literal", json::parse_error&);
782 SECTION("whitespace + one value")
790 CHECK_THROWS_WITH_AS(ss >> j, "[json.exception.parse_error.101] parse error at line 1, column 1: syntax error while parsing value - unexpected end of input; expected '[', '{', or a literal", json::parse_error&);
805 CHECK_THROWS_WITH_AS(ss >> j, "[json.exception.parse_error.101] parse error at line 1, column 1: syntax error while parsing value - unexpected end of input; expected '[', '{', or a literal", json::parse_error&);
822 CHECK_THROWS_WITH_AS(ss >> j, "[json.exception.parse_error.101] parse error at line 1, column 1: syntax error while parsing value - unexpected end of input; expected '[', '{', or a literal", json::parse_error&);
835 CHECK_THROWS_WITH_AS(ss >> j, "[json.exception.parse_error.101] parse error at line 1, column 1: syntax error while parsing value - unexpected end of input; expected '[', '{', or a literal", json::parse_error&);
970 CHECK_THROWS_WITH_AS(_ = json::from_cbor(vec2), "[json.exception.parse_error.110] parse error at byte 1: syntax error while parsing CBOR value: unexpected end of input", json::parse_error&);
971 CHECK_THROWS_WITH_AS(_ = json::from_msgpack(vec2), "[json.exception.parse_error.110] parse error at byte 1: syntax error while parsing MessagePack value: unexpected end of input", json::parse_error&);
984 CHECK_THROWS_WITH_AS(_ = json::from_cbor(vec2), "[json.exception.parse_error.110] parse error at byte 2: syntax error while parsing CBOR value: unexpected end of input", json::parse_error&);
1024 CHECK_THROWS_WITH_AS(_ = json::from_cbor(vec2), "[json.exception.parse_error.110] parse error at byte 3: syntax error while parsing CBOR value: unexpected end of input", json::parse_error&);
1049 SECTION("issue #416 - Use-of-uninitialized-value (OSS-Fuzz issue 377)")