mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 08:42:39 +01:00 
			
		
		
		
	Split unit test into several executables
This commit is contained in:
		| @@ -10,10 +10,6 @@ project(ArduinoJson) | ||||
|  | ||||
| enable_testing() | ||||
|  | ||||
| set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib) | ||||
| set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib) | ||||
| set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin) | ||||
|  | ||||
| if(${COVERAGE}) | ||||
| 	set(CMAKE_CXX_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage") | ||||
| endif() | ||||
|   | ||||
| @@ -1,44 +0,0 @@ | ||||
| #!/bin/bash | ||||
|  | ||||
| FILE=../bin/ArduinoJsonTests.exe | ||||
| MD5="" | ||||
|  | ||||
| file_changed() { | ||||
| 	[[ ! -f  "$FILE" ]] && return 1 | ||||
| 	NEW_MD5=$(md5sum $FILE) | ||||
| 	[[ "$MD5" == "$NEW_MD5" ]] && return 1 | ||||
| 	MD5=$NEW_MD5 | ||||
| 	return 0 | ||||
| } | ||||
|  | ||||
| test_succeed() { | ||||
| 	echo -en "\007"{,} | ||||
| } | ||||
|  | ||||
| test_failed() { | ||||
| 	echo -en "\007"{,,,,,,,,,,,} | ||||
| } | ||||
|  | ||||
| run_tests() { | ||||
| 	$FILE | ||||
| 	case $? in | ||||
| 	0) | ||||
| 		test_succeed | ||||
| 		;; | ||||
| 	1)	 | ||||
| 		test_failed | ||||
| 		;; | ||||
| 	esac | ||||
| } | ||||
|  | ||||
| while true | ||||
| do | ||||
| 	if file_changed | ||||
| 	then	 | ||||
| 		run_tests | ||||
| 	else | ||||
| 		sleep 2 | ||||
| 	fi | ||||
| done | ||||
|  | ||||
|  | ||||
| @@ -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) | ||||
							
								
								
									
										17
									
								
								test/DynamicJsonBuffer/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								test/DynamicJsonBuffer/CMakeLists.txt
									
									
									
									
									
										Normal 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) | ||||
							
								
								
									
										14
									
								
								test/IntegrationTests/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								test/IntegrationTests/CMakeLists.txt
									
									
									
									
									
										Normal 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) | ||||
							
								
								
									
										23
									
								
								test/JsonArray/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								test/JsonArray/CMakeLists.txt
									
									
									
									
									
										Normal 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) | ||||
							
								
								
									
										17
									
								
								test/JsonBuffer/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								test/JsonBuffer/CMakeLists.txt
									
									
									
									
									
										Normal 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) | ||||
							
								
								
									
										22
									
								
								test/JsonObject/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								test/JsonObject/CMakeLists.txt
									
									
									
									
									
										Normal 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) | ||||
							
								
								
									
										21
									
								
								test/JsonVariant/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								test/JsonVariant/CMakeLists.txt
									
									
									
									
									
										Normal 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) | ||||
							
								
								
									
										14
									
								
								test/JsonWriter/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								test/JsonWriter/CMakeLists.txt
									
									
									
									
									
										Normal 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
									
								
							
							
						
						
									
										19
									
								
								test/Misc/CMakeLists.txt
									
									
									
									
									
										Normal 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) | ||||
							
								
								
									
										16
									
								
								test/Polyfills/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								test/Polyfills/CMakeLists.txt
									
									
									
									
									
										Normal 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) | ||||
							
								
								
									
										18
									
								
								test/StaticJsonBuffer/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								test/StaticJsonBuffer/CMakeLists.txt
									
									
									
									
									
										Normal 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) | ||||
		Reference in New Issue
	
	Block a user