Split unit test into several executables

This commit is contained in:
Benoit Blanchon
2017-04-10 15:36:59 +02:00
parent ac89d91db5
commit 71edcaf20f
13 changed files with 192 additions and 57 deletions

View File

@ -7,11 +7,6 @@
include(gtest.cmake)
file(GLOB_RECURSE TESTS_FILES
*.hpp
*.cpp
)
if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)")
add_compile_options(
-fno-exceptions
@ -68,8 +63,15 @@ if(MSVC)
)
endif()
add_executable(ArduinoJsonTests ${TESTS_FILES})
target_include_directories(ArduinoJsonTests PRIVATE ${CMAKE_CURRENT_LIST_DIR}/../include)
target_link_libraries(ArduinoJsonTests gtest)
include_directories(${CMAKE_CURRENT_LIST_DIR}/../include)
add_test(ArduinoJsonTests ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ArduinoJsonTests)
add_subdirectory(DynamicJsonBuffer)
add_subdirectory(IntegrationTests)
add_subdirectory(JsonArray)
add_subdirectory(JsonBuffer)
add_subdirectory(JsonObject)
add_subdirectory(JsonVariant)
add_subdirectory(JsonWriter)
add_subdirectory(Misc)
add_subdirectory(Polyfills)
add_subdirectory(StaticJsonBuffer)

View File

@ -0,0 +1,17 @@
# Copyright Benoit Blanchon 2014-2017
# MIT License
#
# Arduino JSON library
# https://bblanchon.github.io/ArduinoJson/
# If you like this project, please add a star!
add_executable(DynamicJsonBufferTests
array.cpp
basics.cpp
noMemory.cpp
object.cpp
string.cpp
)
target_link_libraries(DynamicJsonBufferTests gtest)
add_test(DynamicJsonBuffer DynamicJsonBufferTests)

View File

@ -0,0 +1,14 @@
# Copyright Benoit Blanchon 2014-2017
# MIT License
#
# Arduino JSON library
# https://bblanchon.github.io/ArduinoJson/
# If you like this project, please add a star!
add_executable(IntegrationTests
gbathree.cpp
parse_print.cpp
)
target_link_libraries(IntegrationTests gtest)
add_test(IntegrationTests IntegrationTests)

View File

@ -0,0 +1,23 @@
# Copyright Benoit Blanchon 2014-2017
# MIT License
#
# Arduino JSON library
# https://bblanchon.github.io/ArduinoJson/
# If you like this project, please add a star!
add_executable(JsonArrayTests
add.cpp
basics.cpp
copyFrom.cpp
copyTo.cpp
invalid.cpp
iterator.cpp
prettyPrintTo.cpp
printTo.cpp
removeAt.cpp
set.cpp
subscript.cpp
)
target_link_libraries(JsonArrayTests gtest)
add_test(JsonArray JsonArrayTests)

View File

@ -0,0 +1,17 @@
# Copyright Benoit Blanchon 2014-2017
# MIT License
#
# Arduino JSON library
# https://bblanchon.github.io/ArduinoJson/
# If you like this project, please add a star!
add_executable(JsonBufferTests
nested.cpp
nestingLimit.cpp
parse.cpp
parseArray.cpp
parseObject.cpp
)
target_link_libraries(JsonBufferTests gtest)
add_test(JsonBuffer JsonBufferTests)

View File

@ -0,0 +1,22 @@
# Copyright Benoit Blanchon 2014-2017
# MIT License
#
# Arduino JSON library
# https://bblanchon.github.io/ArduinoJson/
# If you like this project, please add a star!
add_executable(JsonObjectTests
basics.cpp
containsKey.cpp
get.cpp
invalid.cpp
iterator.cpp
prettyPrintTo.cpp
printTo.cpp
remove.cpp
set.cpp
subscript.cpp
)
target_link_libraries(JsonObjectTests gtest)
add_test(JsonObject JsonObjectTests)

View File

@ -0,0 +1,21 @@
# Copyright Benoit Blanchon 2014-2017
# MIT License
#
# Arduino JSON library
# https://bblanchon.github.io/ArduinoJson/
# If you like this project, please add a star!
add_executable(JsonVariantTests
as.cpp
compare.cpp
copy.cpp
is.cpp
printTo.cpp
set_get.cpp
subscript.cpp
success.cpp
undefined.cpp
)
target_link_libraries(JsonVariantTests gtest)
add_test(JsonVariant JsonVariantTests)

View File

@ -0,0 +1,14 @@
# Copyright Benoit Blanchon 2014-2017
# MIT License
#
# Arduino JSON library
# https://bblanchon.github.io/ArduinoJson/
# If you like this project, please add a star!
add_executable(JsonWriterTests
writeFloat.cpp
writeString.cpp
)
target_link_libraries(JsonWriterTests gtest)
add_test(JsonWriter JsonWriterTests)

19
test/Misc/CMakeLists.txt Normal file
View File

@ -0,0 +1,19 @@
# Copyright Benoit Blanchon 2014-2017
# MIT License
#
# Arduino JSON library
# https://bblanchon.github.io/ArduinoJson/
# If you like this project, please add a star!
add_executable(MiscTests
deprecated.cpp
std_stream.cpp
std_string.cpp
StringBuilder.cpp
TypeTraits.cpp
unsigned_char.cpp
vla.cpp
)
target_link_libraries(MiscTests gtest)
add_test(Misc MiscTests)

View File

@ -0,0 +1,16 @@
# Copyright Benoit Blanchon 2014-2017
# MIT License
#
# Arduino JSON library
# https://bblanchon.github.io/ArduinoJson/
# If you like this project, please add a star!
add_executable(PolyfillsTests
isFloat.cpp
isInteger.cpp
parseFloat.cpp
parseInteger.cpp
)
target_link_libraries(PolyfillsTests gtest)
add_test(Polyfills PolyfillsTests)

View File

@ -0,0 +1,18 @@
# Copyright Benoit Blanchon 2014-2017
# MIT License
#
# Arduino JSON library
# https://bblanchon.github.io/ArduinoJson/
# If you like this project, please add a star!
add_executable(StaticJsonBufferTests
basics.cpp
createArray.cpp
createObject.cpp
parseArray.cpp
parseObject.cpp
string.cpp
)
target_link_libraries(StaticJsonBufferTests gtest)
add_test(StaticJsonBuffer StaticJsonBufferTests)