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
922fe693
Commit
922fe693
authored
Feb 04, 2017
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
⬆
updated Catch to v1.7.0
parent
1cfdc2a7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11021 additions
and
10601 deletions
+11021
-10601
test/src/unit-allocator.cpp
test/src/unit-allocator.cpp
+17
-33
test/thirdparty/catch/catch.hpp
test/thirdparty/catch/catch.hpp
+11004
-10568
No files found.
test/src/unit-allocator.cpp
View file @
922fe693
...
...
@@ -59,7 +59,7 @@ TEST_CASE("bad_alloc")
bad_allocator
>
;
// creating an object should throw
CHECK_THROWS_AS
(
bad_json
j
(
bad_json
::
value_t
::
object
),
std
::
bad_alloc
);
CHECK_THROWS_AS
(
bad_json
(
bad_json
::
value_t
::
object
),
std
::
bad_alloc
);
}
}
...
...
@@ -141,39 +141,27 @@ TEST_CASE("controlled bad_alloc")
{
next_construct_fails
=
false
;
auto
t
=
my_json
::
value_t
::
object
;
auto
clean_up
=
[](
my_json
::
json_value
&
j
)
{
my_allocator_clean_up
(
j
.
object
);
};
CHECK_NOTHROW
(
my_json
::
json_value
j
(
t
);
clean_up
(
j
));
CHECK_NOTHROW
(
my_allocator_clean_up
(
my_json
::
json_value
(
t
).
object
));
next_construct_fails
=
true
;
CHECK_THROWS_AS
(
my_json
::
json_value
j
(
t
),
std
::
bad_alloc
);
CHECK_THROWS_AS
(
my_json
::
json_value
(
t
),
std
::
bad_alloc
);
next_construct_fails
=
false
;
}
SECTION
(
"array"
)
{
next_construct_fails
=
false
;
auto
t
=
my_json
::
value_t
::
array
;
auto
clean_up
=
[](
my_json
::
json_value
&
j
)
{
my_allocator_clean_up
(
j
.
array
);
};
CHECK_NOTHROW
(
my_json
::
json_value
j
(
t
);
clean_up
(
j
));
CHECK_NOTHROW
(
my_allocator_clean_up
(
my_json
::
json_value
(
t
).
array
));
next_construct_fails
=
true
;
CHECK_THROWS_AS
(
my_json
::
json_value
j
(
t
),
std
::
bad_alloc
);
CHECK_THROWS_AS
(
my_json
::
json_value
(
t
),
std
::
bad_alloc
);
next_construct_fails
=
false
;
}
SECTION
(
"string"
)
{
next_construct_fails
=
false
;
auto
t
=
my_json
::
value_t
::
string
;
auto
clean_up
=
[](
my_json
::
json_value
&
j
)
{
my_allocator_clean_up
(
j
.
string
);
};
CHECK_NOTHROW
(
my_json
::
json_value
j
(
t
);
clean_up
(
j
));
CHECK_NOTHROW
(
my_allocator_clean_up
(
my_json
::
json_value
(
t
).
string
));
next_construct_fails
=
true
;
CHECK_THROWS_AS
(
my_json
::
json_value
j
(
t
),
std
::
bad_alloc
);
CHECK_THROWS_AS
(
my_json
::
json_value
(
t
),
std
::
bad_alloc
);
next_construct_fails
=
false
;
}
}
...
...
@@ -182,13 +170,9 @@ TEST_CASE("controlled bad_alloc")
{
next_construct_fails
=
false
;
my_json
::
string_t
v
(
"foo"
);
auto
clean_up
=
[](
my_json
::
json_value
&
j
)
{
my_allocator_clean_up
(
j
.
string
);
};
CHECK_NOTHROW
(
my_json
::
json_value
j
(
v
);
clean_up
(
j
));
CHECK_NOTHROW
(
my_allocator_clean_up
(
my_json
::
json_value
(
v
).
string
));
next_construct_fails
=
true
;
CHECK_THROWS_AS
(
my_json
::
json_value
j
(
v
),
std
::
bad_alloc
);
CHECK_THROWS_AS
(
my_json
::
json_value
(
v
),
std
::
bad_alloc
);
next_construct_fails
=
false
;
}
...
...
@@ -222,9 +206,9 @@ TEST_CASE("controlled bad_alloc")
{
next_construct_fails
=
false
;
std
::
map
<
std
::
string
,
std
::
string
>
v
{{
"foo"
,
"bar"
}};
CHECK_NOTHROW
(
my_json
j
(
v
));
CHECK_NOTHROW
(
my_json
(
v
));
next_construct_fails
=
true
;
CHECK_THROWS_AS
(
my_json
j
(
v
),
std
::
bad_alloc
);
CHECK_THROWS_AS
(
my_json
(
v
),
std
::
bad_alloc
);
next_construct_fails
=
false
;
}
...
...
@@ -232,18 +216,18 @@ TEST_CASE("controlled bad_alloc")
{
next_construct_fails
=
false
;
std
::
vector
<
std
::
string
>
v
{
"foo"
,
"bar"
,
"baz"
};
CHECK_NOTHROW
(
my_json
j
(
v
));
CHECK_NOTHROW
(
my_json
(
v
));
next_construct_fails
=
true
;
CHECK_THROWS_AS
(
my_json
j
(
v
),
std
::
bad_alloc
);
CHECK_THROWS_AS
(
my_json
(
v
),
std
::
bad_alloc
);
next_construct_fails
=
false
;
}
SECTION
(
"basic_json(const typename string_t::value_type*)"
)
{
next_construct_fails
=
false
;
CHECK_NOTHROW
(
my_json
v
(
"foo"
));
CHECK_NOTHROW
(
my_json
(
"foo"
));
next_construct_fails
=
true
;
CHECK_THROWS_AS
(
my_json
v
(
"foo"
),
std
::
bad_alloc
);
CHECK_THROWS_AS
(
my_json
(
"foo"
),
std
::
bad_alloc
);
next_construct_fails
=
false
;
}
...
...
@@ -251,9 +235,9 @@ TEST_CASE("controlled bad_alloc")
{
next_construct_fails
=
false
;
std
::
string
s
(
"foo"
);
CHECK_NOTHROW
(
my_json
v
(
s
));
CHECK_NOTHROW
(
my_json
(
s
));
next_construct_fails
=
true
;
CHECK_THROWS_AS
(
my_json
v
(
s
),
std
::
bad_alloc
);
CHECK_THROWS_AS
(
my_json
(
s
),
std
::
bad_alloc
);
next_construct_fails
=
false
;
}
}
...
...
test/thirdparty/catch/catch.hpp
View file @
922fe693
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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