🔥 removed commented-out test cases #1060

parent 0ab8fab3
......@@ -175,29 +175,6 @@ TEST_CASE("controlled bad_alloc")
CHECK_THROWS_AS(my_json::json_value(v), std::bad_alloc&);
next_construct_fails = false;
}
/*
SECTION("json_value(const object_t&)")
{
next_construct_fails = false;
my_json::object_t v {{"foo", "bar"}};
CHECK_NOTHROW(my_json::json_value j(v));
next_construct_fails = true;
CHECK_THROWS_AS(my_json::json_value j(v), std::bad_alloc&);
next_construct_fails = false;
}
*/
/*
SECTION("json_value(const array_t&)")
{
next_construct_fails = false;
my_json::array_t v = {"foo", "bar", "baz"};
CHECK_NOTHROW(my_json::json_value j(v));
next_construct_fails = true;
CHECK_THROWS_AS(my_json::json_value j(v), std::bad_alloc&);
next_construct_fails = false;
}
*/
}
SECTION("class basic_json")
......
......@@ -491,7 +491,6 @@ TEST_CASE("CBOR")
}
}
/*
SECTION("-32768..-129 (int 16)")
{
for (int16_t i = -32768; i <= -129; ++i)
......@@ -517,14 +516,13 @@ TEST_CASE("CBOR")
// check individual bytes
CHECK(result[0] == 0xd1);
int16_t restored = (result[1] << 8) + result[2];
int16_t restored = static_cast<int16_t>((result[1] << 8) + result[2]);
CHECK(restored == i);
// roundtrip
CHECK(json::from_msgpack(result) == j);
}
}
*/
}
SECTION("unsigned")
......@@ -1044,28 +1042,6 @@ TEST_CASE("CBOR")
// roundtrip
CHECK(json::from_cbor(result) == j);
}
/*
SECTION("array with uint64_t elements")
{
json j(4294967296, nullptr);
std::vector<uint8_t> expected(j.size() + 9, 0xf6); // all null
expected[0] = 0x9b; // array 64 bit
expected[1] = 0x00; // size (0x0000000100000000), byte 0
expected[2] = 0x00; // size (0x0000000100000000), byte 1
expected[3] = 0x00; // size (0x0000000100000000), byte 2
expected[4] = 0x01; // size (0x0000000100000000), byte 3
expected[5] = 0x00; // size (0x0000000100000000), byte 4
expected[6] = 0x00; // size (0x0000000100000000), byte 5
expected[7] = 0x00; // size (0x0000000100000000), byte 6
expected[8] = 0x00; // size (0x0000000100000000), byte 7
const auto result = json::to_cbor(j);
CHECK(result == expected);
// roundtrip
CHECK(json::from_cbor(result) == j);
}
*/
}
SECTION("object")
......
......@@ -173,15 +173,4 @@ TEST_CASE("lexer class")
s += "\"";
CHECK((scan_string(s.c_str()) == json::lexer::token_type::value_string));
}
/* NOTE: to_unicode function has been removed
SECTION("to_unicode")
{
// lexer to call to_unicode on
json::lexer dummy_lexer("", 0);
CHECK(dummy_lexer.to_unicode(0x1F4A9) == "💩");
CHECK_THROWS_AS(dummy_lexer.to_unicode(0x200000), json::parse_error);
CHECK_THROWS_WITH(dummy_lexer.to_unicode(0x200000), "[json.exception.parse_error.103] parse error: code points above 0x10FFFF are invalid");
}
*/
}
......@@ -136,19 +136,19 @@ TEST_CASE("regression tests")
SECTION("issue #70 - Handle infinity and NaN cases")
{
/*
// previously, NAN/INFINITY created a null value; now, the values are
// properly stored, but are dumped as "null"
SECTION("NAN value")
{
CHECK(json(NAN) == json());
CHECK(json(json::number_float_t(NAN)) == json());
CHECK(json(NAN).dump() == "null");
CHECK(json(json::number_float_t(NAN)).dump() == "null");
}
SECTION("infinity")
{
CHECK(json(INFINITY) == json());
CHECK(json(json::number_float_t(INFINITY)) == json());
CHECK(json(INFINITY).dump() == "null");
CHECK(json(json::number_float_t(INFINITY)).dump() == "null");
}
*/
// With 3.0.0, the semantics of this changed: NAN and infinity are
// stored properly inside the JSON value (no exception or conversion
......@@ -1213,41 +1213,6 @@ TEST_CASE("regression tests")
CHECK(j["bool_vector"].dump() == "[false,true,false,false]");
}
/* NOTE: m_line_buffer is not used any more
SECTION("issue #495 - fill_line_buffer incorrectly tests m_stream for eof but not fail or bad bits")
{
SECTION("setting failbit")
{
std::stringstream ss;
ss << "[1,2,3\n,4,5]";
json::lexer l(ss);
CHECK(l.m_line_buffer == "[1,2,3\n");
l.m_stream->setstate(std::ios_base::failbit);
CHECK_THROWS_AS(l.fill_line_buffer(), json::parse_error&);
CHECK_THROWS_WITH(l.fill_line_buffer(), "[json.exception.parse_error.111] parse error: bad input stream");
}
SECTION("setting badbit")
{
std::stringstream ss;
ss << "[1,2,3\n,4,5]";
json::lexer l(ss);
CHECK(l.m_line_buffer == "[1,2,3\n");
l.m_stream->setstate(std::ios_base::badbit);
CHECK_THROWS_AS(l.fill_line_buffer(), json::parse_error&);
CHECK_THROWS_WITH(l.fill_line_buffer(), "[json.exception.parse_error.111] parse error: bad input stream");
}
}
*/
SECTION("issue #504 - assertion error (OSS-Fuzz 856)")
{
std::vector<uint8_t> vec1 = {0xf9, 0xff, 0xff, 0x4a, 0x3a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x37, 0x02, 0x38};
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment