Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
json
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
json
Commits
b5d1755d
Unverified
Commit
b5d1755d
authored
Apr 22, 2018
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🔥
removed commented-out test cases #1060
parent
0ab8fab3
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
7 additions
and
385 deletions
+7
-385
test/src/unit-allocator.cpp
test/src/unit-allocator.cpp
+0
-23
test/src/unit-cbor.cpp
test/src/unit-cbor.cpp
+1
-25
test/src/unit-class_lexer.cpp
test/src/unit-class_lexer.cpp
+0
-11
test/src/unit-regression.cpp
test/src/unit-regression.cpp
+6
-41
test/src/unit-ubjson.cpp
test/src/unit-ubjson.cpp
+0
-285
No files found.
test/src/unit-allocator.cpp
View file @
b5d1755d
...
...
@@ -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"
)
...
...
test/src/unit-cbor.cpp
View file @
b5d1755d
...
...
@@ -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"
)
...
...
test/src/unit-class_lexer.cpp
View file @
b5d1755d
...
...
@@ -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");
}
*/
}
test/src/unit-regression.cpp
View file @
b5d1755d
...
...
@@ -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
};
...
...
test/src/unit-ubjson.cpp
View file @
b5d1755d
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment