More testing and updated CMake to allow calling private functions from the tests

This commit is contained in:
Raphael Isemann 2015-01-10 18:28:53 +01:00
parent 6105ce5484
commit 0fcc414995
2 changed files with 9 additions and 0 deletions

View file

@ -4,6 +4,9 @@ project(json)
# Enable C++11 and set flags for coverage testing
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -g -O0 --coverage -fprofile-arcs -ftest-coverage")
# Make everything public for testing purposes
add_definitions(-Dprivate=public)
# If not specified, use Debug as build type (necessary for coverage testing)
if( NOT CMAKE_BUILD_TYPE )
set( CMAKE_BUILD_TYPE Debug CACHE STRING

View file

@ -1697,6 +1697,12 @@ TEST_CASE("Parser")
CHECK_THROWS_AS(json::parse("\"\\uD80C\\uD80C\""), std::invalid_argument);
CHECK_THROWS_AS(json::parse("\"\\uD80C\\u0000\""), std::invalid_argument);
CHECK_THROWS_AS(json::parse("\"\\uD80C\\uFFFF\""), std::invalid_argument);
// test private code point converter function
CHECK_NOTHROW(json::parser("").codePointToUTF8(0x10FFFE));
CHECK_NOTHROW(json::parser("").codePointToUTF8(0x10FFFF));
CHECK_THROWS_AS(json::parser("").codePointToUTF8(0x110000), std::invalid_argument);
CHECK_THROWS_AS(json::parser("").codePointToUTF8(0x110001), std::invalid_argument);
}
SECTION("boolean")