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
d6f54711
Commit
d6f54711
authored
Feb 08, 2015
by
Niels
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hello coveralls...
parent
57223261
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
6 deletions
+75
-6
.travis.yml
.travis.yml
+1
-1
test/unit.cpp
test/unit.cpp
+74
-5
No files found.
.travis.yml
View file @
d6f54711
...
...
@@ -24,4 +24,4 @@ after_success:
-
make clean
-
make json_unit CXXFLAGS="-fprofile-arcs -ftest-coverage"
-
./json_unit
-
coveralls --
exclude test/catch.hpp --include src/json.hpp --
gcov-options '\-lp' --gcov 'gcov-4.8'
-
coveralls --gcov-options '\-lp' --gcov 'gcov-4.8'
test/unit.cpp
View file @
d6f54711
...
...
@@ -1197,7 +1197,7 @@ TEST_CASE("value conversion")
std
::
unordered_multimap
<
std
::
string
,
json
>
o
=
j
.
get
<
std
::
unordered_multimap
<
std
::
string
,
json
>>
();
CHECK
(
json
(
o
)
==
j
);
}
SECTION
(
"exception in case of a non-object type"
)
{
CHECK_THROWS_AS
(
json
(
json
::
value_t
::
null
).
get
<
json
::
object_t
>
(),
std
::
logic_error
);
...
...
@@ -1331,7 +1331,7 @@ TEST_CASE("value conversion")
{
json
::
string_t
s_reference
{
"Hello world"
};
json
j
(
s_reference
);
SECTION
(
"string_t"
)
{
json
::
string_t
s
=
j
.
get
<
json
::
string_t
>
();
...
...
@@ -1359,7 +1359,7 @@ TEST_CASE("value conversion")
{
json
::
string_t
s_reference
{
"Hello world"
};
json
j
(
s_reference
);
SECTION
(
"string_t"
)
{
json
::
string_t
s
=
j
;
...
...
@@ -1377,7 +1377,7 @@ TEST_CASE("value conversion")
{
json
::
boolean_t
b_reference
{
true
};
json
j
(
b_reference
);
SECTION
(
"boolean_t"
)
{
json
::
boolean_t
b
=
j
.
get
<
json
::
boolean_t
>
();
...
...
@@ -1405,7 +1405,7 @@ TEST_CASE("value conversion")
{
json
::
boolean_t
b_reference
{
true
};
json
j
(
b_reference
);
SECTION
(
"boolean_t"
)
{
json
::
boolean_t
b
=
j
;
...
...
@@ -1419,4 +1419,73 @@ TEST_CASE("value conversion")
}
}
SECTION
(
"get an integer number (explicit)"
)
{
json
::
number_integer_t
n_reference
{
42
};
json
j
(
n_reference
);
SECTION
(
"number_integer_t"
)
{
json
::
number_integer_t
n
=
j
.
get
<
json
::
number_integer_t
>
();
CHECK
(
json
(
n
)
==
j
);
}
SECTION
(
"short"
)
{
short
n
=
j
.
get
<
short
>
();
CHECK
(
json
(
n
)
==
j
);
}
SECTION
(
"unsigned short"
)
{
unsigned
short
n
=
j
.
get
<
unsigned
short
>
();
CHECK
(
json
(
n
)
==
j
);
}
SECTION
(
"int"
)
{
int
n
=
j
.
get
<
int
>
();
CHECK
(
json
(
n
)
==
j
);
}
SECTION
(
"unsigned int"
)
{
unsigned
int
n
=
j
.
get
<
unsigned
int
>
();
CHECK
(
json
(
n
)
==
j
);
}
SECTION
(
"long"
)
{
long
n
=
j
.
get
<
long
>
();
CHECK
(
json
(
n
)
==
j
);
}
SECTION
(
"unsigned long"
)
{
unsigned
long
n
=
j
.
get
<
unsigned
long
>
();
CHECK
(
json
(
n
)
==
j
);
}
SECTION
(
"long long"
)
{
long
long
n
=
j
.
get
<
long
long
>
();
CHECK
(
json
(
n
)
==
j
);
}
SECTION
(
"unsigned long long"
)
{
unsigned
long
long
n
=
j
.
get
<
unsigned
long
long
>
();
CHECK
(
json
(
n
)
==
j
);
}
SECTION
(
"exception in case of a non-number type"
)
{
CHECK_THROWS_AS
(
json
(
json
::
value_t
::
null
).
get
<
json
::
number_integer_t
>
(),
std
::
logic_error
);
CHECK_THROWS_AS
(
json
(
json
::
value_t
::
object
).
get
<
json
::
number_integer_t
>
(),
std
::
logic_error
);
CHECK_THROWS_AS
(
json
(
json
::
value_t
::
array
).
get
<
json
::
number_integer_t
>
(),
std
::
logic_error
);
CHECK_THROWS_AS
(
json
(
json
::
value_t
::
string
).
get
<
json
::
number_integer_t
>
(),
std
::
logic_error
);
CHECK_THROWS_AS
(
json
(
json
::
value_t
::
boolean
).
get
<
json
::
number_integer_t
>
(),
std
::
logic_error
);
CHECK_NOTHROW
(
json
(
json
::
value_t
::
number_float
).
get
<
json
::
number_integer_t
>
());
}
}
}
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