Run all tests with C++11 enabled (#1820)

This commit is contained in:
Benoit Blanchon
2023-02-09 18:57:34 +01:00
parent c2de812cbd
commit 94b2b3f9ce
14 changed files with 8 additions and 48 deletions

View File

@ -46,7 +46,8 @@ ArduinoJson is a C++ JSON library for Arduino and IoT (Internet Of Things).
* Supports [custom converters](https://arduinojson.org/news/2021/05/04/version-6-18-0/) * Supports [custom converters](https://arduinojson.org/news/2021/05/04/version-6-18-0/)
* Portable * Portable
* Usable on any C++ project (not limited to Arduino) * Usable on any C++ project (not limited to Arduino)
* Compatible with C++98, C++11, C++14 and C++17 * Compatible with C++11, C++14 and C++17
* Support for C++98/C++03 available on [ArduinoJson 6.20.x](https://github.com/bblanchon/ArduinoJson/tree/6.20.x)
* Zero warnings with `-Wall -Wextra -pedantic` and `/W4` * Zero warnings with `-Wall -Wextra -pedantic` and `/W4`
* [Header-only library](https://en.wikipedia.org/wiki/Header-only) * [Header-only library](https://en.wikipedia.org/wiki/Header-only)
* Works with virtually any board * Works with virtually any board

View File

@ -2,7 +2,7 @@
# Copyright © 2014-2022, Benoit BLANCHON # Copyright © 2014-2022, Benoit BLANCHON
# MIT License # MIT License
set(CMAKE_CXX_STANDARD 98) set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_subdirectory(catch) add_subdirectory(catch)
@ -10,7 +10,6 @@ add_subdirectory(catch)
link_libraries(ArduinoJson catch) link_libraries(ArduinoJson catch)
include_directories(Helpers) include_directories(Helpers)
add_subdirectory(Cpp11)
add_subdirectory(Cpp17) add_subdirectory(Cpp17)
add_subdirectory(Cpp20) add_subdirectory(Cpp20)
add_subdirectory(FailingBuilds) add_subdirectory(FailingBuilds)

View File

@ -1,36 +0,0 @@
# ArduinoJson - https://arduinojson.org
# Copyright © 2014-2022, Benoit BLANCHON
# MIT License
if("cxx_nullptr" IN_LIST CMAKE_CXX_COMPILE_FEATURES)
list(APPEND SOURCES nullptr.cpp)
add_definitions(-DARDUINOJSON_HAS_NULLPTR=1)
endif()
if("cxx_auto_type" IN_LIST CMAKE_CXX_COMPILE_FEATURES AND "cxx_constexpr" IN_LIST CMAKE_CXX_COMPILE_FEATURES)
list(APPEND SOURCES issue1120.cpp)
endif()
if("cxx_long_long_type" IN_LIST CMAKE_CXX_COMPILE_FEATURES)
list(APPEND SOURCES use_long_long_0.cpp use_long_long_1.cpp)
endif()
if("cxx_range_for" IN_LIST CMAKE_CXX_COMPILE_FEATURES AND "cxx_generalized_initializers" IN_LIST CMAKE_CXX_COMPILE_FEATURES)
list(APPEND SOURCES stl_containers.cpp)
endif()
if(NOT SOURCES)
return()
endif()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_executable(Cpp11Tests ${SOURCES})
add_test(Cpp11 Cpp11Tests)
set_tests_properties(Cpp11
PROPERTIES
LABELS "Catch"
)

View File

@ -31,11 +31,9 @@ add_executable(Issue1189 Issue1189.cpp)
build_should_fail(Issue1189) build_should_fail(Issue1189)
add_executable(read_long_long read_long_long.cpp) add_executable(read_long_long read_long_long.cpp)
set_property(TARGET read_long_long PROPERTY CXX_STANDARD 11)
build_should_fail(read_long_long) build_should_fail(read_long_long)
add_executable(write_long_long write_long_long.cpp) add_executable(write_long_long write_long_long.cpp)
set_property(TARGET write_long_long PROPERTY CXX_STANDARD 11)
build_should_fail(write_long_long) build_should_fail(write_long_long)
add_executable(delete_jsondocument delete_jsondocument.cpp) add_executable(delete_jsondocument delete_jsondocument.cpp)

View File

@ -9,10 +9,6 @@
# error This test requires sizeof(long) < 8 # error This test requires sizeof(long) < 8
#endif #endif
#if !ARDUINOJSON_HAS_LONG_LONG
# error This test requires C++11
#endif
ARDUINOJSON_ASSERT_INTEGER_TYPE_IS_SUPPORTED(long long) ARDUINOJSON_ASSERT_INTEGER_TYPE_IS_SUPPORTED(long long)
int main() { int main() {
DynamicJsonDocument doc(1024); DynamicJsonDocument doc(1024);

View File

@ -12,6 +12,7 @@ add_executable(JsonDocumentTests
DynamicJsonDocument.cpp DynamicJsonDocument.cpp
ElementProxy.cpp ElementProxy.cpp
isNull.cpp isNull.cpp
issue1120.cpp
MemberProxy.cpp MemberProxy.cpp
nesting.cpp nesting.cpp
overflowed.cpp overflowed.cpp

View File

@ -16,12 +16,14 @@ add_executable(JsonVariantTests
memoryUsage.cpp memoryUsage.cpp
misc.cpp misc.cpp
nesting.cpp nesting.cpp
nullptr.cpp
or.cpp or.cpp
overflow.cpp overflow.cpp
remove.cpp remove.cpp
set.cpp set.cpp
shallowCopy.cpp shallowCopy.cpp
size.cpp size.cpp
stl_containers.cpp
subscript.cpp subscript.cpp
types.cpp types.cpp
unbound.cpp unbound.cpp

View File

@ -19,6 +19,8 @@ add_executable(MixedConfigurationTests
issue1707.cpp issue1707.cpp
use_double_0.cpp use_double_0.cpp
use_double_1.cpp use_double_1.cpp
use_long_long_0.cpp
use_long_long_1.cpp
) )
set_target_properties(MixedConfigurationTests PROPERTIES UNITY_BUILD OFF) set_target_properties(MixedConfigurationTests PROPERTIES UNITY_BUILD OFF)

View File

@ -2,9 +2,6 @@
# Copyright © 2014-2022, Benoit BLANCHON # Copyright © 2014-2022, Benoit BLANCHON
# MIT License # MIT License
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED OFF)
add_executable(NumbersTests add_executable(NumbersTests
convertNumber.cpp convertNumber.cpp
parseFloat.cpp parseFloat.cpp