-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9f20452
commit 3404427
Showing
7 changed files
with
198 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
// | ||
// Copyright (c) 2019 Vinnie Falco ([email protected]) | ||
// Copyright (c) 2022 Dmitry Arkhipov ([email protected]) | ||
// | ||
// Distributed under the Boost Software License, Version 1.0. (See accompanying | ||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | ||
|
@@ -42,6 +43,12 @@ class parse_test | |
return; | ||
BOOST_TEST( | ||
serialize(jv) == s); | ||
|
||
std::stringstream ss(s); | ||
auto jv2 = parse(ss, ec); | ||
if(! BOOST_TEST(! ec)) | ||
return; | ||
BOOST_TEST( jv == jv2 ); | ||
} | ||
|
||
template <class ErrorCode> | ||
|
@@ -52,6 +59,12 @@ class parse_test | |
auto jv = parse(s, ec); | ||
BOOST_TEST(ec); | ||
BOOST_TEST(hasLocation(ec)); | ||
|
||
ec = {}; | ||
std::stringstream ss(s); | ||
auto jv2 = parse(ss, ec); | ||
BOOST_TEST(ec); | ||
BOOST_TEST(hasLocation(ec)); | ||
} | ||
|
||
void | ||
|
@@ -73,6 +86,7 @@ class parse_test | |
{ | ||
good("null"); | ||
good("[1,2,3]"); | ||
good("17"); | ||
bad ("[1,2,3] #"); | ||
bad ("555415214748364655415E2147483646"); | ||
bad ("9.88874836020e-2147483640"); | ||
|
@@ -178,12 +192,24 @@ class parse_test | |
BOOST_TEST(arr == array{123}); | ||
} | ||
|
||
void | ||
testIstream() | ||
{ | ||
std::stringstream ss("null"); | ||
parse(ss); // does not throw | ||
|
||
ss.clear(); | ||
ss.setstate(std::ios::failbit); | ||
BOOST_TEST_THROWS( parse(ss), system_error ); | ||
} | ||
|
||
void | ||
run() | ||
{ | ||
testParse(); | ||
testMemoryUsage(); | ||
testIssue726(); | ||
testIstream(); | ||
} | ||
}; | ||
|
||
|