From 0fcc414995a89eb2f706f7a2bf57d0112b328d2e Mon Sep 17 00:00:00 2001
From: Raphael Isemann <teemperor@gmail.com>
Date: Sat, 10 Jan 2015 18:28:53 +0100
Subject: [PATCH] More testing and updated CMake to allow calling private
 functions from the tests

---
 CMakeLists.txt    | 3 +++
 test/json_unit.cc | 6 ++++++
 2 files changed, 9 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index fc0d2c70..9e19f57f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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
diff --git a/test/json_unit.cc b/test/json_unit.cc
index ab679fbf..baad482a 100644
--- a/test/json_unit.cc
+++ b/test/json_unit.cc
@@ -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")