Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
json
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
json
Commits
f1bd2069
Commit
f1bd2069
authored
Feb 11, 2015
by
Niels
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
number test cases
parent
463c38df
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
7 deletions
+31
-7
json.hpp
src/json.hpp
+0
-1
json.hpp.re2c
src/json.hpp.re2c
+0
-1
unit.cpp
test/unit.cpp
+31
-5
No files found.
src/json.hpp
View file @
f1bd2069
...
@@ -3207,7 +3207,6 @@ json_parser_62:
...
@@ -3207,7 +3207,6 @@ json_parser_62:
// check if strtod read beyond the end of the lexem
// check if strtod read beyond the end of the lexem
if
(
endptr
!=
m_cursor
)
if
(
endptr
!=
m_cursor
)
{
{
std
::
cerr
<<
get_string_value
()
<<
std
::
endl
;
return
NAN
;
return
NAN
;
}
}
else
else
...
...
src/json.hpp.re2c
View file @
f1bd2069
...
@@ -2566,7 +2566,6 @@ class basic_json
...
@@ -2566,7 +2566,6 @@ class basic_json
// check if strtod read beyond the end of the lexem
// check if strtod read beyond the end of the lexem
if (endptr != m_cursor)
if (endptr != m_cursor)
{
{
std::cerr << get_string_value() << std::endl;
return NAN;
return NAN;
}
}
else
else
...
...
test/unit.cpp
View file @
f1bd2069
...
@@ -3799,8 +3799,6 @@ TEST_CASE("lexicographical comparison operators")
...
@@ -3799,8 +3799,6 @@ TEST_CASE("lexicographical comparison operators")
{
{
for
(
size_t
j
=
0
;
j
<
j_values
.
size
();
++
j
)
for
(
size_t
j
=
0
;
j
<
j_values
.
size
();
++
j
)
{
{
CAPTURE
(
i
);
CAPTURE
(
j
);
// check precomputed values
// check precomputed values
CHECK
(
(
j_values
[
i
]
<
j_values
[
j
])
==
expected
[
i
][
j
]
);
CHECK
(
(
j_values
[
i
]
<
j_values
[
j
])
==
expected
[
i
][
j
]
);
}
}
...
@@ -4044,9 +4042,6 @@ TEST_CASE("lexer class")
...
@@ -4044,9 +4042,6 @@ TEST_CASE("lexer class")
{
{
auto
s
=
std
::
string
(
1
,
c
);
auto
s
=
std
::
string
(
1
,
c
);
CAPTURE
(
c
);
CAPTURE
(
s
);
switch
(
c
)
switch
(
c
)
{
{
// characters that are prefixes of reasonable json
// characters that are prefixes of reasonable json
...
@@ -4116,5 +4111,36 @@ TEST_CASE("parser class")
...
@@ -4116,5 +4111,36 @@ TEST_CASE("parser class")
{
{
CHECK
(
json
::
parser
(
"false"
).
parse
()
==
json
(
false
));
CHECK
(
json
::
parser
(
"false"
).
parse
()
==
json
(
false
));
}
}
SECTION
(
"number"
)
{
SECTION
(
"integers"
)
{
SECTION
(
"without exponent"
)
{
CHECK
(
json
::
parser
(
"-128"
).
parse
()
==
json
(
-
128
));
CHECK
(
json
::
parser
(
"0"
).
parse
()
==
json
(
0
));
CHECK
(
json
::
parser
(
"128"
).
parse
()
==
json
(
128
));
}
SECTION
(
"with exponent"
)
{
CHECK
(
json
::
parser
(
"10000E-4"
).
parse
()
==
json
(
10000e-4
));
CHECK
(
json
::
parser
(
"10000E-3"
).
parse
()
==
json
(
10000e-3
));
CHECK
(
json
::
parser
(
"10000E-2"
).
parse
()
==
json
(
10000e-2
));
CHECK
(
json
::
parser
(
"10000E-1"
).
parse
()
==
json
(
10000e-1
));
CHECK
(
json
::
parser
(
"10000E0"
).
parse
()
==
json
(
10000e0
));
CHECK
(
json
::
parser
(
"10000E1"
).
parse
()
==
json
(
10000e1
));
CHECK
(
json
::
parser
(
"10000E2"
).
parse
()
==
json
(
10000e2
));
CHECK
(
json
::
parser
(
"10000E3"
).
parse
()
==
json
(
10000e3
));
CHECK
(
json
::
parser
(
"10000E4"
).
parse
()
==
json
(
10000e4
));
}
}
SECTION
(
"invalid numbers"
)
{
CHECK_THROWS_AS
(
json
::
parser
(
"01"
).
parse
(),
std
::
invalid_argument
);
}
}
}
}
}
}
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