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
4e81c1db
Commit
4e81c1db
authored
Oct 04, 2017
by
Niels Lohmann
Committed by
GitHub
Oct 04, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #765 from nlohmann/feature/issue698
using more CMake
parents
7435d54e
e2045eae
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
107 additions
and
113 deletions
+107
-113
.travis.yml
.travis.yml
+25
-35
src/json.hpp
src/json.hpp
+3
-7
test/CMakeLists.txt
test/CMakeLists.txt
+75
-71
test/src/unit-algorithms.cpp
test/src/unit-algorithms.cpp
+4
-0
No files found.
.travis.yml
View file @
4e81c1db
...
@@ -29,34 +29,28 @@ matrix:
...
@@ -29,34 +29,28 @@ matrix:
include
:
include
:
# Valgrind
# Valgrind
-
os
:
linux
-
os
:
linux
compiler
:
gcc
compiler
:
gcc
env
:
env
:
-
COMPILER=g++-4.9
-
COMPILER=g++-4.9
-
SPECIAL=valgrind
-
CMAKE_OPTIONS=-DJSON_Valgrind=ON
addons
:
addons
:
apt
:
apt
:
sources
:
[
'
ubuntu-toolchain-r-test'
]
sources
:
[
'
ubuntu-toolchain-r-test'
]
packages
:
[
g++-4.9
,
valgrind
]
packages
:
[
'
g++-4.9'
,
'
valgrind'
,
'
ninja-build'
]
after_success
:
-
make check TEST_PREFIX="valgrind --error-exitcode=1 --leak-check=full " TEST_PATTERN=""
# clang sanitizer
# clang sanitizer
-
os
:
linux
-
os
:
linux
compiler
:
clang
compiler
:
clang
env
:
env
:
-
COMPILER=clang++-5.0
-
COMPILER=clang++-5.0
-
SPECIAL=sanitizer
-
CMAKE_OPTIONS=-DJSON_Sanitizer=ON
addons
:
addons
:
apt
:
apt
:
sources
:
[
'
ubuntu-toolchain-r-test'
,
'
llvm-toolchain-trusty-5.0'
]
sources
:
[
'
ubuntu-toolchain-r-test'
,
'
llvm-toolchain-trusty-5.0'
]
packages
:
[
'
g++-6'
,
'
clang-5.0'
]
packages
:
[
'
g++-6'
,
'
clang-5.0'
,
'
ninja-build'
]
after_success
:
-
make clang_sanitize -j4
# cppcheck
# cppcheck
-
os
:
linux
-
os
:
linux
compiler
:
gcc
compiler
:
gcc
env
:
env
:
...
@@ -65,24 +59,20 @@ matrix:
...
@@ -65,24 +59,20 @@ matrix:
addons
:
addons
:
apt
:
apt
:
sources
:
[
'
ubuntu-toolchain-r-test'
]
sources
:
[
'
ubuntu-toolchain-r-test'
]
packages
:
[
g++-4.9
,
cppcheck
]
packages
:
[
'
g++-4.9'
,
'
cppcheck'
,
'
ninja-build'
]
after_success
:
after_success
:
-
make cppcheck
-
make cppcheck
# no exceptions
# no exceptions
-
os
:
linux
-
os
:
linux
compiler
:
gcc
compiler
:
gcc
env
:
env
:
-
COMPILER=g++-4.9
-
COMPILER=g++-4.9
-
SPECIAL=no_exceptions
-
CMAKE_OPTIONS=-DJSON_NoExceptions=ON
addons
:
addons
:
apt
:
apt
:
sources
:
[
'
ubuntu-toolchain-r-test'
]
sources
:
[
'
ubuntu-toolchain-r-test'
]
packages
:
[
g++-4.9
,
cppcheck
]
packages
:
[
'
g++-4.9'
,
'
ninja-build'
]
after_success
:
-
make clean
-
CPPFLAGS="-DJSON_NOEXCEPTION" make check TEST_PATTERN="-e \"*\""
# Coveralls (http://gronlier.fr/blog/2015/01/adding-code-coverage-to-your-c-project/)
# Coveralls (http://gronlier.fr/blog/2015/01/adding-code-coverage-to-your-c-project/)
...
@@ -91,7 +81,7 @@ matrix:
...
@@ -91,7 +81,7 @@ matrix:
addons
:
addons
:
apt
:
apt
:
sources
:
[
'
ubuntu-toolchain-r-test'
]
sources
:
[
'
ubuntu-toolchain-r-test'
]
packages
:
[
'
g++-4.9'
,
'
ruby'
]
packages
:
[
'
g++-4.9'
,
'
ruby'
,
'
ninja-build'
]
before_script
:
before_script
:
-
wget http://ftp.de.debian.org/debian/pool/main/l/lcov/lcov_1.11.orig.tar.gz
-
wget http://ftp.de.debian.org/debian/pool/main/l/lcov/lcov_1.11.orig.tar.gz
-
tar xf lcov_1.11.orig.tar.gz
-
tar xf lcov_1.11.orig.tar.gz
...
@@ -119,7 +109,7 @@ matrix:
...
@@ -119,7 +109,7 @@ matrix:
addons
:
addons
:
apt
:
apt
:
sources
:
[
'
ubuntu-toolchain-r-test'
,
'
llvm-toolchain-precise-3.6'
]
sources
:
[
'
ubuntu-toolchain-r-test'
,
'
llvm-toolchain-precise-3.6'
]
packages
:
[
'
g++-6'
,
'
clang-3.6'
]
packages
:
[
'
g++-6'
,
'
clang-3.6'
,
'
ninja-build'
]
coverity_scan
:
coverity_scan
:
project
:
project
:
name
:
"
nlohmann/json"
name
:
"
nlohmann/json"
...
@@ -163,7 +153,7 @@ matrix:
...
@@ -163,7 +153,7 @@ matrix:
addons
:
addons
:
apt
:
apt
:
sources
:
[
'
ubuntu-toolchain-r-test'
]
sources
:
[
'
ubuntu-toolchain-r-test'
]
packages
:
g++-4.9
packages
:
[
'
g++-4.9'
,
'
ninja-build'
]
-
os
:
linux
-
os
:
linux
compiler
:
gcc
compiler
:
gcc
...
@@ -171,7 +161,7 @@ matrix:
...
@@ -171,7 +161,7 @@ matrix:
addons
:
addons
:
apt
:
apt
:
sources
:
[
'
ubuntu-toolchain-r-test'
]
sources
:
[
'
ubuntu-toolchain-r-test'
]
packages
:
g++-5
packages
:
[
'
g++-5'
,
'
ninja-build'
]
-
os
:
linux
-
os
:
linux
compiler
:
gcc
compiler
:
gcc
...
@@ -179,7 +169,7 @@ matrix:
...
@@ -179,7 +169,7 @@ matrix:
addons
:
addons
:
apt
:
apt
:
sources
:
[
'
ubuntu-toolchain-r-test'
]
sources
:
[
'
ubuntu-toolchain-r-test'
]
packages
:
g++-6
packages
:
[
'
g++-6'
,
'
ninja-build'
]
-
os
:
linux
-
os
:
linux
compiler
:
gcc
compiler
:
gcc
...
@@ -187,7 +177,7 @@ matrix:
...
@@ -187,7 +177,7 @@ matrix:
addons
:
addons
:
apt
:
apt
:
sources
:
[
'
ubuntu-toolchain-r-test'
]
sources
:
[
'
ubuntu-toolchain-r-test'
]
packages
:
g++-7
packages
:
[
'
g++-7'
,
'
ninja-build'
]
-
os
:
linux
-
os
:
linux
compiler
:
gcc
compiler
:
gcc
...
@@ -197,7 +187,7 @@ matrix:
...
@@ -197,7 +187,7 @@ matrix:
addons
:
addons
:
apt
:
apt
:
sources
:
[
'
ubuntu-toolchain-r-test'
]
sources
:
[
'
ubuntu-toolchain-r-test'
]
packages
:
g++-7
packages
:
[
'
g++-7'
,
'
ninja-build'
]
# Linux / Clang
# Linux / Clang
...
@@ -207,7 +197,7 @@ matrix:
...
@@ -207,7 +197,7 @@ matrix:
addons
:
addons
:
apt
:
apt
:
sources
:
[
'
ubuntu-toolchain-r-test'
,
'
llvm-toolchain-precise-3.5'
]
sources
:
[
'
ubuntu-toolchain-r-test'
,
'
llvm-toolchain-precise-3.5'
]
packages
:
[
'
g++-6'
,
'
clang-3.5'
]
packages
:
[
'
g++-6'
,
'
clang-3.5'
,
'
ninja-build'
]
-
os
:
linux
-
os
:
linux
compiler
:
clang
compiler
:
clang
...
@@ -215,7 +205,7 @@ matrix:
...
@@ -215,7 +205,7 @@ matrix:
addons
:
addons
:
apt
:
apt
:
sources
:
[
'
ubuntu-toolchain-r-test'
,
'
llvm-toolchain-precise-3.6'
]
sources
:
[
'
ubuntu-toolchain-r-test'
,
'
llvm-toolchain-precise-3.6'
]
packages
:
[
'
g++-6'
,
'
clang-3.6'
]
packages
:
[
'
g++-6'
,
'
clang-3.6'
,
'
ninja-build'
]
-
os
:
linux
-
os
:
linux
compiler
:
clang
compiler
:
clang
...
@@ -223,7 +213,7 @@ matrix:
...
@@ -223,7 +213,7 @@ matrix:
addons
:
addons
:
apt
:
apt
:
sources
:
[
'
ubuntu-toolchain-r-test'
,
'
llvm-toolchain-precise-3.7'
]
sources
:
[
'
ubuntu-toolchain-r-test'
,
'
llvm-toolchain-precise-3.7'
]
packages
:
[
'
g++-6'
,
'
clang-3.7'
]
packages
:
[
'
g++-6'
,
'
clang-3.7'
,
'
ninja-build'
]
-
os
:
linux
-
os
:
linux
compiler
:
clang
compiler
:
clang
...
@@ -231,7 +221,7 @@ matrix:
...
@@ -231,7 +221,7 @@ matrix:
addons
:
addons
:
apt
:
apt
:
sources
:
[
'
ubuntu-toolchain-r-test'
]
sources
:
[
'
ubuntu-toolchain-r-test'
]
packages
:
[
'
g++-6'
,
'
clang-3.8'
]
packages
:
[
'
g++-6'
,
'
clang-3.8'
,
'
ninja-build'
]
-
os
:
linux
-
os
:
linux
compiler
:
clang
compiler
:
clang
...
@@ -239,7 +229,7 @@ matrix:
...
@@ -239,7 +229,7 @@ matrix:
addons
:
addons
:
apt
:
apt
:
sources
:
[
'
ubuntu-toolchain-r-test'
]
sources
:
[
'
ubuntu-toolchain-r-test'
]
packages
:
[
'
g++-6'
,
'
clang-3.9'
]
packages
:
[
'
g++-6'
,
'
clang-3.9'
,
'
ninja-build'
]
-
os
:
linux
-
os
:
linux
compiler
:
clang
compiler
:
clang
...
@@ -247,7 +237,7 @@ matrix:
...
@@ -247,7 +237,7 @@ matrix:
addons
:
addons
:
apt
:
apt
:
sources
:
[
'
ubuntu-toolchain-r-test'
,
'
llvm-toolchain-trusty-4.0'
]
sources
:
[
'
ubuntu-toolchain-r-test'
,
'
llvm-toolchain-trusty-4.0'
]
packages
:
[
'
g++-6'
,
'
clang-4.0'
]
packages
:
[
'
g++-6'
,
'
clang-4.0'
,
'
ninja-build'
]
-
os
:
linux
-
os
:
linux
compiler
:
clang
compiler
:
clang
...
@@ -255,7 +245,7 @@ matrix:
...
@@ -255,7 +245,7 @@ matrix:
addons
:
addons
:
apt
:
apt
:
sources
:
[
'
ubuntu-toolchain-r-test'
,
'
llvm-toolchain-trusty-5.0'
]
sources
:
[
'
ubuntu-toolchain-r-test'
,
'
llvm-toolchain-trusty-5.0'
]
packages
:
[
'
g++-6'
,
'
clang-5.0'
]
packages
:
[
'
g++-6'
,
'
clang-5.0'
,
'
ninja-build'
]
-
os
:
linux
-
os
:
linux
compiler
:
clang
compiler
:
clang
...
@@ -265,7 +255,7 @@ matrix:
...
@@ -265,7 +255,7 @@ matrix:
addons
:
addons
:
apt
:
apt
:
sources
:
[
'
ubuntu-toolchain-r-test'
,
'
llvm-toolchain-trusty-5.0'
]
sources
:
[
'
ubuntu-toolchain-r-test'
,
'
llvm-toolchain-trusty-5.0'
]
packages
:
[
'
g++-6'
,
'
clang-5.0'
]
packages
:
[
'
g++-6'
,
'
clang-5.0'
,
'
ninja-build'
]
################
################
# build script #
# build script #
...
@@ -274,9 +264,9 @@ matrix:
...
@@ -274,9 +264,9 @@ matrix:
script
:
script
:
# get CMake (only for systems with brew - macOS)
# get CMake (only for systems with brew - macOS)
-
|
-
|
if [[
!(-x $(which cmake)) &&
(-x $(which brew)) ]]; then
if [[ (-x $(which brew)) ]]; then
brew update
brew update
brew install cmake
brew install cmake
ninja
cmake --version
cmake --version
fi
fi
...
@@ -289,7 +279,7 @@ script:
...
@@ -289,7 +279,7 @@ script:
# compile and execute unit tests
# compile and execute unit tests
-
mkdir -p build && cd build
-
mkdir -p build && cd build
-
cmake ..
&& cmake --build . --config Release -- -j4
-
cmake ..
${CMAKE_OPTIONS} -GNinja && cmake --build . --config Release
-
ctest -C Release -V
-
ctest -C Release -V
-
cd ..
-
cd ..
...
...
src/json.hpp
View file @
4e81c1db
...
@@ -745,11 +745,10 @@ struct external_constructor<value_t::array>
...
@@ -745,11 +745,10 @@ struct external_constructor<value_t::array>
enable_if_t
<
std
::
is_convertible
<
T
,
BasicJsonType
>
::
value
,
int
>
=
0
>
enable_if_t
<
std
::
is_convertible
<
T
,
BasicJsonType
>
::
value
,
int
>
=
0
>
static
void
construct
(
BasicJsonType
&
j
,
const
std
::
valarray
<
T
>&
arr
)
static
void
construct
(
BasicJsonType
&
j
,
const
std
::
valarray
<
T
>&
arr
)
{
{
using
std
::
begin
;
using
std
::
end
;
j
.
m_type
=
value_t
::
array
;
j
.
m_type
=
value_t
::
array
;
j
.
m_value
=
value_t
::
array
;
j
.
m_value
=
value_t
::
array
;
j
.
m_value
.
array
=
j
.
template
create
<
typename
BasicJsonType
::
array_t
>(
begin
(
arr
),
end
(
arr
));
j
.
m_value
.
array
->
resize
(
arr
.
size
());
std
::
copy
(
std
::
begin
(
arr
),
std
::
end
(
arr
),
j
.
m_value
.
array
->
begin
());
j
.
assert_invariant
();
j
.
assert_invariant
();
}
}
};
};
...
@@ -1190,10 +1189,7 @@ void from_json(const BasicJsonType& j, std::valarray<T>& l)
...
@@ -1190,10 +1189,7 @@ void from_json(const BasicJsonType& j, std::valarray<T>& l)
JSON_THROW
(
type_error
::
create
(
302
,
"type must be array, but is "
+
std
::
string
(
j
.
type_name
())));
JSON_THROW
(
type_error
::
create
(
302
,
"type must be array, but is "
+
std
::
string
(
j
.
type_name
())));
}
}
l
.
resize
(
j
.
size
());
l
.
resize
(
j
.
size
());
for
(
size_t
i
=
0
;
i
<
j
.
size
();
++
i
)
std
::
copy
(
j
.
m_value
.
array
->
begin
(),
j
.
m_value
.
array
->
end
(),
std
::
begin
(
l
));
{
l
[
i
]
=
j
[
i
];
}
}
}
template
<
typename
BasicJsonType
,
typename
CompatibleArrayType
>
template
<
typename
BasicJsonType
,
typename
CompatibleArrayType
>
...
...
test/CMakeLists.txt
View file @
4e81c1db
option
(
JSON_Sanitizer
"Build test suite with Clang sanitizer"
OFF
)
option
(
JSON_Valgrind
"Execute test suite with Valgrind"
OFF
)
option
(
JSON_NoExceptions
"Build test suite without exceptions"
OFF
)
if
(
JSON_Sanitizer
)
message
(
STATUS
"Building test suite with Clang sanitizer"
)
if
(
NOT MSVC
)
set
(
CMAKE_CXX_FLAGS
"-std=c++11 -g -O2 -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer"
)
endif
()
endif
()
if
(
JSON_Valgrind
)
find_program
(
CMAKE_MEMORYCHECK_COMMAND valgrind
)
message
(
STATUS
"Executing test suite with Valgrind (
${
CMAKE_MEMORYCHECK_COMMAND
}
)"
)
set
(
MEMORYCHECK_COMMAND_OPTIONS
"--error-exitcode=1 --leak-check=full"
)
set
(
memcheck_command
"
${
CMAKE_MEMORYCHECK_COMMAND
}
${
CMAKE_MEMORYCHECK_COMMAND_OPTIONS
}
"
)
separate_arguments
(
memcheck_command
)
endif
()
if
(
JSON_NoExceptions
)
message
(
STATUS
"Building test suite without exceptions"
)
if
(
NOT MSVC
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-DJSON_NOEXCEPTION"
)
endif
()
set
(
CATCH_TEST_FILTER -e
)
endif
()
#############################################################################
# Catch library with the main function to speed up build
#############################################################################
add_library
(
catch_main OBJECT
add_library
(
catch_main OBJECT
"src/unit.cpp"
"src/unit.cpp"
)
)
set_target_properties
(
catch_main PROPERTIES
set_target_properties
(
catch_main PROPERTIES
CXX_STANDARD 11
CXX_STANDARD 11
CXX_STANDARD_REQUIRED ON
CXX_STANDARD_REQUIRED ON
COMPILE_DEFINITIONS
"$<$<CXX_COMPILER_ID:MSVC>:_SCL_SECURE_NO_WARNINGS>"
COMPILE_OPTIONS
"$<$<CXX_COMPILER_ID:MSVC>:/EHsc;$<$<CONFIG:Release>:/Od>>"
)
)
target_include_directories
(
catch_main PRIVATE
"thirdparty/catch"
)
target_include_directories
(
catch_main PRIVATE
"thirdparty/catch"
)
# The unit test executable.
#############################################################################
set
(
JSON_UNITTEST_TARGET_NAME
"json_unit"
)
# one executable for each unit test file
add_executable
(
${
JSON_UNITTEST_TARGET_NAME
}
#############################################################################
$<TARGET_OBJECTS:catch_main>
"../src/json.hpp"
"src/unit-algorithms.cpp"
"src/unit-allocator.cpp"
"src/unit-capacity.cpp"
"src/unit-cbor.cpp"
"src/unit-class_const_iterator.cpp"
"src/unit-class_iterator.cpp"
"src/unit-class_lexer.cpp"
"src/unit-class_parser.cpp"
"src/unit-comparison.cpp"
"src/unit-concepts.cpp"
"src/unit-constructor1.cpp"
"src/unit-constructor2.cpp"
"src/unit-convenience.cpp"
"src/unit-conversions.cpp"
"src/unit-deserialization.cpp"
"src/unit-element_access1.cpp"
"src/unit-element_access2.cpp"
"src/unit-inspection.cpp"
"src/unit-iterator_wrapper.cpp"
"src/unit-iterators1.cpp"
"src/unit-iterators2.cpp"
"src/unit-json_patch.cpp"
"src/unit-json_pointer.cpp"
"src/unit-meta.cpp"
"src/unit-modifiers.cpp"
"src/unit-msgpack.cpp"
"src/unit-noexcept.cpp"
"src/unit-pointer_access.cpp"
"src/unit-readme.cpp"
"src/unit-reference_access.cpp"
"src/unit-regression.cpp"
"src/unit-serialization.cpp"
"src/unit-testsuites.cpp"
"src/unit-udt.cpp"
"src/unit-unicode.cpp"
)
set_target_properties
(
${
JSON_UNITTEST_TARGET_NAME
}
PROPERTIES
file
(
GLOB files
"src/unit-*.cpp"
)
CXX_STANDARD 11
foreach
(
file
${
files
}
)
CXX_STANDARD_REQUIRED ON
get_filename_component
(
file_basename
${
file
}
NAME_WE
)
)
string
(
REGEX REPLACE
"unit-([^$]+)"
"test-
\\
1"
testcase
${
file_basename
}
)
if
(
MSVC
)
add_executable
(
${
testcase
}
$<TARGET_OBJECTS:catch_main>
${
file
}
)
set_target_properties
(
${
JSON_UNITTEST_TARGET_NAME
}
PROPERTIES
set_target_properties
(
${
testcase
}
PROPERTIES
COMPILE_DEFINITIONS
"_SCL_SECURE_NO_WARNINGS"
CXX_STANDARD 11
COMPILE_OPTIONS
"/EHsc;$<$<CONFIG:Release>:/Od>"
CXX_STANDARD_REQUIRED ON
COMPILE_DEFINITIONS
"$<$<CXX_COMPILER_ID:MSVC>:_SCL_SECURE_NO_WARNINGS>"
COMPILE_OPTIONS
"$<$<CXX_COMPILER_ID:MSVC>:/EHsc;$<$<CONFIG:Release>:/Od>>"
)
)
endif
()
target_include_directories
(
${
JSON_UNITTEST_TARGET_NAME
}
PRIVATE
"src"
"thirdparty/catch"
)
target_compile_definitions
(
${
testcase
}
PRIVATE CATCH_CONFIG_FAST_COMPILE
)
target_link_libraries
(
${
JSON_UNITTEST_TARGET_NAME
}
${
JSON_TARGET_NAME
}
)
target_include_directories
(
${
testcase
}
PRIVATE
"thirdparty/catch"
)
target_link_libraries
(
${
testcase
}
${
JSON_TARGET_NAME
}
)
if
(
NOT MSVC
)
set_target_properties
(
${
testcase
}
PROPERTIES COMPILE_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-Wno-deprecated -Wno-float-equal"
)
endif
()
include
(
cotire OPTIONAL
)
if
(
COMMAND cotire
)
cotire
(
${
testcase
}
)
endif
()
include
(
cotire OPTIONAL
)
add_test
(
NAME
"
${
testcase
}
_default"
COMMAND
${
testcase
}
${
CATCH_TEST_FILTER
}
WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
)
set_tests_properties
(
"
${
testcase
}
_default"
PROPERTIES LABELS
"default"
)
if
(
COMMAND cotire
)
add_test
(
NAME
"
${
testcase
}
_all"
set_target_properties
(
${
JSON_UNITTEST_TARGET_NAME
}
PROPERTIES
COMMAND
${
testcase
}
${
CATCH_TEST_FILTER
}
"*"
COTIRE_ADD_UNITY_BUILD FALSE
WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
COTIRE_CXX_PREFIX_HEADER_INIT
"src/prefix.hpp"
)
)
# HACK - CMAKE_INCLUDE_SYSTEM_FLAG_CXX has a trailing space, which Cotire doesn't strip
set_tests_properties
(
"
${
testcase
}
_all"
PROPERTIES LABELS
"all"
)
# Technically, this fix should go in cotire.cmake. TODO - submit a pull request upstream.
if
(
CMAKE_INCLUDE_SYSTEM_FLAG_CXX
)
if
(
JSON_Valgrind
)
string
(
STRIP
"
${
CMAKE_INCLUDE_SYSTEM_FLAG_CXX
}
"
CMAKE_INCLUDE_SYSTEM_FLAG_CXX
)
add_test
(
NAME
"
${
testcase
}
_valgrind"
COMMAND
${
memcheck_command
}
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
testcase
}
${
CATCH_TEST_FILTER
}
WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
)
set_tests_properties
(
"
${
testcase
}
_valgrind"
PROPERTIES LABELS
"valgrind"
)
endif
()
endif
()
cotire
(
${
JSON_UNITTEST_TARGET_NAME
}
)
endif
()
add_test
(
NAME
"
${
JSON_UNITTEST_TARGET_NAME
}
_default"
endforeach
()
COMMAND
${
JSON_UNITTEST_TARGET_NAME
}
WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
)
add_test
(
NAME
"
${
JSON_UNITTEST_TARGET_NAME
}
_all"
COMMAND
${
JSON_UNITTEST_TARGET_NAME
}
"*"
WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
)
test/src/unit-algorithms.cpp
View file @
4e81c1db
...
@@ -256,6 +256,7 @@ TEST_CASE("algorithms")
...
@@ -256,6 +256,7 @@ TEST_CASE("algorithms")
SECTION
(
"set operations"
)
SECTION
(
"set operations"
)
{
{
/*
SECTION("std::merge")
SECTION("std::merge")
{
{
{
{
...
@@ -267,6 +268,7 @@ TEST_CASE("algorithms")
...
@@ -267,6 +268,7 @@ TEST_CASE("algorithms")
CHECK(j3 == json({1, 2, 2, 3, 4, 5, 6, 7, 8}));
CHECK(j3 == json({1, 2, 2, 3, 4, 5, 6, 7, 8}));
}
}
}
}
*/
SECTION
(
"std::set_difference"
)
SECTION
(
"std::set_difference"
)
{
{
...
@@ -288,6 +290,7 @@ TEST_CASE("algorithms")
...
@@ -288,6 +290,7 @@ TEST_CASE("algorithms")
CHECK
(
j3
==
json
({
1
,
2
,
3
,
5
,
7
}));
CHECK
(
j3
==
json
({
1
,
2
,
3
,
5
,
7
}));
}
}
/*
SECTION("std::set_union")
SECTION("std::set_union")
{
{
json j1 = {2, 4, 6, 8};
json j1 = {2, 4, 6, 8};
...
@@ -307,6 +310,7 @@ TEST_CASE("algorithms")
...
@@ -307,6 +310,7 @@ TEST_CASE("algorithms")
std::set_symmetric_difference(j1.begin(), j1.end(), j2.begin(), j2.end(), std::back_inserter(j3));
std::set_symmetric_difference(j1.begin(), j1.end(), j2.begin(), j2.end(), std::back_inserter(j3));
CHECK(j3 == json({1, 3, 4, 5, 6, 7, 8}));
CHECK(j3 == json({1, 3, 4, 5, 6, 7, 8}));
}
}
*/
}
}
SECTION
(
"heap operations"
)
SECTION
(
"heap operations"
)
...
...
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