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
da5b7833
Commit
da5b7833
authored
Mar 31, 2019
by
onqtam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixing the remaining of the pedantic gcc/clang target warnings
parent
64873fb5
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
36 additions
and
53 deletions
+36
-53
unit-cbor.cpp
test/src/unit-cbor.cpp
+1
-4
unit-constructor1.cpp
test/src/unit-constructor1.cpp
+1
-2
unit-conversions.cpp
test/src/unit-conversions.cpp
+0
-1
unit-readme.cpp
test/src/unit-readme.cpp
+1
-2
unit-reference_access.cpp
test/src/unit-reference_access.cpp
+1
-2
unit-regression.cpp
test/src/unit-regression.cpp
+1
-7
doctest.h
test/thirdparty/doctest/doctest.h
+30
-12
doctest_compatibility.h
test/thirdparty/doctest/doctest_compatibility.h
+1
-23
No files found.
test/src/unit-cbor.cpp
View file @
da5b7833
...
@@ -28,6 +28,7 @@ SOFTWARE.
...
@@ -28,6 +28,7 @@ SOFTWARE.
*/
*/
#include "doctest_compatibility.h"
#include "doctest_compatibility.h"
DOCTEST_GCC_SUPPRESS_WARNING
(
"-Wfloat-equal"
)
#include <nlohmann/json.hpp>
#include <nlohmann/json.hpp>
using
nlohmann
::
json
;
using
nlohmann
::
json
;
...
@@ -876,9 +877,7 @@ TEST_CASE("CBOR")
...
@@ -876,9 +877,7 @@ TEST_CASE("CBOR")
{
{
json
j
=
json
::
from_cbor
(
std
::
vector
<
uint8_t
>
({
0xf9
,
0x7c
,
0x00
}));
json
j
=
json
::
from_cbor
(
std
::
vector
<
uint8_t
>
({
0xf9
,
0x7c
,
0x00
}));
json
::
number_float_t
d
=
j
;
json
::
number_float_t
d
=
j
;
DOCTEST_GCC_SUPPRESS_WARNING_WITH_PUSH
(
"-Wfloat-equal"
)
CHECK
(
d
==
std
::
numeric_limits
<
json
::
number_float_t
>::
infinity
());
CHECK
(
d
==
std
::
numeric_limits
<
json
::
number_float_t
>::
infinity
());
DOCTEST_GCC_SUPPRESS_WARNING_POP
CHECK
(
j
.
dump
()
==
"null"
);
CHECK
(
j
.
dump
()
==
"null"
);
}
}
...
@@ -897,9 +896,7 @@ TEST_CASE("CBOR")
...
@@ -897,9 +896,7 @@ TEST_CASE("CBOR")
{
{
json
j
=
json
::
from_cbor
(
std
::
vector
<
uint8_t
>
({
0xf9
,
0x3c
,
0x00
}));
json
j
=
json
::
from_cbor
(
std
::
vector
<
uint8_t
>
({
0xf9
,
0x3c
,
0x00
}));
json
::
number_float_t
d
=
j
;
json
::
number_float_t
d
=
j
;
DOCTEST_GCC_SUPPRESS_WARNING_WITH_PUSH
(
"-Wfloat-equal"
)
CHECK
(
d
==
1
);
CHECK
(
d
==
1
);
DOCTEST_GCC_SUPPRESS_WARNING_POP
}
}
SECTION
(
"-2 (1 10000 0000000000)"
)
SECTION
(
"-2 (1 10000 0000000000)"
)
...
...
test/src/unit-constructor1.cpp
View file @
da5b7833
...
@@ -28,6 +28,7 @@ SOFTWARE.
...
@@ -28,6 +28,7 @@ SOFTWARE.
*/
*/
#include "doctest_compatibility.h"
#include "doctest_compatibility.h"
DOCTEST_GCC_SUPPRESS_WARNING
(
"-Wfloat-equal"
)
#define private public
#define private public
#include <nlohmann/json.hpp>
#include <nlohmann/json.hpp>
...
@@ -351,9 +352,7 @@ TEST_CASE("constructors")
...
@@ -351,9 +352,7 @@ TEST_CASE("constructors")
CHECK
(
jva
.
size
()
==
va
.
size
());
CHECK
(
jva
.
size
()
==
va
.
size
());
for
(
size_t
i
=
0
;
i
<
jva
.
size
();
++
i
)
for
(
size_t
i
=
0
;
i
<
jva
.
size
();
++
i
)
{
{
DOCTEST_GCC_SUPPRESS_WARNING_WITH_PUSH
(
"-Wfloat-equal"
)
CHECK
(
va
[
i
]
==
jva
[
i
]);
CHECK
(
va
[
i
]
==
jva
[
i
]);
DOCTEST_GCC_SUPPRESS_WARNING_POP
}
}
}
}
...
...
test/src/unit-conversions.cpp
View file @
da5b7833
...
@@ -28,7 +28,6 @@ SOFTWARE.
...
@@ -28,7 +28,6 @@ SOFTWARE.
*/
*/
#include "doctest_compatibility.h"
#include "doctest_compatibility.h"
DOCTEST_GCC_SUPPRESS_WARNING_WITH_PUSH
(
"-Wsign-promo"
)
#define private public
#define private public
#include <nlohmann/json.hpp>
#include <nlohmann/json.hpp>
...
...
test/src/unit-readme.cpp
View file @
da5b7833
...
@@ -28,6 +28,7 @@ SOFTWARE.
...
@@ -28,6 +28,7 @@ SOFTWARE.
*/
*/
#include "doctest_compatibility.h"
#include "doctest_compatibility.h"
DOCTEST_GCC_SUPPRESS_WARNING
(
"-Wfloat-equal"
)
#include <nlohmann/json.hpp>
#include <nlohmann/json.hpp>
using
nlohmann
::
json
;
using
nlohmann
::
json
;
...
@@ -269,9 +270,7 @@ TEST_CASE("README" * doctest::skip())
...
@@ -269,9 +270,7 @@ TEST_CASE("README" * doctest::skip())
int
i
=
42
;
int
i
=
42
;
json
jn
=
i
;
json
jn
=
i
;
double
f
=
jn
;
double
f
=
jn
;
DOCTEST_GCC_SUPPRESS_WARNING_WITH_PUSH
(
"-Wfloat-equal"
)
CHECK
(
f
==
42
);
CHECK
(
f
==
42
);
DOCTEST_GCC_SUPPRESS_WARNING_POP
// etc.
// etc.
...
...
test/src/unit-reference_access.cpp
View file @
da5b7833
...
@@ -28,6 +28,7 @@ SOFTWARE.
...
@@ -28,6 +28,7 @@ SOFTWARE.
*/
*/
#include "doctest_compatibility.h"
#include "doctest_compatibility.h"
DOCTEST_GCC_SUPPRESS_WARNING
(
"-Wfloat-equal"
)
#include <nlohmann/json.hpp>
#include <nlohmann/json.hpp>
using
nlohmann
::
json
;
using
nlohmann
::
json
;
...
@@ -287,9 +288,7 @@ TEST_CASE("reference access")
...
@@ -287,9 +288,7 @@ TEST_CASE("reference access")
// check if references are returned correctly
// check if references are returned correctly
test_type
&
p1
=
value
.
get_ref
<
test_type
&>
();
test_type
&
p1
=
value
.
get_ref
<
test_type
&>
();
CHECK
(
&
p1
==
value
.
get_ptr
<
test_type
*>
());
CHECK
(
&
p1
==
value
.
get_ptr
<
test_type
*>
());
DOCTEST_GCC_SUPPRESS_WARNING_WITH_PUSH
(
"-Wfloat-equal"
)
CHECK
(
p1
==
value
.
get
<
test_type
>
());
CHECK
(
p1
==
value
.
get
<
test_type
>
());
DOCTEST_GCC_SUPPRESS_WARNING_POP
const
test_type
&
p2
=
value
.
get_ref
<
const
test_type
&>
();
const
test_type
&
p2
=
value
.
get_ref
<
const
test_type
&>
();
CHECK
(
&
p2
==
value
.
get_ptr
<
const
test_type
*>
());
CHECK
(
&
p2
==
value
.
get_ptr
<
const
test_type
*>
());
...
...
test/src/unit-regression.cpp
View file @
da5b7833
...
@@ -28,7 +28,7 @@ SOFTWARE.
...
@@ -28,7 +28,7 @@ SOFTWARE.
*/
*/
#include "doctest_compatibility.h"
#include "doctest_compatibility.h"
DOCTEST_GCC_SUPPRESS_WARNING
_WITH_PUSH
(
"-Wsign-promo
"
)
DOCTEST_GCC_SUPPRESS_WARNING
(
"-Wfloat-equal
"
)
// for some reason including this after the json header leads to linker errors with VS 2017...
// for some reason including this after the json header leads to linker errors with VS 2017...
#include <locale>
#include <locale>
...
@@ -315,9 +315,7 @@ TEST_CASE("regression tests")
...
@@ -315,9 +315,7 @@ TEST_CASE("regression tests")
// unsigned integer parsing - expected to overflow and be stored as a float
// unsigned integer parsing - expected to overflow and be stored as a float
j
=
custom_json
::
parse
(
"4294967296"
);
// 2^32
j
=
custom_json
::
parse
(
"4294967296"
);
// 2^32
CHECK
(
static_cast
<
int
>
(
j
.
type
())
==
static_cast
<
int
>
(
custom_json
::
value_t
::
number_float
));
CHECK
(
static_cast
<
int
>
(
j
.
type
())
==
static_cast
<
int
>
(
custom_json
::
value_t
::
number_float
));
DOCTEST_GCC_SUPPRESS_WARNING_WITH_PUSH
(
"-Wfloat-equal"
)
CHECK
(
j
.
get
<
float
>
()
==
4294967296.0
f
);
CHECK
(
j
.
get
<
float
>
()
==
4294967296.0
f
);
DOCTEST_GCC_SUPPRESS_WARNING_POP
// integer object creation - expected to wrap and still be stored as an integer
// integer object creation - expected to wrap and still be stored as an integer
j
=
-
2147483649LL
;
// -2^31-1
j
=
-
2147483649LL
;
// -2^31-1
...
@@ -482,9 +480,7 @@ TEST_CASE("regression tests")
...
@@ -482,9 +480,7 @@ TEST_CASE("regression tests")
json
j
;
json
j
;
j
=
json
::
parse
(
"-0.0"
);
j
=
json
::
parse
(
"-0.0"
);
DOCTEST_GCC_SUPPRESS_WARNING_WITH_PUSH
(
"-Wfloat-equal"
)
CHECK
(
j
.
get
<
double
>
()
==
-
0.0
);
CHECK
(
j
.
get
<
double
>
()
==
-
0.0
);
DOCTEST_GCC_SUPPRESS_WARNING_POP
j
=
json
::
parse
(
"2.22507385850720113605740979670913197593481954635164564e-308"
);
j
=
json
::
parse
(
"2.22507385850720113605740979670913197593481954635164564e-308"
);
CHECK
(
j
.
get
<
double
>
()
==
2.2250738585072009e-308
);
CHECK
(
j
.
get
<
double
>
()
==
2.2250738585072009e-308
);
...
@@ -522,9 +518,7 @@ TEST_CASE("regression tests")
...
@@ -522,9 +518,7 @@ TEST_CASE("regression tests")
// long double
// long double
nlohmann
::
basic_json
<
std
::
map
,
std
::
vector
,
std
::
string
,
bool
,
int64_t
,
uint64_t
,
long
double
>
nlohmann
::
basic_json
<
std
::
map
,
std
::
vector
,
std
::
string
,
bool
,
int64_t
,
uint64_t
,
long
double
>
j_long_double
=
1.23e45L
;
j_long_double
=
1.23e45L
;
DOCTEST_GCC_SUPPRESS_WARNING_WITH_PUSH
(
"-Wfloat-equal"
)
CHECK
(
j_long_double
.
get
<
long
double
>
()
==
1.23e45L
);
CHECK
(
j_long_double
.
get
<
long
double
>
()
==
1.23e45L
);
DOCTEST_GCC_SUPPRESS_WARNING_POP
}
}
SECTION
(
"issue #228 - double values are serialized with commas as decimal points"
)
SECTION
(
"issue #228 - double values are serialized with commas as decimal points"
)
...
...
test/thirdparty/doctest/doctest.h
View file @
da5b7833
...
@@ -161,6 +161,7 @@ DOCTEST_GCC_SUPPRESS_WARNING("-Winline")
...
@@ -161,6 +161,7 @@ DOCTEST_GCC_SUPPRESS_WARNING("-Winline")
DOCTEST_GCC_SUPPRESS_WARNING
(
"-Wunused-local-typedefs"
)
DOCTEST_GCC_SUPPRESS_WARNING
(
"-Wunused-local-typedefs"
)
DOCTEST_GCC_SUPPRESS_WARNING
(
"-Wuseless-cast"
)
DOCTEST_GCC_SUPPRESS_WARNING
(
"-Wuseless-cast"
)
DOCTEST_GCC_SUPPRESS_WARNING
(
"-Wnoexcept"
)
DOCTEST_GCC_SUPPRESS_WARNING
(
"-Wnoexcept"
)
DOCTEST_GCC_SUPPRESS_WARNING
(
"-Wsign-promo"
)
DOCTEST_MSVC_SUPPRESS_WARNING_PUSH
DOCTEST_MSVC_SUPPRESS_WARNING_PUSH
DOCTEST_MSVC_SUPPRESS_WARNING
(
4616
)
// invalid compiler warning
DOCTEST_MSVC_SUPPRESS_WARNING
(
4616
)
// invalid compiler warning
...
@@ -994,6 +995,10 @@ namespace detail {
...
@@ -994,6 +995,10 @@ namespace detail {
};
};
DOCTEST_INTERFACE
bool
checkIfShouldThrow
(
assertType
::
Enum
at
);
DOCTEST_INTERFACE
bool
checkIfShouldThrow
(
assertType
::
Enum
at
);
#ifndef DOCTEST_CONFIG_NO_EXCEPTIONS
[[
noreturn
]]
#endif // DOCTEST_CONFIG_NO_EXCEPTIONS
DOCTEST_INTERFACE
void
throwException
();
DOCTEST_INTERFACE
void
throwException
();
struct
DOCTEST_INTERFACE
Subcase
struct
DOCTEST_INTERFACE
Subcase
...
@@ -1598,7 +1603,7 @@ namespace detail {
...
@@ -1598,7 +1603,7 @@ namespace detail {
DOCTEST_DELETE_COPIES
(
ContextScope
);
DOCTEST_DELETE_COPIES
(
ContextScope
);
~
ContextScope
();
~
ContextScope
()
override
;
void
stringify
(
std
::
ostream
*
s
)
const
override
;
void
stringify
(
std
::
ostream
*
s
)
const
override
;
};
};
...
@@ -1839,6 +1844,15 @@ int registerReporter(const char* name, int priority) {
...
@@ -1839,6 +1844,15 @@ int registerReporter(const char* name, int priority) {
} catch(...) { _DOCTEST_RB.translateException(); }
} catch(...) { _DOCTEST_RB.translateException(); }
#endif // DOCTEST_CONFIG_NO_TRY_CATCH_IN_ASSERTS
#endif // DOCTEST_CONFIG_NO_TRY_CATCH_IN_ASSERTS
#ifdef DOCTEST_CONFIG_VOID_CAST_EXPRESSIONS
#define DOCTEST_CAST_TO_VOID(x) \
DOCTEST_GCC_SUPPRESS_WARNING_WITH_PUSH("-Wuseless-cast") \
static_cast<void>(x); \
DOCTEST_GCC_SUPPRESS_WARNING_POP
#else // DOCTEST_CONFIG_VOID_CAST_EXPRESSIONS
#define DOCTEST_CAST_TO_VOID(x) x;
#endif // DOCTEST_CONFIG_VOID_CAST_EXPRESSIONS
// registers the test by initializing a dummy var with a function
// registers the test by initializing a dummy var with a function
#define DOCTEST_REGISTER_FUNCTION(global_prefix, f, decorators) \
#define DOCTEST_REGISTER_FUNCTION(global_prefix, f, decorators) \
global_prefix DOCTEST_GLOBAL_NO_WARNINGS(DOCTEST_ANONYMOUS(_DOCTEST_ANON_VAR_)) = \
global_prefix DOCTEST_GLOBAL_NO_WARNINGS(DOCTEST_ANONYMOUS(_DOCTEST_ANON_VAR_)) = \
...
@@ -2108,15 +2122,13 @@ constexpr T to_lvalue = x;
...
@@ -2108,15 +2122,13 @@ constexpr T to_lvalue = x;
#define DOCTEST_REQUIRE_FALSE_MESSAGE(cond, msg) do { DOCTEST_INFO(msg); DOCTEST_ASSERT_IMPLEMENT_2(DT_REQUIRE_FALSE, cond); } while((void)0, 0)
#define DOCTEST_REQUIRE_FALSE_MESSAGE(cond, msg) do { DOCTEST_INFO(msg); DOCTEST_ASSERT_IMPLEMENT_2(DT_REQUIRE_FALSE, cond); } while((void)0, 0)
// clang-format on
// clang-format on
#define DOCTEST_ASSERT_THROWS(expr, assert_type) DOCTEST_ASSERT_THROWS_WITH(expr, assert_type, "")
#define DOCTEST_ASSERT_THROWS_AS(expr, assert_type, ...) \
#define DOCTEST_ASSERT_THROWS_AS(expr, assert_type, ...) \
do { \
do { \
if(!doctest::getContextOptions()->no_throw) { \
if(!doctest::getContextOptions()->no_throw) { \
doctest::detail::ResultBuilder _DOCTEST_RB(doctest::assertType::assert_type, __FILE__, \
doctest::detail::ResultBuilder _DOCTEST_RB(doctest::assertType::assert_type, __FILE__, \
__LINE__, #expr, #__VA_ARGS__); \
__LINE__, #expr, #__VA_ARGS__); \
try { \
try { \
expr;
\
DOCTEST_CAST_TO_VOID(expr)
\
} catch(const doctest::detail::remove_const< \
} catch(const doctest::detail::remove_const< \
doctest::detail::remove_reference<__VA_ARGS__>::type>::type&) { \
doctest::detail::remove_reference<__VA_ARGS__>::type>::type&) { \
_DOCTEST_RB.translateException(); \
_DOCTEST_RB.translateException(); \
...
@@ -2132,7 +2144,7 @@ constexpr T to_lvalue = x;
...
@@ -2132,7 +2144,7 @@ constexpr T to_lvalue = x;
doctest::detail::ResultBuilder _DOCTEST_RB(doctest::assertType::assert_type, __FILE__, \
doctest::detail::ResultBuilder _DOCTEST_RB(doctest::assertType::assert_type, __FILE__, \
__LINE__, #expr, __VA_ARGS__); \
__LINE__, #expr, __VA_ARGS__); \
try { \
try { \
expr;
\
DOCTEST_CAST_TO_VOID(expr)
\
} catch(...) { _DOCTEST_RB.translateException(); } \
} catch(...) { _DOCTEST_RB.translateException(); } \
DOCTEST_ASSERT_LOG_AND_REACT(_DOCTEST_RB); \
DOCTEST_ASSERT_LOG_AND_REACT(_DOCTEST_RB); \
} \
} \
...
@@ -2143,15 +2155,15 @@ constexpr T to_lvalue = x;
...
@@ -2143,15 +2155,15 @@ constexpr T to_lvalue = x;
doctest::detail::ResultBuilder _DOCTEST_RB(doctest::assertType::assert_type, __FILE__, \
doctest::detail::ResultBuilder _DOCTEST_RB(doctest::assertType::assert_type, __FILE__, \
__LINE__, #expr); \
__LINE__, #expr); \
try { \
try { \
expr;
\
DOCTEST_CAST_TO_VOID(expr)
\
} catch(...) { _DOCTEST_RB.translateException(); } \
} catch(...) { _DOCTEST_RB.translateException(); } \
DOCTEST_ASSERT_LOG_AND_REACT(_DOCTEST_RB); \
DOCTEST_ASSERT_LOG_AND_REACT(_DOCTEST_RB); \
} while((void)0, 0)
} while((void)0, 0)
// clang-format off
// clang-format off
#define DOCTEST_WARN_THROWS(expr) DOCTEST_ASSERT_THROWS
(expr, DT_WARN_THROWS
)
#define DOCTEST_WARN_THROWS(expr) DOCTEST_ASSERT_THROWS
_WITH(expr, DT_WARN_THROWS, ""
)
#define DOCTEST_CHECK_THROWS(expr) DOCTEST_ASSERT_THROWS
(expr, DT_CHECK_THROWS
)
#define DOCTEST_CHECK_THROWS(expr) DOCTEST_ASSERT_THROWS
_WITH(expr, DT_CHECK_THROWS, ""
)
#define DOCTEST_REQUIRE_THROWS(expr) DOCTEST_ASSERT_THROWS
(expr, DT_REQUIRE_THROWS
)
#define DOCTEST_REQUIRE_THROWS(expr) DOCTEST_ASSERT_THROWS
_WITH(expr, DT_REQUIRE_THROWS, ""
)
#define DOCTEST_WARN_THROWS_AS(expr, ...) DOCTEST_ASSERT_THROWS_AS(expr, DT_WARN_THROWS_AS, __VA_ARGS__)
#define DOCTEST_WARN_THROWS_AS(expr, ...) DOCTEST_ASSERT_THROWS_AS(expr, DT_WARN_THROWS_AS, __VA_ARGS__)
#define DOCTEST_CHECK_THROWS_AS(expr, ...) DOCTEST_ASSERT_THROWS_AS(expr, DT_CHECK_THROWS_AS, __VA_ARGS__)
#define DOCTEST_CHECK_THROWS_AS(expr, ...) DOCTEST_ASSERT_THROWS_AS(expr, DT_CHECK_THROWS_AS, __VA_ARGS__)
...
@@ -3504,11 +3516,11 @@ namespace detail {
...
@@ -3504,11 +3516,11 @@ namespace detail {
return
false
;
return
false
;
}
}
void
throwException
()
{
#ifndef DOCTEST_CONFIG_NO_EXCEPTIONS
#ifndef DOCTEST_CONFIG_NO_EXCEPTIONS
throw
TestFailureException
();
[[
noreturn
]]
void
throwException
()
{
throw
TestFailureException
();
}
#else // DOCTEST_CONFIG_NO_EXCEPTIONS
void
throwException
()
{}
#endif // DOCTEST_CONFIG_NO_EXCEPTIONS
#endif // DOCTEST_CONFIG_NO_EXCEPTIONS
}
}
// namespace detail
}
// namespace detail
namespace
{
namespace
{
...
@@ -4868,12 +4880,16 @@ namespace {
...
@@ -4868,12 +4880,16 @@ namespace {
}
}
void
test_case_exception
(
const
TestCaseException
&
e
)
override
{
void
test_case_exception
(
const
TestCaseException
&
e
)
override
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
mutex
);
xml
.
scopedElement
(
"Exception"
)
xml
.
scopedElement
(
"Exception"
)
.
writeAttribute
(
"crash"
,
e
.
is_crash
)
.
writeAttribute
(
"crash"
,
e
.
is_crash
)
.
writeText
(
e
.
error_string
.
c_str
());
.
writeText
(
e
.
error_string
.
c_str
());
}
}
void
subcase_start
(
const
SubcaseSignature
&
in
)
override
{
void
subcase_start
(
const
SubcaseSignature
&
in
)
override
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
mutex
);
xml
.
startElement
(
"SubCase"
)
xml
.
startElement
(
"SubCase"
)
.
writeAttribute
(
"name"
,
in
.
m_name
)
.
writeAttribute
(
"name"
,
in
.
m_name
)
.
writeAttribute
(
"filename"
,
skipPathFromFilename
(
in
.
m_file
))
.
writeAttribute
(
"filename"
,
skipPathFromFilename
(
in
.
m_file
))
...
@@ -5319,11 +5335,13 @@ namespace {
...
@@ -5319,11 +5335,13 @@ namespace {
}
}
void
subcase_start
(
const
SubcaseSignature
&
subc
)
override
{
void
subcase_start
(
const
SubcaseSignature
&
subc
)
override
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
mutex
);
subcasesStack
.
push_back
(
subc
);
subcasesStack
.
push_back
(
subc
);
hasLoggedCurrentTestStart
=
false
;
hasLoggedCurrentTestStart
=
false
;
}
}
void
subcase_end
()
override
{
void
subcase_end
()
override
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
mutex
);
subcasesStack
.
pop_back
();
subcasesStack
.
pop_back
();
hasLoggedCurrentTestStart
=
false
;
hasLoggedCurrentTestStart
=
false
;
}
}
...
...
test/thirdparty/doctest/doctest_compatibility.h
View file @
da5b7833
#ifndef DOCTEST_COMPATIBILITY
#ifndef DOCTEST_COMPATIBILITY
#define DOCTEST_COMPATIBILITY
#define DOCTEST_COMPATIBILITY
#define DOCTEST_CONFIG_VOID_CAST_EXPRESSIONS
#define DOCTEST_THREAD_LOCAL // enable single-threaded builds on XCode 6/7 - https://github.com/onqtam/doctest/issues/172
#define DOCTEST_THREAD_LOCAL // enable single-threaded builds on XCode 6/7 - https://github.com/onqtam/doctest/issues/172
#include "doctest.h"
#include "doctest.h"
...
@@ -25,29 +26,6 @@
...
@@ -25,29 +26,6 @@
#define CHECK_THROWS_WITH_STD_STR(expr, str) \
#define CHECK_THROWS_WITH_STD_STR(expr, str) \
CHECK_THROWS_WITH_STD_STR_IMPL(expr, str, DOCTEST_ANONYMOUS(DOCTEST_STD_STRING_))
CHECK_THROWS_WITH_STD_STR_IMPL(expr, str, DOCTEST_ANONYMOUS(DOCTEST_STD_STRING_))
#undef CHECK_THROWS
#undef CHECK_THROWS_AS
#undef CHECK_THROWS_WITH
#undef CHECK_NOTHROW
#undef REQUIRE_THROWS
#undef REQUIRE_THROWS_AS
#undef REQUIRE_THROWS_WITH
#undef REQUIRE_NOTHROW
// doctest allows multiple statements in these macros (even blocks of code) but json
// tests rely on passing single function/constructor calls which have a [[nodiscard]]
// attribute so here we static_cast to void - just like Catch does
#define CHECK_THROWS(expr) DOCTEST_CHECK_THROWS(static_cast<void>(expr))
#define CHECK_THROWS_AS(expr, e) DOCTEST_CHECK_THROWS_AS(static_cast<void>(expr), e)
#define CHECK_THROWS_WITH(expr, e) DOCTEST_CHECK_THROWS_WITH(static_cast<void>(expr), e)
#define CHECK_NOTHROW(expr) DOCTEST_CHECK_NOTHROW(static_cast<void>(expr))
#define REQUIRE_THROWS(expr) DOCTEST_REQUIRE_THROWS(static_cast<void>(expr))
#define REQUIRE_THROWS_AS(expr, e) DOCTEST_REQUIRE_THROWS_AS(static_cast<void>(expr), e)
#define REQUIRE_THROWS_WITH(expr, e) DOCTEST_REQUIRE_THROWS_WITH(static_cast<void>(expr), e)
#define REQUIRE_NOTHROW(expr) DOCTEST_REQUIRE_NOTHROW(static_cast<void>(expr))
// included here because for some tests in the json repository private is defined as
// included here because for some tests in the json repository private is defined as
// public and if no STL header is included before that then in the json include when STL
// public and if no STL header is included before that then in the json include when STL
// stuff is included the MSVC STL complains (errors) that C++ keywords are being redefined
// stuff is included the MSVC STL complains (errors) that C++ keywords are being redefined
...
...
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