[waffle] [PATCH 15/29] cmocka: update to cmocka-1.0.1-ab3ec0da8c5

Emil Velikov emil.l.velikov at gmail.com
Wed Jan 6 13:27:41 PST 2016


In an efford to rework the gl_basic tests, we need to be able to skip
tests. Older version did not support this :\

Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
 third_party/cmocka/AUTHORS                         |    2 +-
 third_party/cmocka/CMakeLists.txt                  |   33 +-
 third_party/cmocka/CPackConfig.cmake               |    2 +-
 third_party/cmocka/CTestConfig.cmake               |    2 +-
 third_party/cmocka/ChangeLog                       |   35 +
 third_party/cmocka/ConfigureChecks.cmake           |   44 +
 third_party/cmocka/DefineOptions.cmake             |    5 +
 .../cmocka/cmake/Modules/DefineCMakeDefaults.cmake |    9 +
 .../cmocka/cmake/Modules/DefineCompilerFlags.cmake |    9 +-
 .../cmake/Modules/DefineInstallationPaths.cmake    |   14 +-
 third_party/cmocka/cmake/Modules/UseDoxygen.cmake  |  174 +-
 .../cmocka/cmocka-build-tree-settings.cmake.in     |    1 +
 third_party/cmocka/cmocka-config-version.cmake.in  |   11 +
 third_party/cmocka/cmocka-config.cmake.in          |   11 +
 third_party/cmocka/config.h.cmake                  |   50 +-
 .../cmocka/coverity/coverity_assert_model.c        |   10 +
 third_party/cmocka/doc/Doxyfile.in                 | 2358 ++++++++++++++++++++
 third_party/cmocka/doc/index.html                  |    4 +-
 third_party/cmocka/doc/mainpage.dox                |   96 +-
 third_party/cmocka/example/CMakeLists.txt          |   83 +-
 third_party/cmocka/example/allocate_module.c       |    2 +-
 third_party/cmocka/example/allocate_module_test.c  |   10 +-
 third_party/cmocka/example/assert_macro_test.c     |    8 +-
 third_party/cmocka/example/assert_module.c         |    2 +-
 third_party/cmocka/example/assert_module_test.c    |   10 +-
 third_party/cmocka/example/calculator.c            |    2 +-
 third_party/cmocka/example/calculator_test.c       |   76 +-
 .../cmocka/example/chef_wrap/CMakeLists.txt        |    3 +
 .../cmocka/example/chef_wrap/waiter_test_wrap.c    |   14 +-
 .../cmocka/example/customer_database_test.c        |   11 +-
 third_party/cmocka/example/key_value_test.c        |   20 +-
 third_party/cmocka/example/product_database_test.c |   12 +-
 third_party/cmocka/example/simple_test.c           |   17 +
 third_party/cmocka/include/CMakeLists.txt          |   13 +
 third_party/cmocka/include/cmocka.h                |  587 ++++-
 third_party/cmocka/include/cmocka_pbc.h            |   62 +
 third_party/cmocka/include/cmocka_private.h        |  109 +-
 third_party/cmocka/include/cmockery/cmockery.h     |    1 +
 third_party/cmocka/include/cmockery/pbc.h          |    1 +
 third_party/cmocka/src/CMakeLists.txt              |   36 +-
 third_party/cmocka/src/cmocka.c                    | 1368 +++++++++++-
 third_party/cmocka/src/cmocka.def                  |    5 +
 third_party/cmocka/tests/CMakeLists.txt            |  172 ++
 third_party/cmocka/tests/ctest-default.cmake       |   74 +
 third_party/cmocka/tests/test_alloc.c              |   91 +
 third_party/cmocka/tests/test_assert_macros.c      |   41 +
 third_party/cmocka/tests/test_assert_macros_fail.c |   43 +
 third_party/cmocka/tests/test_basics.c             |   62 +
 third_party/cmocka/tests/test_cmockery.c           |   32 +
 third_party/cmocka/tests/test_exception_handler.c  |   28 +
 third_party/cmocka/tests/test_fixtures.c           |   45 +
 third_party/cmocka/tests/test_group_fixtures.c     |   48 +
 third_party/cmocka/tests/test_group_setup_fail.c   |   34 +
 third_party/cmocka/tests/test_setup_fail.c         |   54 +
 third_party/cmocka/tests/test_skip.c               |   39 +
 55 files changed, 5613 insertions(+), 472 deletions(-)
 create mode 100644 third_party/cmocka/cmocka-build-tree-settings.cmake.in
 create mode 100644 third_party/cmocka/cmocka-config-version.cmake.in
 create mode 100644 third_party/cmocka/cmocka-config.cmake.in
 create mode 100644 third_party/cmocka/doc/Doxyfile.in
 create mode 100644 third_party/cmocka/example/simple_test.c
 create mode 100644 third_party/cmocka/include/cmocka_pbc.h
 create mode 100644 third_party/cmocka/include/cmockery/cmockery.h
 create mode 100644 third_party/cmocka/include/cmockery/pbc.h
 create mode 100644 third_party/cmocka/tests/CMakeLists.txt
 create mode 100644 third_party/cmocka/tests/ctest-default.cmake
 create mode 100644 third_party/cmocka/tests/test_alloc.c
 create mode 100644 third_party/cmocka/tests/test_assert_macros.c
 create mode 100644 third_party/cmocka/tests/test_assert_macros_fail.c
 create mode 100644 third_party/cmocka/tests/test_basics.c
 create mode 100644 third_party/cmocka/tests/test_cmockery.c
 create mode 100644 third_party/cmocka/tests/test_exception_handler.c
 create mode 100644 third_party/cmocka/tests/test_fixtures.c
 create mode 100644 third_party/cmocka/tests/test_group_fixtures.c
 create mode 100644 third_party/cmocka/tests/test_group_setup_fail.c
 create mode 100644 third_party/cmocka/tests/test_setup_fail.c
 create mode 100644 third_party/cmocka/tests/test_skip.c

diff --git a/third_party/cmocka/AUTHORS b/third_party/cmocka/AUTHORS
index 0655e3f..1fe0d34 100644
--- a/third_party/cmocka/AUTHORS
+++ b/third_party/cmocka/AUTHORS
@@ -1,3 +1,3 @@
 opensource at google.com
 Andreas Schneider <asn at cryptomilk.org>
-Jakub Hrozek <jhrozek at redhat.com>
+Jakub Hrozek <jakub.hrozek at posteo.se>
diff --git a/third_party/cmocka/CMakeLists.txt b/third_party/cmocka/CMakeLists.txt
index 7926cee..70a8ad1 100644
--- a/third_party/cmocka/CMakeLists.txt
+++ b/third_party/cmocka/CMakeLists.txt
@@ -6,9 +6,9 @@ cmake_minimum_required(VERSION 2.6.0)
 # global needed variables
 set(APPLICATION_NAME ${PROJECT_NAME})
 
-set(APPLICATION_VERSION_MAJOR "0")
-set(APPLICATION_VERSION_MINOR "3")
-set(APPLICATION_VERSION_PATCH "2")
+set(APPLICATION_VERSION_MAJOR "1")
+set(APPLICATION_VERSION_MINOR "0")
+set(APPLICATION_VERSION_PATCH "1")
 
 set(APPLICATION_VERSION "${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINOR}.${APPLICATION_VERSION_PATCH}")
 
@@ -19,7 +19,7 @@ set(APPLICATION_VERSION "${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINO
 #     Increment AGE. Set REVISION to 0
 #   If the source code was changed, but there were no interface changes:
 #     Increment REVISION.
-set(LIBRARY_VERSION "0.1.2")
+set(LIBRARY_VERSION "0.3.1")
 set(LIBRARY_SOVERSION "0")
 
 # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
@@ -35,10 +35,6 @@ include(DefineInstallationPaths)
 include(DefineOptions.cmake)
 include(CPackConfig.cmake)
 
-if (UNIT_TESTING)
-    include(AddCMockaTest)
-endif (UNIT_TESTING)
-
 # disallow in-source build
 include(MacroEnsureOutOfSourceBuild)
 macro_ensure_out_of_source_build("${PROJECT_NAME} requires an out of source build. Please create a separate build directory and run 'cmake /path/to/${PROJECT_NAME} [options]' there.")
@@ -51,10 +47,14 @@ configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
 add_subdirectory(doc)
 add_subdirectory(include)
 add_subdirectory(src)
+
 if (UNIT_TESTING)
-    add_subdirectory(example)
+    include(AddCMockaTest)
+    add_subdirectory(tests)
 endif (UNIT_TESTING)
 
+add_subdirectory(example)
+
 # pkg-config file
 configure_file(cmocka.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/cmocka.pc)
 install(
@@ -65,3 +65,18 @@ install(
   COMPONENT
     pkgconfig
 )
+
+# cmake config files
+set(CMOCKA_LIBRARY_NAME ${CMAKE_SHARED_LIBRARY_PREFIX}${PROJECT_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX})
+
+configure_file(${PROJECT_NAME}-config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake @ONLY)
+configure_file(${PROJECT_NAME}-config-version.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake @ONLY)
+install(
+    FILES
+        ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake
+        ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake
+    DESTINATION
+        ${CMAKE_INSTALL_DIR}/${PROJECT_NAME}
+    COMPONENT
+        devel
+)
diff --git a/third_party/cmocka/CPackConfig.cmake b/third_party/cmocka/CPackConfig.cmake
index 25d922a..5666c5a 100644
--- a/third_party/cmocka/CPackConfig.cmake
+++ b/third_party/cmocka/CPackConfig.cmake
@@ -19,7 +19,7 @@ set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSIO
 
 ### source generator
 set(CPACK_SOURCE_GENERATOR "TGZ")
-set(CPACK_SOURCE_IGNORE_FILES "~$;[.]swp$;/[.]svn/;/[.]git/;.gitignore;/build/;tags;cscope.*")
+set(CPACK_SOURCE_IGNORE_FILES "~$;[.]swp$;/[.]svn/;/[.]git/;.gitignore;obj*;tags;cscope.*;.ycm_extra_conf.pyc")
 set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
 
 if (WIN32)
diff --git a/third_party/cmocka/CTestConfig.cmake b/third_party/cmocka/CTestConfig.cmake
index 30a2155..f93a981 100644
--- a/third_party/cmocka/CTestConfig.cmake
+++ b/third_party/cmocka/CTestConfig.cmake
@@ -3,7 +3,7 @@ set(UPDATE_TYPE "true")
 set(CTEST_PROJECT_NAME "cmocka")
 set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC")
 
-set(CTEST_DROP_METHOD "http")
+set(CTEST_DROP_METHOD "https")
 set(CTEST_DROP_SITE "mock.cryptomilk.org")
 set(CTEST_DROP_LOCATION "/submit.php?project=${CTEST_PROJECT_NAME}")
 set(CTEST_DROP_SITE_CDASH TRUE)
diff --git a/third_party/cmocka/ChangeLog b/third_party/cmocka/ChangeLog
index 074161d..819d10f 100644
--- a/third_party/cmocka/ChangeLog
+++ b/third_party/cmocka/ChangeLog
@@ -1,3 +1,38 @@
+Thu Mar 12 2015 Andreas Schneider <asn at cryptomilk.org>
+    * cmocka: version 1.0.1
+    * Added a macro for assert_ptr_equal().
+    * Fixed test_realloc() if 0 size is passed.
+    * Fixed objects packaging bug.
+    * Fixed building with newer gcc versions.
+
+Sun Feb 16 2015 Andreas Schneider <asn at cryptomilk.org>
+    * cmocka: version 1.0.0
+    * Added new test runner with group fixtures. The old runner is deprecated
+    * Added an extensible message output formatter
+    * Added jUnit XML message output
+    * Added subunit message output
+    * Added Test Anything Protocol message output
+    * Added skip() command
+    * Added test_realloc()
+    * Added a cmockery compat header
+    * Fixed a lot of bugs on Windows
+
+Thu May 22 2014 Andreas Schneider <asn at cryptomilk.org>
+    * cmocka: version 0.4.1
+    * Added CMOCKA_TEST_ABORT env variable to leave threading apps.
+    * Fixed count parameter of expect_check() macro.
+    * Fixed reporting the number of tests.
+    * Fixed cmake config files.
+
+Fri Apr 11 2014 Andreas Schneider <asn at cryptomilk.org>
+    * cmocka: version 0.4.0
+    * Added support for group testing.
+    * Added assert_return_code().
+    * Added better messages for errors.
+    * Added cmake config mode support.
+    * Fixed bug with unit_test_setup and unit_test_teardown.
+    * Fixed a lot of small bugs.
+
 Wed Nov 06 2013 Andreas Schneider <asn at cryptomilk.org>
     * cmocka: version 0.3.2
     * Fixed FindNSIS detection.
diff --git a/third_party/cmocka/ConfigureChecks.cmake b/third_party/cmocka/ConfigureChecks.cmake
index 0d62529..c0dd13d 100644
--- a/third_party/cmocka/ConfigureChecks.cmake
+++ b/third_party/cmocka/ConfigureChecks.cmake
@@ -4,6 +4,7 @@ include(CheckFunctionExists)
 include(CheckLibraryExists)
 include(CheckTypeSize)
 include(CheckCXXSourceCompiles)
+include(CheckStructHasMember)
 include(TestBigEndian)
 
 set(PACKAGE ${APPLICATION_NAME})
@@ -48,6 +49,7 @@ endif (SOLARIS)
 # HEADER FILES
 check_include_file(assert.h HAVE_ASSERT_H)
 check_include_file(inttypes.h HAVE_INTTYPES_H)
+check_include_file(io.h HAVE_IO_H)
 check_include_file(malloc.h HAVE_MALLOC_H)
 check_include_file(memory.h HAVE_MEMORY_H)
 check_include_file(setjmp.h HAVE_SETJMP_H)
@@ -61,8 +63,12 @@ check_include_file(string.h HAVE_STRING_H)
 check_include_file(strings.h HAVE_STRINGS_H)
 check_include_file(sys/stat.h HAVE_SYS_STAT_H)
 check_include_file(sys/types.h HAVE_SYS_TYPES_H)
+check_include_file(time.h HAVE_TIME_H)
 check_include_file(unistd.h HAVE_UNISTD_H)
 
+if (HAVE_TIME_H)
+    check_struct_has_member("struct timespec" tv_sec "time.h" HAVE_STRUCT_TIMESPEC)
+endif (HAVE_TIME_H)
 
 # FUNCTIONS
 check_function_exists(calloc HAVE_CALLOC)
@@ -80,6 +86,7 @@ check_function_exists(strsignal HAVE_STRSIGNAL)
 check_function_exists(sprintf HAVE_SNPRINTF)
 check_function_exists(strcmp HAVE_STRCMP)
 check_function_exists(vsnprintf HAVE_VSNPRINTF)
+check_function_exists(clock_gettime HAVE_CLOCK_GETTIME)
 
 if (WIN32)
     check_function_exists(_vsnprintf_s HAVE__VSNPRINTF_S)
@@ -88,9 +95,46 @@ if (WIN32)
     check_function_exists(_snprintf_s HAVE__SNPRINTF_S)
 endif (WIN32)
 
+find_library(RT_LIBRARY rt)
+if (RT_LIBRARY)
+    set(CMAKE_REQUIRED_LIBRARIES ${RT_LIBRARY})
+endif (RT_LIBRARY)
+
 set(CMOCKA_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CACHE INTERNAL "cmocka required system libraries")
 
 # OPTIONS
+check_c_source_compiles("
+__thread int tls;
+
+int main(void) {
+    return 0;
+}" HAVE_GCC_THREAD_LOCAL_STORAGE)
+
+if (WIN32)
+check_c_source_compiles("
+__declspec(thread) int tls;
+
+int main(void) {
+    return 0;
+}" HAVE_MSVC_THREAD_LOCAL_STORAGE)
+endif(WIN32)
+
+if (HAVE_TIME_H AND HAVE_STRUCT_TIMESPEC AND HAVE_CLOCK_GETTIME)
+    set(CMAKE_REQUIRED_LIBRARIES ${RT_LIBRARY})
+
+    message(STATUS "CMAKE_REQUIRED_INCLUDES=${CMAKE_REQUIRED_INCLUDES} CMAKE_REQUIRED_LIBRARIES=${CMAKE_REQUIRED_LIBRARIES}")
+    check_c_source_compiles("
+#include <time.h>
+
+int main(void) {
+    struct timespec ts;
+
+    clock_gettime(CLOCK_REALTIME, &ts);
+
+    return 0;
+}" HAVE_CLOCK_GETTIME_REALTIME)
+    set(CMAKE_REQUIRED_INCLUDES)
+endif ()
 
 # ENDIAN
 if (NOT WIN32)
diff --git a/third_party/cmocka/DefineOptions.cmake b/third_party/cmocka/DefineOptions.cmake
index 86b94fb..7564a22 100644
--- a/third_party/cmocka/DefineOptions.cmake
+++ b/third_party/cmocka/DefineOptions.cmake
@@ -1,2 +1,7 @@
 option(WITH_STATIC_LIB "Build with a static library" OFF)
+option(WITH_CMOCKERY_SUPPORT "Install a cmockery header" OFF)
 option(UNIT_TESTING "Build with unit testing" OFF)
+
+if (UNIT_TESTING)
+    set(WITH_STATIC_LIB ON)
+endif()
diff --git a/third_party/cmocka/cmake/Modules/DefineCMakeDefaults.cmake b/third_party/cmocka/cmake/Modules/DefineCMakeDefaults.cmake
index 72893c3..a08eca1 100644
--- a/third_party/cmocka/cmake/Modules/DefineCMakeDefaults.cmake
+++ b/third_party/cmocka/cmake/Modules/DefineCMakeDefaults.cmake
@@ -25,3 +25,12 @@ if (NOT CMAKE_BUILD_TYPE)
       "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
   )
 endif (NOT CMAKE_BUILD_TYPE)
+
+# Create the compile command database for clang by default
+set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
+
+if (APPLE)
+    set(CMAKE_MACOSX_RPATH ON)
+    set(CMAKE_SKIP_BUILD_RPATH  FALSE)
+    set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
+endif(APPLE)
diff --git a/third_party/cmocka/cmake/Modules/DefineCompilerFlags.cmake b/third_party/cmocka/cmake/Modules/DefineCompilerFlags.cmake
index dcf79ab..14d473f 100644
--- a/third_party/cmocka/cmake/Modules/DefineCompilerFlags.cmake
+++ b/third_party/cmocka/cmake/Modules/DefineCompilerFlags.cmake
@@ -13,7 +13,7 @@ if (UNIX AND NOT WIN32)
         set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -pedantic -pedantic-errors")
         set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wshadow -Wmissing-prototypes -Wdeclaration-after-statement")
         set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused -Wfloat-equal -Wpointer-arith -Wwrite-strings -Wformat-security")
-        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wmissing-format-attribute")
+        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wmissing-format-attribute -Wundef")
 
         # with -fPIC
         check_c_compiler_flag("-fPIC" WITH_FPIC)
@@ -28,7 +28,7 @@ if (UNIX AND NOT WIN32)
 
         if (CMAKE_BUILD_TYPE)
             string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWER)
-            if (NOT CMAKE_BUILD_TYPE_LOWER MATCHES debug)
+            if (CMAKE_BUILD_TYPE_LOWER MATCHES (release|relwithdebinfo|minsizerel))
                 check_c_compiler_flag("-Wp,-D_FORTIFY_SOURCE=2" WITH_FORTIFY_SOURCE)
                 if (WITH_FORTIFY_SOURCE)
                     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wp,-D_FORTIFY_SOURCE=2")
@@ -36,10 +36,7 @@ if (UNIX AND NOT WIN32)
             endif()
         endif()
 
-        check_c_compiler_flag("-D_GNU_SOURCE" WITH_GNU_SOURCE)
-        if (WITH_GNU_SOURCE)
-            set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE")
-        endif (WITH_GNU_SOURCE)
+        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE")
     endif (${CMAKE_C_COMPILER_ID} MATCHES "(GNU|Clang)")
 
     #
diff --git a/third_party/cmocka/cmake/Modules/DefineInstallationPaths.cmake b/third_party/cmocka/cmake/Modules/DefineInstallationPaths.cmake
index 14507ed..88e08ca 100644
--- a/third_party/cmocka/cmake/Modules/DefineInstallationPaths.cmake
+++ b/third_party/cmocka/cmake/Modules/DefineInstallationPaths.cmake
@@ -1,4 +1,4 @@
-if (UNIX)
+if (UNIX OR OS2)
   IF (NOT APPLICATION_NAME)
     MESSAGE(STATUS "${PROJECT_NAME} is used as APPLICATION_NAME")
     SET(APPLICATION_NAME ${PROJECT_NAME})
@@ -47,6 +47,10 @@ if (UNIX)
     CACHE PATH "The subdirectory to the header prefix (default prefix/include)"
   )
 
+  set(CMAKE_INSTALL_DIR
+    "${LIB_INSTALL_DIR}/cmake"
+    CACHE PATH "The subdirectory to install cmake config files")
+
   SET(DATA_INSTALL_DIR
     "${DATA_INSTALL_PREFIX}"
     CACHE PATH "The parent directory where applications can install their data (default prefix/share/${APPLICATION_NAME})"
@@ -91,13 +95,15 @@ if (UNIX)
     CACHE PATH "The ${APPLICATION_NAME} info install dir (default prefix/info)"
   )
 else()
+  # Same same
   set(BIN_INSTALL_DIR "bin" CACHE PATH "-")
-  set(SBIN_INSTALL_DIR "." CACHE PATH "-")
+  set(SBIN_INSTALL_DIR "sbin" CACHE PATH "-")
   set(LIB_INSTALL_DIR "lib${LIB_SUFFIX}" CACHE PATH "-")
   set(INCLUDE_INSTALL_DIR "include" CACHE PATH "-")
+  set(CMAKE_INSTALL_DIR "CMake" CACHE PATH "-")
   set(PLUGIN_INSTALL_DIR "plugins" CACHE PATH "-")
   set(HTML_INSTALL_DIR "doc/HTML" CACHE PATH "-")
-  set(ICON_INSTALL_DIR "." CACHE PATH "-")
-  set(SOUND_INSTALL_DIR "." CACHE PATH "-")
+  set(ICON_INSTALL_DIR "icons" CACHE PATH "-")
+  set(SOUND_INSTALL_DIR "soudns" CACHE PATH "-")
   set(LOCALE_INSTALL_DIR "lang" CACHE PATH "-")
 endif ()
diff --git a/third_party/cmocka/cmake/Modules/UseDoxygen.cmake b/third_party/cmocka/cmake/Modules/UseDoxygen.cmake
index 723220b..72c384d 100644
--- a/third_party/cmocka/cmake/Modules/UseDoxygen.cmake
+++ b/third_party/cmocka/cmake/Modules/UseDoxygen.cmake
@@ -2,10 +2,18 @@
 #
 # Adds a doxygen target that runs doxygen to generate the html
 # and optionally the LaTeX API documentation.
-# The doxygen target is added to the doc target as dependency.
+# The doxygen target is added to the doc target as a dependency.
 # i.e.: the API documentation is built with:
 #  make doc
 #
+# USAGE: GLOBAL INSTALL
+#
+# Install it with:
+#  cmake ./ && sudo make install
+# Add the following to the CMakeLists.txt of your project:
+#  include(UseDoxygen OPTIONAL)
+# Optionally copy Doxyfile.in in the directory of CMakeLists.txt and edit it.
+#
 # USAGE: INCLUDE IN PROJECT
 #
 #  set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
@@ -13,88 +21,120 @@
 # Add the Doxyfile.in and UseDoxygen.cmake files to the projects source directory.
 #
 #
-# Variables you may define are:
-#  DOXYFILE_OUTPUT_DIR - Path where the Doxygen output is stored. Defaults to "doc".
+# CONFIGURATION
 #
-#  DOXYFILE_LATEX_DIR - Directory where the Doxygen LaTeX output is stored. Defaults to "latex".
-#
-#  DOXYFILE_HTML_DIR - Directory where the Doxygen html output is stored. Defaults to "html".
+# To configure Doxygen you can edit Doxyfile.in and set some variables in cmake.
+# Variables you may define are:
+#  DOXYFILE_SOURCE_DIR - Path where the Doxygen input files are.
+#  	Defaults to the current source directory.
+#  DOXYFILE_EXTRA_SOURCES - Additional source diretories/files for Doxygen to scan.
+#  	The Paths should be in double quotes and separated by space. e.g.:
+#  	 "${CMAKE_CURRENT_BINARY_DIR}/foo.c" "${CMAKE_CURRENT_BINARY_DIR}/bar/"
+#  
+#  DOXYFILE_OUTPUT_DIR - Path where the Doxygen output is stored.
+#  	Defaults to "${CMAKE_CURRENT_BINARY_DIR}/doc".
+#  
+#  DOXYFILE_LATEX - ON/OFF; Set to "ON" if you want the LaTeX documentation
+#  	to be built.
+#  DOXYFILE_LATEX_DIR - Directory relative to DOXYFILE_OUTPUT_DIR where
+#  	the Doxygen LaTeX output is stored. Defaults to "latex".
+#  
+#  DOXYFILE_HTML_DIR - Directory relative to DOXYFILE_OUTPUT_DIR where
+#  	the Doxygen html output is stored. Defaults to "html".
 #
 
 #
-#  Copyright (c) 2009-2010 Tobias Rautenkranz <tobias at rautenkranz.ch>
-#  Copyright (c) 2010      Andreas Schneider <mail at cynapses.org>
+#  Copyright (c) 2009, 2010, 2011 Tobias Rautenkranz <tobias at rautenkranz.ch>
 #
 #  Redistribution and use is allowed according to the terms of the New
 #  BSD license.
 #  For details see the accompanying COPYING-CMAKE-SCRIPTS file.
 #
 
-macro(usedoxygen_set_default name value)
-    if(NOT DEFINED "${name}")
-        set("${name}" "${value}")
-    endif()
+macro(usedoxygen_set_default name value type docstring)
+	if(NOT DEFINED "${name}")
+		set("${name}" "${value}" CACHE "${type}" "${docstring}")
+	endif()
 endmacro()
 
 find_package(Doxygen)
 
 if(DOXYGEN_FOUND)
-    find_file(DOXYFILE_IN
-        NAMES
-            doxy.config.in
-        PATHS
-            ${CMAKE_CURRENT_SOURCE_DIR}
-            ${CMAKE_ROOT}/Modules/
-        NO_DEFAULT_PATH)
-    include(FindPackageHandleStandardArgs)
-    find_package_handle_standard_args(DOXYFILE_IN DEFAULT_MSG "DOXYFILE_IN")
+	find_file(DOXYFILE_IN "Doxyfile.in"
+			PATHS "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_ROOT}/Modules/"
+			NO_DEFAULT_PATH
+			DOC "Path to the doxygen configuration template file")
+	set(DOXYFILE "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile")
+	include(FindPackageHandleStandardArgs)
+	find_package_handle_standard_args(DOXYFILE_IN DEFAULT_MSG "DOXYFILE_IN")
 endif()
 
 if(DOXYGEN_FOUND AND DOXYFILE_IN_FOUND)
-    add_custom_target(doxygen ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxy.config)
-
-    usedoxygen_set_default(DOXYFILE_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}")
-    usedoxygen_set_default(DOXYFILE_HTML_DIR "html")
-
-    set_property(DIRECTORY APPEND PROPERTY
-            ADDITIONAL_MAKE_CLEAN_FILES "${DOXYFILE_OUTPUT_DIR}/${DOXYFILE_HTML_DIR}")
-
-    set(DOXYFILE_LATEX FALSE)
-    set(DOXYFILE_PDFLATEX FALSE)
-    set(DOXYFILE_DOT FALSE)
-
-    #find_package(LATEX)
-    #if(LATEX_COMPILER AND MAKEINDEX_COMPILER)
-    #    set(DOXYFILE_LATEX TRUE)
-    #    usedoxygen_set_default(DOXYFILE_LATEX_DIR "latex")
-
-    #    set_property(DIRECTORY APPEND PROPERTY
-    #            ADDITIONAL_MAKE_CLEAN_FILES
-    #            "${DOXYFILE_OUTPUT_DIR}/${DOXYFILE_LATEX_DIR}")
-
-    #    if(PDFLATEX_COMPILER)
-    #        set(DOXYFILE_PDFLATEX TRUE)
-    #    endif()
-    #    if(DOXYGEN_DOT_EXECUTABLE)
-    #        set(DOXYFILE_DOT TRUE)
-    #    endif()
-
-    #    add_custom_command(TARGET doxygen
-    #        POST_BUILD
-    #        COMMAND ${CMAKE_MAKE_PROGRAM}
-    #        WORKING_DIRECTORY "${DOXYFILE_OUTPUT_DIR}/${DOXYFILE_LATEX_DIR}")
-    #endif()
-
-    configure_file(${DOXYFILE_IN} ${CMAKE_CURRENT_BINARY_DIR}/doxy.config ESCAPE_QUOTES IMMEDIATE @ONLY)
-    if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/doxy.trac.in)
-        configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doxy.trac.in ${CMAKE_CURRENT_BINARY_DIR}/doxy.trac ESCAPE_QUOTES IMMEDIATE @ONLY)
-        add_custom_target(doxygen-trac ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxy.trac)
-    endif()
-
-    get_target_property(DOC_TARGET doc TYPE)
-    if(NOT DOC_TARGET)
-        add_custom_target(doc)
-    endif()
-
-    add_dependencies(doc doxygen)
+	usedoxygen_set_default(DOXYFILE_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/doc"
+		PATH "Doxygen output directory")
+	usedoxygen_set_default(DOXYFILE_HTML_DIR "html"
+		STRING "Doxygen HTML output directory")
+	usedoxygen_set_default(DOXYFILE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}"
+		PATH "Input files source directory")
+	usedoxygen_set_default(DOXYFILE_EXTRA_SOURCE_DIRS ""
+		STRING "Additional source files/directories separated by space")
+	set(DOXYFILE_SOURCE_DIRS "\"${DOXYFILE_SOURCE_DIR}\" ${DOXYFILE_EXTRA_SOURCES}")
+
+	usedoxygen_set_default(DOXYFILE_LATEX YES BOOL "Generate LaTeX API documentation" OFF)
+	usedoxygen_set_default(DOXYFILE_LATEX_DIR "latex" STRING "LaTex output directory")
+
+	mark_as_advanced(DOXYFILE_OUTPUT_DIR DOXYFILE_HTML_DIR DOXYFILE_LATEX_DIR
+		DOXYFILE_SOURCE_DIR DOXYFILE_EXTRA_SOURCE_DIRS DOXYFILE_IN)
+
+
+	set_property(DIRECTORY 
+		APPEND PROPERTY
+		ADDITIONAL_MAKE_CLEAN_FILES
+		"${DOXYFILE_OUTPUT_DIR}/${DOXYFILE_HTML_DIR}")
+
+	add_custom_target(doxygen
+		COMMAND "${DOXYGEN_EXECUTABLE}"
+			"${DOXYFILE}" 
+		COMMENT "Writing documentation to ${DOXYFILE_OUTPUT_DIR}..."
+		WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
+
+	set(DOXYFILE_DOT "NO")
+	if(DOXYGEN_DOT_EXECUTABLE)
+		set(DOXYFILE_DOT "YES")
+	endif()
+
+	## LaTeX
+	set(DOXYFILE_PDFLATEX "NO")
+
+	set_property(DIRECTORY APPEND PROPERTY
+		ADDITIONAL_MAKE_CLEAN_FILES
+		"${DOXYFILE_OUTPUT_DIR}/${DOXYFILE_LATEX_DIR}")
+
+	if(DOXYFILE_LATEX STREQUAL "ON")
+		set(DOXYFILE_GENERATE_LATEX "YES")
+		find_package(LATEX)
+		find_program(DOXYFILE_MAKE make)
+		mark_as_advanced(DOXYFILE_MAKE)
+		if(LATEX_COMPILER AND MAKEINDEX_COMPILER AND DOXYFILE_MAKE)
+			if(PDFLATEX_COMPILER)
+				set(DOXYFILE_PDFLATEX "YES")
+			endif()
+
+			add_custom_command(TARGET doxygen
+				POST_BUILD
+				COMMAND "${DOXYFILE_MAKE}"
+				COMMENT	"Running LaTeX for Doxygen documentation in ${DOXYFILE_OUTPUT_DIR}/${DOXYFILE_LATEX_DIR}..."
+				WORKING_DIRECTORY "${DOXYFILE_OUTPUT_DIR}/${DOXYFILE_LATEX_DIR}")
+		else()
+			set(DOXYGEN_LATEX "NO")
+		endif()
+	else()
+		set(DOXYFILE_GENERATE_LATEX "NO")
+	endif()
+
+
+	configure_file("${DOXYFILE_IN}" "${DOXYFILE}" @ONLY)
+
+	add_custom_target(doc)
+	add_dependencies(doc doxygen)
 endif()
diff --git a/third_party/cmocka/cmocka-build-tree-settings.cmake.in b/third_party/cmocka/cmocka-build-tree-settings.cmake.in
new file mode 100644
index 0000000..eb1f29e
--- /dev/null
+++ b/third_party/cmocka/cmocka-build-tree-settings.cmake.in
@@ -0,0 +1 @@
+set(CMOCKA_INLUDE_DIR @PROJECT_SOURCE_DIR@/include)
diff --git a/third_party/cmocka/cmocka-config-version.cmake.in b/third_party/cmocka/cmocka-config-version.cmake.in
new file mode 100644
index 0000000..98f292c
--- /dev/null
+++ b/third_party/cmocka/cmocka-config-version.cmake.in
@@ -0,0 +1,11 @@
+set(PACKAGE_VERSION @APPLICATION_VERSION@)
+
+# Check whether the requested PACKAGE_FIND_VERSION is compatible
+if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
+    set(PACKAGE_VERSION_COMPATIBLE FALSE)
+else()
+    set(PACKAGE_VERSION_COMPATIBLE TRUE)
+    if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
+        set(PACKAGE_VERSION_EXACT TRUE)
+    endif()
+endif()
diff --git a/third_party/cmocka/cmocka-config.cmake.in b/third_party/cmocka/cmocka-config.cmake.in
new file mode 100644
index 0000000..317f0a2
--- /dev/null
+++ b/third_party/cmocka/cmocka-config.cmake.in
@@ -0,0 +1,11 @@
+get_filename_component(CMOCKA_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
+
+if (EXISTS "${CMOCKA_CMAKE_DIR}/CMakeCache.txt")
+    # In build tree
+    include(${CMOCKA_CMAKE_DIR}/cmocka-build-tree-settings.cmake)
+else()
+    set(CMOCKA_INCLUDE_DIR @INCLUDE_INSTALL_DIR@)
+endif()
+
+set(CMOCKA_LIBRARY @LIB_INSTALL_DIR@/@CMOCKA_LIBRARY_NAME@)
+set(CMOCKA_LIBRARIES @LIB_INSTALL_DIR@/@CMOCKA_LIBRARY_NAME@)
diff --git a/third_party/cmocka/config.h.cmake b/third_party/cmocka/config.h.cmake
index 4a301ad..78cce7a 100644
--- a/third_party/cmocka/config.h.cmake
+++ b/third_party/cmocka/config.h.cmake
@@ -23,6 +23,9 @@
 /* Define to 1 if you have the <inttypes.h> header file. */
 #cmakedefine HAVE_INTTYPES_H 1
 
+/* Define to 1 if you have the <io.h> header file. */
+#cmakedefine HAVE_IO_H 1
+
 /* Define to 1 if you have the <malloc.h> header file. */
 #cmakedefine HAVE_MALLOC_H 1
 
@@ -62,9 +65,16 @@
 /* Define to 1 if you have the <sys/types.h> header file. */
 #cmakedefine HAVE_SYS_TYPES_H 1
 
+/* Define to 1 if you have the <time.h> header file. */
+#cmakedefine HAVE_TIME_H 1
+
 /* Define to 1 if you have the <unistd.h> header file. */
 #cmakedefine HAVE_UNISTD_H 1
 
+/**************************** STRUCTS ****************************/
+
+#cmakedefine HAVE_STRUCT_TIMESPEC 1
+
 /*************************** FUNCTIONS ***************************/
 
 /* Define to 1 if you have the `calloc' function. */
@@ -76,6 +86,24 @@
 /* Define to 1 if you have the `fprintf' function. */
 #cmakedefine HAVE_FPRINTF 1
 
+/* Define to 1 if you have the `snprintf' function. */
+#cmakedefine HAVE_SNPRINTF 1
+
+/* Define to 1 if you have the `_snprintf' function. */
+#cmakedefine HAVE__SNPRINTF 1
+
+/* Define to 1 if you have the `_snprintf_s' function. */
+#cmakedefine HAVE__SNPRINTF_S 1
+
+/* Define to 1 if you have the `vsnprintf' function. */
+#cmakedefine HAVE_VSNPRINTF 1
+
+/* Define to 1 if you have the `_vsnprintf' function. */
+#cmakedefine HAVE__VSNPRINTF 1
+
+/* Define to 1 if you have the `_vsnprintf_s' function. */
+#cmakedefine HAVE__VSNPRINTF_S 1
+
 /* Define to 1 if you have the `free' function. */
 #cmakedefine HAVE_FREE 1
 
@@ -112,22 +140,22 @@
 /* Define to 1 if you have the `vsnprintf' function. */
 #cmakedefine HAVE_VSNPRINTF 1
 
-/**************************** OPTIONS ****************************/
+/* Define to 1 if you have the `strsignal' function. */
+#cmakedefine HAVE_STRSIGNAL 1
 
-/* define if the compiler implements namespaces */
-#cmakedefine HAVE_NAMESPACES
+/* Define to 1 if you have the `clock_gettime' function. */
+#cmakedefine HAVE_CLOCK_GETTIME 1
 
-/* Namespace for Google classes */
-#cmakedefine GOOGLE_NAMESPACE
+/**************************** OPTIONS ****************************/
 
-/* the namespace where STL code like vector<> is defined */
-#cmakedefine STL_NAMESPACE
+/* Check if we have TLS support with GCC */
+#cmakedefine HAVE_GCC_THREAD_LOCAL_STORAGE 1
 
-/* Stops putting the code inside the Google namespace */
-#cmakedefine _END_GOOGLE_NAMESPACE_
+/* Check if we have TLS support with MSVC */
+#cmakedefine HAVE_MSVC_THREAD_LOCAL_STORAGE 1
 
-/* Puts following code inside the Google namespace */
-#cmakedefine _START_GOOGLE_NAMESPACE_
+/* Check if we have CLOCK_REALTIME for clock_gettime() */
+#cmakedefine HAVE_CLOCK_GETTIME_REALTIME 1
 
 /*************************** ENDIAN *****************************/
 
diff --git a/third_party/cmocka/coverity/coverity_assert_model.c b/third_party/cmocka/coverity/coverity_assert_model.c
index e14e581..9bbb9f7 100644
--- a/third_party/cmocka/coverity/coverity_assert_model.c
+++ b/third_party/cmocka/coverity/coverity_assert_model.c
@@ -21,6 +21,16 @@ void _assert_int_not_equal(
       __coverity_panic__();
 }
 
+void _assert_return_code(const LargestIntegralType result,
+                         size_t rlen,
+                         const LargestIntegralType error,
+                         const char * const expression,
+                         const char * const file,
+                         const int line)
+{
+      __coverity_panic__();
+}
+
 void _assert_string_equal(const char * const a, const char * const b,
                           const char * const file, const int line)
 {
diff --git a/third_party/cmocka/doc/Doxyfile.in b/third_party/cmocka/doc/Doxyfile.in
new file mode 100644
index 0000000..b0f9f63
--- /dev/null
+++ b/third_party/cmocka/doc/Doxyfile.in
@@ -0,0 +1,2358 @@
+# Doxyfile 1.8.8
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project.
+#
+# All text after a double hash (##) is considered a comment and is placed in
+# front of the TAG it is preceding.
+#
+# All text after a single hash (#) is considered a comment and will be ignored.
+# The format is:
+# TAG = value [value, ...]
+# For lists, items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (\" \").
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all text
+# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv
+# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv
+# for the list of possible encodings.
+# The default value is: UTF-8.
+
+DOXYFILE_ENCODING      = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by
+# double-quotes, unless you are using Doxywizard) that should identify the
+# project for which the documentation is generated. This name is used in the
+# title of most generated pages and in a few other places.
+# The default value is: My Project.
+
+PROJECT_NAME           = @APPLICATION_NAME@
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
+# could be handy for archiving the generated documentation or if some version
+# control system is used.
+
+PROJECT_NUMBER         = @APPLICATION_VERSION@
+
+# Using the PROJECT_BRIEF tag one can provide an optional one line description
+# for a project that appears at the top of each page and should give viewer a
+# quick idea about the purpose of the project. Keep the description short.
+
+PROJECT_BRIEF          =
+
+# With the PROJECT_LOGO tag one can specify an logo or icon that is included in
+# the documentation. The maximum height of the logo should not exceed 55 pixels
+# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo
+# to the output directory.
+
+PROJECT_LOGO           =
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
+# into which the generated documentation will be written. If a relative path is
+# entered, it will be relative to the location where doxygen was started. If
+# left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       = @CMAKE_CURRENT_BINARY_DIR@
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub-
+# directories (in 2 levels) under the output directory of each output format and
+# will distribute the generated files over these directories. Enabling this
+# option can be useful when feeding doxygen a huge amount of source files, where
+# putting all generated files in the same directory would otherwise causes
+# performance problems for the file system.
+# The default value is: NO.
+
+CREATE_SUBDIRS         = NO
+
+# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII
+# characters to appear in the names of generated files. If set to NO, non-ASCII
+# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode
+# U+3044.
+# The default value is: NO.
+
+ALLOW_UNICODE_NAMES    = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese,
+# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States),
+# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian,
+# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages),
+# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian,
+# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian,
+# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish,
+# Ukrainian and Vietnamese.
+# The default value is: English.
+
+OUTPUT_LANGUAGE        = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES doxygen will include brief member
+# descriptions after the members that are listed in the file and class
+# documentation (similar to Javadoc). Set to NO to disable this.
+# The default value is: YES.
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES doxygen will prepend the brief
+# description of a member or function before the detailed description
+#
+# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+# The default value is: YES.
+
+REPEAT_BRIEF           = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator that is
+# used to form the text in various listings. Each string in this list, if found
+# as the leading text of the brief description, will be stripped from the text
+# and the result, after processing the whole list, is used as the annotated
+# text. Otherwise, the brief description is used as-is. If left blank, the
+# following values are used ($name is automatically replaced with the name of
+# the entity):The $name class, The $name widget, The $name file, is, provides,
+# specifies, contains, represents, a, an and the.
+
+ABBREVIATE_BRIEF       = "The $name class" \
+                         "The $name widget" \
+                         "The $name file" \
+                         is \
+                         provides \
+                         specifies \
+                         contains \
+                         represents \
+                         a \
+                         an \
+                         the
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# doxygen will generate a detailed section even if there is only a brief
+# description.
+# The default value is: NO.
+
+ALWAYS_DETAILED_SEC    = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+# The default value is: NO.
+
+INLINE_INHERITED_MEMB  = NO
+
+# If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path
+# before files name in the file list and in the header files. If set to NO the
+# shortest path that makes the file name unique will be used
+# The default value is: YES.
+
+FULL_PATH_NAMES        = YES
+
+# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
+# Stripping is only done if one of the specified strings matches the left-hand
+# part of the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the path to
+# strip.
+#
+# Note that you can specify absolute paths here, but also relative paths, which
+# will be relative from the directory where doxygen is started.
+# This tag requires that the tag FULL_PATH_NAMES is set to YES.
+
+STRIP_FROM_PATH        = @CMAKE_SOURCE_DIR@
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
+# path mentioned in the documentation of a class, which tells the reader which
+# header file to include in order to use a class. If left blank only the name of
+# the header file containing the class definition is used. Otherwise one should
+# specify the list of include paths that are normally passed to the compiler
+# using the -I flag.
+
+STRIP_FROM_INC_PATH    = @CMAKE_SOURCE_DIR@
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
+# less readable) file names. This can be useful is your file systems doesn't
+# support long names like on DOS, Mac, or CD-ROM.
+# The default value is: NO.
+
+SHORT_NAMES            = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the
+# first line (until the first dot) of a Javadoc-style comment as the brief
+# description. If set to NO, the Javadoc-style will behave just like regular Qt-
+# style comments (thus requiring an explicit @brief command for a brief
+# description.)
+# The default value is: NO.
+
+JAVADOC_AUTOBRIEF      = YES
+
+# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
+# line (until the first dot) of a Qt-style comment as the brief description. If
+# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
+# requiring an explicit \brief command for a brief description.)
+# The default value is: NO.
+
+QT_AUTOBRIEF           = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a
+# multi-line C++ special comment block (i.e. a block of //! or /// comments) as
+# a brief description. This used to be the default behavior. The new default is
+# to treat a multi-line C++ comment block as a detailed description. Set this
+# tag to YES if you prefer the old behavior instead.
+#
+# Note that setting this tag to YES also means that rational rose comments are
+# not recognized any more.
+# The default value is: NO.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
+# documentation from any documented member that it re-implements.
+# The default value is: YES.
+
+INHERIT_DOCS           = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce a
+# new page for each member. If set to NO, the documentation of a member will be
+# part of the file/class/namespace that contains it.
+# The default value is: NO.
+
+SEPARATE_MEMBER_PAGES  = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen
+# uses this value to replace tabs by spaces in code fragments.
+# Minimum value: 1, maximum value: 16, default value: 4.
+
+TAB_SIZE               = 2
+
+# This tag can be used to specify a number of aliases that act as commands in
+# the documentation. An alias has the form:
+# name=value
+# For example adding
+# "sideeffect=@par Side Effects:\n"
+# will allow you to put the command \sideeffect (or @sideeffect) in the
+# documentation, which will result in a user-defined paragraph with heading
+# "Side Effects:". You can put \n's in the value part of an alias to insert
+# newlines.
+
+ALIASES                =
+
+# This tag can be used to specify a number of word-keyword mappings (TCL only).
+# A mapping has the form "name=value". For example adding "class=itcl::class"
+# will allow you to use the command class in the itcl::class meaning.
+
+TCL_SUBST              =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
+# only. Doxygen will then generate output that is more tailored for C. For
+# instance, some of the names that are used will be different. The list of all
+# members will be omitted, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_FOR_C  = YES
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
+# Python sources only. Doxygen will then generate output that is more tailored
+# for that language. For instance, namespaces will be presented as packages,
+# qualified scopes will look different, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_JAVA   = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources. Doxygen will then generate output that is tailored for Fortran.
+# The default value is: NO.
+
+OPTIMIZE_FOR_FORTRAN   = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for VHDL.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_VHDL   = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it
+# parses. With this tag you can assign which parser to use for a given
+# extension. Doxygen has a built-in mapping, but you can override or extend it
+# using this tag. The format is ext=language, where ext is a file extension, and
+# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
+# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran:
+# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran:
+# Fortran. In the later case the parser tries to guess whether the code is fixed
+# or free formatted code, this is the default for Fortran type files), VHDL. For
+# instance to make doxygen treat .inc files as Fortran files (default is PHP),
+# and .f files as C (default is Fortran), use: inc=Fortran f=C.
+#
+# Note For files without extension you can use no_extension as a placeholder.
+#
+# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
+# the files are not read by doxygen.
+
+EXTENSION_MAPPING      =
+
+# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
+# according to the Markdown format, which allows for more readable
+# documentation. See http://daringfireball.net/projects/markdown/ for details.
+# The output of markdown processing is further processed by doxygen, so you can
+# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in
+# case of backward compatibilities issues.
+# The default value is: YES.
+
+MARKDOWN_SUPPORT       = YES
+
+# When enabled doxygen tries to link words that correspond to documented
+# classes, or namespaces to their corresponding documentation. Such a link can
+# be prevented in individual cases by by putting a % sign in front of the word
+# or globally by setting AUTOLINK_SUPPORT to NO.
+# The default value is: YES.
+
+AUTOLINK_SUPPORT       = YES
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should set this
+# tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string);
+# versus func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+# The default value is: NO.
+
+BUILTIN_STL_SUPPORT    = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+# The default value is: NO.
+
+CPP_CLI_SUPPORT        = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip (see:
+# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen
+# will parse them like normal C++ but will assume all classes use public instead
+# of private inheritance when no explicit protection keyword is present.
+# The default value is: NO.
+
+SIP_SUPPORT            = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate
+# getter and setter methods for a property. Setting this option to YES will make
+# doxygen to replace the get and set methods by a property in the documentation.
+# This will only work if the methods are indeed getting or setting a simple
+# type. If this is not the case, or you want to show the methods anyway, you
+# should set this option to NO.
+# The default value is: YES.
+
+IDL_PROPERTY_SUPPORT   = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+# The default value is: NO.
+
+DISTRIBUTE_GROUP_DOC   = NO
+
+# Set the SUBGROUPING tag to YES to allow class member groups of the same type
+# (for instance a group of public functions) to be put as a subgroup of that
+# type (e.g. under the Public Functions section). Set it to NO to prevent
+# subgrouping. Alternatively, this can be done per class using the
+# \nosubgrouping command.
+# The default value is: YES.
+
+SUBGROUPING            = YES
+
+# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions
+# are shown inside the group in which they are included (e.g. using \ingroup)
+# instead of on a separate page (for HTML and Man pages) or section (for LaTeX
+# and RTF).
+#
+# Note that this feature does not work in combination with
+# SEPARATE_MEMBER_PAGES.
+# The default value is: NO.
+
+INLINE_GROUPED_CLASSES = NO
+
+# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
+# with only public data fields or simple typedef fields will be shown inline in
+# the documentation of the scope in which they are defined (i.e. file,
+# namespace, or group documentation), provided this scope is documented. If set
+# to NO, structs, classes, and unions are shown on a separate page (for HTML and
+# Man pages) or section (for LaTeX and RTF).
+# The default value is: NO.
+
+INLINE_SIMPLE_STRUCTS  = NO
+
+# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or
+# enum is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically be
+# useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+# The default value is: NO.
+
+TYPEDEF_HIDES_STRUCT   = YES
+
+# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
+# cache is used to resolve symbols given their name and scope. Since this can be
+# an expensive process and often the same symbol appears multiple times in the
+# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small
+# doxygen will become slower. If the cache is too large, memory is wasted. The
+# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range
+# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536
+# symbols. At the end of a run doxygen will report the cache usage and suggest
+# the optimal cache size from a speed point of view.
+# Minimum value: 0, maximum value: 9, default value: 0.
+
+LOOKUP_CACHE_SIZE      = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available. Private
+# class members and static file members will be hidden unless the
+# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES.
+# Note: This will also disable the warnings about undocumented members that are
+# normally produced when WARNINGS is set to YES.
+# The default value is: NO.
+
+EXTRACT_ALL            = NO
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will
+# be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PRIVATE        = NO
+
+# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal
+# scope will be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PACKAGE        = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file will be
+# included in the documentation.
+# The default value is: NO.
+
+EXTRACT_STATIC         = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined
+# locally in source files will be included in the documentation. If set to NO
+# only classes defined in header files are included. Does not have any effect
+# for Java sources.
+# The default value is: YES.
+
+EXTRACT_LOCAL_CLASSES  = NO
+
+# This flag is only useful for Objective-C code. When set to YES local methods,
+# which are defined in the implementation section but not in the interface are
+# included in the documentation. If set to NO only methods in the interface are
+# included.
+# The default value is: NO.
+
+EXTRACT_LOCAL_METHODS  = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base name of
+# the file that contains the anonymous namespace. By default anonymous namespace
+# are hidden.
+# The default value is: NO.
+
+EXTRACT_ANON_NSPACES   = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
+# undocumented members inside documented classes or files. If set to NO these
+# members will be included in the various overviews, but no documentation
+# section is generated. This option has no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_MEMBERS     = YES
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy. If set
+# to NO these classes will be included in the various overviews. This option has
+# no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_CLASSES     = YES
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
+# (class|struct|union) declarations. If set to NO these declarations will be
+# included in the documentation.
+# The default value is: NO.
+
+HIDE_FRIEND_COMPOUNDS  = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any
+# documentation blocks found inside the body of a function. If set to NO these
+# blocks will be appended to the function's detailed documentation block.
+# The default value is: NO.
+
+HIDE_IN_BODY_DOCS      = NO
+
+# The INTERNAL_DOCS tag determines if documentation that is typed after a
+# \internal command is included. If the tag is set to NO then the documentation
+# will be excluded. Set it to YES to include the internal documentation.
+# The default value is: NO.
+
+INTERNAL_DOCS          = @CMAKE_INTERNAL_DOC@
+
+# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
+# names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+# The default value is: system dependent.
+
+CASE_SENSE_NAMES       = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
+# their full class and namespace scopes in the documentation. If set to YES the
+# scope will be hidden.
+# The default value is: NO.
+
+HIDE_SCOPE_NAMES       = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
+# the files that are included by a file in the documentation of that file.
+# The default value is: YES.
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each
+# grouped member an include statement to the documentation, telling the reader
+# which file to include in order to use the member.
+# The default value is: NO.
+
+SHOW_GROUPED_MEMB_INC  = NO
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include
+# files with double quotes in the documentation rather than with sharp brackets.
+# The default value is: NO.
+
+FORCE_LOCAL_INCLUDES   = NO
+
+# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the
+# documentation for inline members.
+# The default value is: YES.
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the
+# (detailed) documentation of file and class members alphabetically by member
+# name. If set to NO the members will appear in declaration order.
+# The default value is: YES.
+
+SORT_MEMBER_DOCS       = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
+# descriptions of file, namespace and class members alphabetically by member
+# name. If set to NO the members will appear in declaration order. Note that
+# this will also influence the order of the classes in the class list.
+# The default value is: NO.
+
+SORT_BRIEF_DOCS        = YES
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
+# (brief and detailed) documentation of class members so that constructors and
+# destructors are listed first. If set to NO the constructors will appear in the
+# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS.
+# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief
+# member documentation.
+# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting
+# detailed member documentation.
+# The default value is: NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
+# of group names into alphabetical order. If set to NO the group names will
+# appear in their defined order.
+# The default value is: NO.
+
+SORT_GROUP_NAMES       = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by
+# fully-qualified names, including namespaces. If set to NO, the class list will
+# be sorted only by class name, not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the alphabetical
+# list.
+# The default value is: NO.
+
+SORT_BY_SCOPE_NAME     = NO
+
+# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper
+# type resolution of all parameters of a function it will reject a match between
+# the prototype and the implementation of a member function even if there is
+# only one candidate or it is obvious which candidate to choose by doing a
+# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still
+# accept a match between prototype and implementation in such cases.
+# The default value is: NO.
+
+STRICT_PROTO_MATCHING  = NO
+
+# The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the
+# todo list. This list is created by putting \todo commands in the
+# documentation.
+# The default value is: YES.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the
+# test list. This list is created by putting \test commands in the
+# documentation.
+# The default value is: YES.
+
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable ( YES) or disable ( NO) the bug
+# list. This list is created by putting \bug commands in the documentation.
+# The default value is: YES.
+
+GENERATE_BUGLIST       = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable ( YES) or disable ( NO)
+# the deprecated list. This list is created by putting \deprecated commands in
+# the documentation.
+# The default value is: YES.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional documentation
+# sections, marked by \if <section_label> ... \endif and \cond <section_label>
+# ... \endcond blocks.
+
+ENABLED_SECTIONS       =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
+# initial value of a variable or macro / define can have for it to appear in the
+# documentation. If the initializer consists of more lines than specified here
+# it will be hidden. Use a value of 0 to hide initializers completely. The
+# appearance of the value of individual variables and macros / defines can be
+# controlled using \showinitializer or \hideinitializer command in the
+# documentation regardless of this setting.
+# Minimum value: 0, maximum value: 10000, default value: 30.
+
+MAX_INITIALIZER_LINES  = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at
+# the bottom of the documentation of classes and structs. If set to YES the list
+# will mention the files that were used to generate the documentation.
+# The default value is: YES.
+
+SHOW_USED_FILES        = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This
+# will remove the Files entry from the Quick Index and from the Folder Tree View
+# (if specified).
+# The default value is: YES.
+
+SHOW_FILES             = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces
+# page. This will remove the Namespaces entry from the Quick Index and from the
+# Folder Tree View (if specified).
+# The default value is: YES.
+
+SHOW_NAMESPACES        = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command command input-file, where command is the value of the
+# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided
+# by doxygen. Whatever the program writes to standard output is used as the file
+# version. For an example see the documentation.
+
+FILE_VERSION_FILTER    =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
+# by doxygen. The layout file controls the global structure of the generated
+# output files in an output format independent way. To create the layout file
+# that represents doxygen's defaults, run doxygen with the -l option. You can
+# optionally specify a file name after the option, if omitted DoxygenLayout.xml
+# will be used as the name of the layout file.
+#
+# Note that if you run doxygen from a directory containing a file called
+# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
+# tag is left empty.
+
+LAYOUT_FILE            =
+
+# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
+# the reference definitions. This must be a list of .bib files. The .bib
+# extension is automatically appended if omitted. This requires the bibtex tool
+# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info.
+# For LaTeX the style of the bibliography can be controlled using
+# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
+# search path. See also \cite for info how to create references.
+
+CITE_BIB_FILES         =
+
+#---------------------------------------------------------------------------
+# Configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated to
+# standard output by doxygen. If QUIET is set to YES this implies that the
+# messages are off.
+# The default value is: NO.
+
+QUIET                  = YES
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES
+# this implies that the warnings are on.
+#
+# Tip: Turn warnings on while writing the documentation.
+# The default value is: YES.
+
+WARNINGS               = YES
+
+# If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate
+# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
+# will automatically be disabled.
+# The default value is: YES.
+
+WARN_IF_UNDOCUMENTED   = YES
+
+# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some parameters
+# in a documented function, or documenting parameters that don't exist or using
+# markup commands wrongly.
+# The default value is: YES.
+
+WARN_IF_DOC_ERROR      = YES
+
+# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
+# are documented, but have no documentation for their parameters or return
+# value. If set to NO doxygen will only warn about wrong or incomplete parameter
+# documentation, but not about the absence of documentation.
+# The default value is: NO.
+
+WARN_NO_PARAMDOC       = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that doxygen
+# can produce. The string should contain the $file, $line, and $text tags, which
+# will be replaced by the file and line number from which the warning originated
+# and the warning text. Optionally the format may contain $version, which will
+# be replaced by the version of the file (if it could be obtained via
+# FILE_VERSION_FILTER)
+# The default value is: $file:$line: $text.
+
+WARN_FORMAT            = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning and error
+# messages should be written. If left blank the output is written to standard
+# error (stderr).
+
+WARN_LOGFILE           =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag is used to specify the files and/or directories that contain
+# documented source files. You may enter file names like myfile.cpp or
+# directories like /usr/src/myproject. Separate the files or directories with
+# spaces.
+# Note: If this tag is empty the current directory is searched.
+
+INPUT                  = @CMAKE_SOURCE_DIR@/include \
+                         @CMAKE_SOURCE_DIR@/src \
+                         @CMAKE_SOURCE_DIR@/doc
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
+# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
+# documentation (see: http://www.gnu.org/software/libiconv) for the list of
+# possible encodings.
+# The default value is: UTF-8.
+
+INPUT_ENCODING         = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
+# *.h) to filter out the source-files in the directories. If left blank the
+# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii,
+# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp,
+# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown,
+# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf,
+# *.qsf, *.as and *.js.
+
+FILE_PATTERNS          = *.cpp \
+                         *.cc \
+                         *.c \
+                         *.h \
+                         *.hh \
+                         *.hpp \
+                         *.dox
+
+# The RECURSIVE tag can be used to specify whether or not subdirectories should
+# be searched for input files as well.
+# The default value is: NO.
+
+RECURSIVE              = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should be
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+#
+# Note that relative paths are relative to the directory from which doxygen is
+# run.
+
+EXCLUDE                =
+
+# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
+# directories that are symbolic links (a Unix file system feature) are excluded
+# from the input.
+# The default value is: NO.
+
+EXCLUDE_SYMLINKS       = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories.
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories for example use the pattern */test/*
+
+EXCLUDE_PATTERNS       = */.git/* \
+                         */.svn/* \
+                         */cmake/*
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories use the pattern */test/*
+
+EXCLUDE_SYMBOLS        =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or directories
+# that contain example code fragments that are included (see the \include
+# command).
+
+EXAMPLE_PATH           = @CMAKE_SOURCE_DIR@/example
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
+# *.h) to filter out the source-files in the directories. If left blank all
+# files are included.
+
+EXAMPLE_PATTERNS       = *.c \
+                         *.h \
+                         INSTALL \
+                         DEPENDENCIES \
+                         CHANGELOG \
+                         LICENSE \
+                         LGPL
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude commands
+# irrespective of the value of the RECURSIVE tag.
+# The default value is: NO.
+
+EXAMPLE_RECURSIVE      = YES
+
+# The IMAGE_PATH tag can be used to specify one or more files or directories
+# that contain images that are to be included in the documentation (see the
+# \image command).
+
+IMAGE_PATH             =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command:
+#
+# <filter> <input-file>
+#
+# where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the
+# name of an input file. Doxygen will then use the output that the filter
+# program writes to standard output. If FILTER_PATTERNS is specified, this tag
+# will be ignored.
+#
+# Note that the filter must not add or remove lines; it is applied before the
+# code is scanned, but not when the output code is generated. If lines are added
+# or removed, the anchors will not be placed correctly.
+
+INPUT_FILTER           =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis. Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match. The filters are a list of the form: pattern=filter
+# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
+# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
+# patterns match the file name, INPUT_FILTER is applied.
+
+FILTER_PATTERNS        =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER ) will also be used to filter the input files that are used for
+# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES).
+# The default value is: NO.
+
+FILTER_SOURCE_FILES    = NO
+
+# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
+# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and
+# it is also possible to disable source filtering for a specific pattern using
+# *.ext= (so without naming a filter).
+# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
+
+FILTER_SOURCE_PATTERNS =
+
+# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
+# is part of the input, its contents will be placed on the main page
+# (index.html). This can be useful if you have a project on for instance GitHub
+# and want to reuse the introduction page also for the doxygen output.
+
+USE_MDFILE_AS_MAINPAGE =
+
+#---------------------------------------------------------------------------
+# Configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will be
+# generated. Documented entities will be cross-referenced with these sources.
+#
+# Note: To get rid of all source code in the generated output, make sure that
+# also VERBATIM_HEADERS is set to NO.
+# The default value is: NO.
+
+SOURCE_BROWSER         = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body of functions,
+# classes and enums directly into the documentation.
+# The default value is: NO.
+
+INLINE_SOURCES         = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any
+# special comment blocks from generated source code fragments. Normal C, C++ and
+# Fortran comments will always remain visible.
+# The default value is: YES.
+
+STRIP_CODE_COMMENTS    = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES then for each documented
+# function all documented functions referencing it will be listed.
+# The default value is: NO.
+
+REFERENCED_BY_RELATION = YES
+
+# If the REFERENCES_RELATION tag is set to YES then for each documented function
+# all documented entities called/used by that function will be listed.
+# The default value is: NO.
+
+REFERENCES_RELATION    = YES
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set
+# to YES, then the hyperlinks from functions in REFERENCES_RELATION and
+# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will
+# link to the documentation.
+# The default value is: YES.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the
+# source code will show a tooltip with additional information such as prototype,
+# brief description and links to the definition and documentation. Since this
+# will make the HTML file larger and loading of large files a bit slower, you
+# can opt to disable this feature.
+# The default value is: YES.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+SOURCE_TOOLTIPS        = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code will
+# point to the HTML generated by the htags(1) tool instead of doxygen built-in
+# source browser. The htags tool is part of GNU's global source tagging system
+# (see http://www.gnu.org/software/global/global.html). You will need version
+# 4.8.6 or higher.
+#
+# To use it do the following:
+# - Install the latest version of global
+# - Enable SOURCE_BROWSER and USE_HTAGS in the config file
+# - Make sure the INPUT points to the root of the source tree
+# - Run doxygen as normal
+#
+# Doxygen will invoke htags (and that will in turn invoke gtags), so these
+# tools must be available from the command line (i.e. in the search path).
+#
+# The result: instead of the source browser generated by doxygen, the links to
+# source code will now point to the output of htags.
+# The default value is: NO.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+USE_HTAGS              = NO
+
+# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a
+# verbatim copy of the header file for each class for which an include is
+# specified. Set to NO to disable this.
+# See also: Section \class.
+# The default value is: YES.
+
+VERBATIM_HEADERS       = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all
+# compounds will be generated. Enable this if the project contains a lot of
+# classes, structs, unions or interfaces.
+# The default value is: YES.
+
+ALPHABETICAL_INDEX     = YES
+
+# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
+# which the alphabetical index list will be split.
+# Minimum value: 1, maximum value: 20, default value: 5.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+COLS_IN_ALPHA_INDEX    = 2
+
+# In case all classes in a project start with a common prefix, all classes will
+# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
+# can be used to specify a prefix (or a list of prefixes) that should be ignored
+# while generating the index headers.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+IGNORE_PREFIX          =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES doxygen will generate HTML output
+# The default value is: YES.
+
+GENERATE_HTML          = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_OUTPUT            = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
+# generated HTML page (for example: .htm, .php, .asp).
+# The default value is: .html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FILE_EXTENSION    = .html
+
+# The HTML_HEADER tag can be used to specify a user-defined HTML header file for
+# each generated HTML page. If the tag is left blank doxygen will generate a
+# standard header.
+#
+# To get valid HTML the header file that includes any scripts and style sheets
+# that doxygen needs, which is dependent on the configuration options used (e.g.
+# the setting GENERATE_TREEVIEW). It is highly recommended to start with a
+# default header using
+# doxygen -w html new_header.html new_footer.html new_stylesheet.css
+# YourConfigFile
+# and then modify the file new_header.html. See also section "Doxygen usage"
+# for information on how to generate the default header that doxygen normally
+# uses.
+# Note: The header is subject to change so you typically have to regenerate the
+# default header when upgrading to a newer version of doxygen. For a description
+# of the possible markers and block names see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_HEADER            =
+
+# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
+# generated HTML page. If the tag is left blank doxygen will generate a standard
+# footer. See HTML_HEADER for more information on how to generate a default
+# footer and what special commands can be used inside the footer. See also
+# section "Doxygen usage" for information on how to generate the default footer
+# that doxygen normally uses.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FOOTER            =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
+# sheet that is used by each HTML page. It can be used to fine-tune the look of
+# the HTML output. If left blank doxygen will generate a default style sheet.
+# See also section "Doxygen usage" for information on how to generate the style
+# sheet that doxygen normally uses.
+# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as
+# it is more robust and this tag (HTML_STYLESHEET) will in the future become
+# obsolete.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_STYLESHEET        =
+
+# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined
+# cascading style sheets that are included after the standard style sheets
+# created by doxygen. Using this option one can overrule certain style aspects.
+# This is preferred over using HTML_STYLESHEET since it does not replace the
+# standard style sheet and is therefor more robust against future updates.
+# Doxygen will copy the style sheet files to the output directory.
+# Note: The order of the extra stylesheet files is of importance (e.g. the last
+# stylesheet in the list overrules the setting of the previous ones in the
+# list). For an example see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_STYLESHEET  =
+
+# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the HTML output directory. Note
+# that these files will be copied to the base HTML output directory. Use the
+# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
+# files. In the HTML_STYLESHEET file, use the file name only. Also note that the
+# files will be copied as-is; there are no commands or markers available.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_FILES       =
+
+# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
+# will adjust the colors in the stylesheet and background images according to
+# this color. Hue is specified as an angle on a colorwheel, see
+# http://en.wikipedia.org/wiki/Hue for more information. For instance the value
+# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
+# purple, and 360 is red again.
+# Minimum value: 0, maximum value: 359, default value: 220.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_HUE    = 220
+
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
+# in the HTML output. For a value of 0 the output will use grayscales only. A
+# value of 255 will produce the most vivid colors.
+# Minimum value: 0, maximum value: 255, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_SAT    = 100
+
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the
+# luminance component of the colors in the HTML output. Values below 100
+# gradually make the output lighter, whereas values above 100 make the output
+# darker. The value divided by 100 is the actual gamma applied, so 80 represents
+# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not
+# change the gamma.
+# Minimum value: 40, maximum value: 240, default value: 80.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_GAMMA  = 80
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting this
+# to NO can help when comparing the output of multiple runs.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_TIMESTAMP         = NO
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_DYNAMIC_SECTIONS  = NO
+
+# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
+# shown in the various tree structured indices initially; the user can expand
+# and collapse entries dynamically later on. Doxygen will expand the tree to
+# such a level that at most the specified number of entries are visible (unless
+# a fully collapsed tree already exceeds this amount). So setting the number of
+# entries 1 will produce a full collapsed tree by default. 0 is a special value
+# representing an infinite number of entries and will result in a full expanded
+# tree by default.
+# Minimum value: 0, maximum value: 9999, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_INDEX_NUM_ENTRIES = 100
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files will be
+# generated that can be used as input for Apple's Xcode 3 integrated development
+# environment (see: http://developer.apple.com/tools/xcode/), introduced with
+# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a
+# Makefile in the HTML output directory. Running make will produce the docset in
+# that directory and running make install will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
+# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
+# for more information.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_DOCSET        = NO
+
+# This tag determines the name of the docset feed. A documentation feed provides
+# an umbrella under which multiple documentation sets from a single provider
+# (such as a company or product suite) can be grouped.
+# The default value is: Doxygen generated docs.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_FEEDNAME        = "Doxygen generated docs"
+
+# This tag specifies a string that should uniquely identify the documentation
+# set bundle. This should be a reverse domain-name style string, e.g.
+# com.mycompany.MyDocSet. Doxygen will append .docset to the name.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_BUNDLE_ID       = org.doxygen.Project
+
+# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify
+# the documentation publisher. This should be a reverse domain-name style
+# string, e.g. com.mycompany.MyDocSet.documentation.
+# The default value is: org.doxygen.Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_ID    = org.doxygen.Publisher
+
+# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher.
+# The default value is: Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_NAME  = Publisher
+
+# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
+# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
+# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
+# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on
+# Windows.
+#
+# The HTML Help Workshop contains a compiler that can convert all HTML output
+# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
+# files are now used as the Windows 98 help format, and will replace the old
+# Windows help format (.hlp) on all Windows platforms in the future. Compressed
+# HTML files also contain an index, a table of contents, and you can search for
+# words in the documentation. The HTML workshop also contains a viewer for
+# compressed HTML files.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_HTMLHELP      = NO
+
+# The CHM_FILE tag can be used to specify the file name of the resulting .chm
+# file. You can add a path in front of the file if the result should not be
+# written to the html output directory.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_FILE               =
+
+# The HHC_LOCATION tag can be used to specify the location (absolute path
+# including file name) of the HTML help compiler ( hhc.exe). If non-empty
+# doxygen will try to run the HTML help compiler on the generated index.hhp.
+# The file has to be specified with full path.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+HHC_LOCATION           =
+
+# The GENERATE_CHI flag controls if a separate .chi index file is generated (
+# YES) or that it should be included in the master .chm file ( NO).
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+GENERATE_CHI           = NO
+
+# The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc)
+# and project file content.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_INDEX_ENCODING     =
+
+# The BINARY_TOC flag controls whether a binary table of contents is generated (
+# YES) or a normal table of contents ( NO) in the .chm file. Furthermore it
+# enables the Previous and Next buttons.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members to
+# the table of contents of the HTML help documentation and to the tree view.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+TOC_EXPAND             = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that
+# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help
+# (.qch) of the generated HTML documentation.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_QHP           = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify
+# the file name of the resulting .qch file. The path specified is relative to
+# the HTML output folder.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QCH_FILE               =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
+# Project output. For more information please see Qt Help Project / Namespace
+# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace).
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_NAMESPACE          =
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
+# Help Project output. For more information please see Qt Help Project / Virtual
+# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual-
+# folders).
+# The default value is: doc.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_VIRTUAL_FOLDER     = doc
+
+# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
+# filter to add. For more information please see Qt Help Project / Custom
+# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
+# filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_NAME   =
+
+# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
+# custom filter to add. For more information please see Qt Help Project / Custom
+# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
+# filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_ATTRS  =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
+# project's filter section matches. Qt Help Project / Filter Attributes (see:
+# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_SECT_FILTER_ATTRS  =
+
+# The QHG_LOCATION tag can be used to specify the location of Qt's
+# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
+# generated .qhp file.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHG_LOCATION           =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
+# generated, together with the HTML files, they form an Eclipse help plugin. To
+# install this plugin and make it available under the help contents menu in
+# Eclipse, the contents of the directory containing the HTML and XML files needs
+# to be copied into the plugins directory of eclipse. The name of the directory
+# within the plugins directory should be the same as the ECLIPSE_DOC_ID value.
+# After copying Eclipse needs to be restarted before the help appears.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_ECLIPSEHELP   = NO
+
+# A unique identifier for the Eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have this
+# name. Each documentation set should have its own identifier.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES.
+
+ECLIPSE_DOC_ID         = org.doxygen.Project
+
+# If you want full control over the layout of the generated HTML pages it might
+# be necessary to disable the index and replace it with your own. The
+# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top
+# of each HTML page. A value of NO enables the index and the value YES disables
+# it. Since the tabs in the index contain the same information as the navigation
+# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+DISABLE_INDEX          = NO
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information. If the tag
+# value is set to YES, a side panel will be generated containing a tree-like
+# index structure (just like the one that is generated for HTML Help). For this
+# to work a browser that supports JavaScript, DHTML, CSS and frames is required
+# (i.e. any modern browser). Windows users are probably better off using the
+# HTML help feature. Via custom stylesheets (see HTML_EXTRA_STYLESHEET) one can
+# further fine-tune the look of the index. As an example, the default style
+# sheet generated by doxygen has an example that shows how to put an image at
+# the root of the tree instead of the PROJECT_NAME. Since the tree basically has
+# the same information as the tab index, you could consider setting
+# DISABLE_INDEX to YES when enabling this option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_TREEVIEW      = NO
+
+# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
+# doxygen will group on one line in the generated HTML documentation.
+#
+# Note that a value of 0 will completely suppress the enum values from appearing
+# in the overview section.
+# Minimum value: 0, maximum value: 20, default value: 4.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+ENUM_VALUES_PER_LINE   = 4
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used
+# to set the initial width (in pixels) of the frame in which the tree is shown.
+# Minimum value: 0, maximum value: 1500, default value: 250.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+TREEVIEW_WIDTH         = 250
+
+# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to
+# external symbols imported via tag files in a separate window.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+EXT_LINKS_IN_WINDOW    = NO
+
+# Use this tag to change the font size of LaTeX formulas included as images in
+# the HTML documentation. When you change the font size after a successful
+# doxygen run you need to manually remove any form_*.png images from the HTML
+# output directory to force them to be regenerated.
+# Minimum value: 8, maximum value: 50, default value: 10.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_FONTSIZE       = 10
+
+# Use the FORMULA_TRANPARENT tag to determine whether or not the images
+# generated for formulas are transparent PNGs. Transparent PNGs are not
+# supported properly for IE 6.0, but are supported on all modern browsers.
+#
+# Note that when changing this option you need to delete any form_*.png files in
+# the HTML output directory before the changes have effect.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_TRANSPARENT    = YES
+
+# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
+# http://www.mathjax.org) which uses client side Javascript for the rendering
+# instead of using prerendered bitmaps. Use this if you do not have LaTeX
+# installed or if you want to formulas look prettier in the HTML output. When
+# enabled you may also need to install MathJax separately and configure the path
+# to it using the MATHJAX_RELPATH option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+USE_MATHJAX            = NO
+
+# When MathJax is enabled you can set the default output format to be used for
+# the MathJax output. See the MathJax site (see:
+# http://docs.mathjax.org/en/latest/output.html) for more details.
+# Possible values are: HTML-CSS (which is slower, but has the best
+# compatibility), NativeMML (i.e. MathML) and SVG.
+# The default value is: HTML-CSS.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_FORMAT         = HTML-CSS
+
+# When MathJax is enabled you need to specify the location relative to the HTML
+# output directory using the MATHJAX_RELPATH option. The destination directory
+# should contain the MathJax.js script. For instance, if the mathjax directory
+# is located at the same level as the HTML output directory, then
+# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
+# Content Delivery Network so you can quickly see the result without installing
+# MathJax. However, it is strongly recommended to install a local copy of
+# MathJax from http://www.mathjax.org before deployment.
+# The default value is: http://cdn.mathjax.org/mathjax/latest.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_RELPATH        = http://cdn.mathjax.org/mathjax/latest
+
+# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
+# extension names that should be enabled during MathJax rendering. For example
+# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_EXTENSIONS     =
+
+# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
+# of code that will be used on startup of the MathJax code. See the MathJax site
+# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an
+# example see the documentation.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_CODEFILE       =
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box for
+# the HTML output. The underlying search engine uses javascript and DHTML and
+# should work on any modern browser. Note that when using HTML help
+# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET)
+# there is already a search function so this one should typically be disabled.
+# For large projects the javascript based search engine can be slow, then
+# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to
+# search using the keyboard; to jump to the search box use <access key> + S
+# (what the <access key> is depends on the OS and browser, but it is typically
+# <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down
+# key> to jump into the search results window, the results can be navigated
+# using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel
+# the search. The filter options can be selected when the cursor is inside the
+# search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys>
+# to select a filter and <Enter> or <escape> to activate or cancel the filter
+# option.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+SEARCHENGINE           = NO
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
+# implemented using a web server instead of a web client using Javascript. There
+# are two flavors of web server based searching depending on the EXTERNAL_SEARCH
+# setting. When disabled, doxygen will generate a PHP script for searching and
+# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing
+# and searching needs to be provided by external tools. See the section
+# "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SERVER_BASED_SEARCH    = NO
+
+# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP
+# script for searching. Instead the search results are written to an XML file
+# which needs to be processed by an external indexer. Doxygen will invoke an
+# external search engine pointed to by the SEARCHENGINE_URL option to obtain the
+# search results.
+#
+# Doxygen ships with an example indexer ( doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: http://xapian.org/).
+#
+# See the section "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH        = NO
+
+# The SEARCHENGINE_URL should point to a search engine hosted by a web server
+# which will return the search results when EXTERNAL_SEARCH is enabled.
+#
+# Doxygen ships with an example indexer ( doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: http://xapian.org/). See the section "External Indexing and
+# Searching" for details.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHENGINE_URL       =
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
+# search data is written to a file for indexing by an external tool. With the
+# SEARCHDATA_FILE tag the name of this file can be specified.
+# The default file is: searchdata.xml.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHDATA_FILE        = searchdata.xml
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the
+# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
+# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
+# projects and redirect the results back to the right project.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH_ID     =
+
+# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
+# projects other than the one defined by this configuration file, but that are
+# all added to the same external search index. Each project needs to have a
+# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of
+# to a relative location where the documentation can be found. The format is:
+# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTRA_SEARCH_MAPPINGS  =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES doxygen will generate LaTeX output.
+# The default value is: YES.
+
+GENERATE_LATEX         = @DOXYFILE_LATEX@
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_OUTPUT           = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked.
+#
+# Note that when enabling USE_PDFLATEX this option is only used for generating
+# bitmaps for formulas in the HTML output, but not in the Makefile that is
+# written to the output directory.
+# The default file is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_CMD_NAME         = @LATEX_COMPILER@
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate
+# index for LaTeX.
+# The default file is: makeindex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+MAKEINDEX_CMD_NAME     = @MAKEINDEX_COMPILER@
+
+# If the COMPACT_LATEX tag is set to YES doxygen generates more compact LaTeX
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used by the
+# printer.
+# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x
+# 14 inches) and executive (7.25 x 10.5 inches).
+# The default value is: a4.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PAPER_TYPE             = a4
+
+# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
+# that should be included in the LaTeX output. To get the times font for
+# instance you can specify
+# EXTRA_PACKAGES=times
+# If left blank no extra packages will be included.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+EXTRA_PACKAGES         =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
+# generated LaTeX document. The header should contain everything until the first
+# chapter. If it is left blank doxygen will generate a standard header. See
+# section "Doxygen usage" for information on how to let doxygen write the
+# default header to a separate file.
+#
+# Note: Only use a user-defined header if you know what you are doing! The
+# following commands have a special meaning inside the header: $title,
+# $datetime, $date, $doxygenversion, $projectname, $projectnumber,
+# $projectbrief, $projectlogo. Doxygen will replace $title with the empy string,
+# for the replacement values of the other commands the user is refered to
+# HTML_HEADER.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HEADER           =
+
+# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
+# generated LaTeX document. The footer should contain everything after the last
+# chapter. If it is left blank doxygen will generate a standard footer. See
+# LATEX_HEADER for more information on how to generate a default footer and what
+# special commands can be used inside the footer.
+#
+# Note: Only use a user-defined footer if you know what you are doing!
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_FOOTER           =
+
+# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the LATEX_OUTPUT output
+# directory. Note that the files will be copied as-is; there are no commands or
+# markers available.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_EXTRA_FILES      =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
+# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
+# contain links (just like the HTML output) instead of page references. This
+# makes the output suitable for online browsing using a PDF viewer.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PDF_HYPERLINKS         = YES
+
+# If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
+# the PDF file directly from the LaTeX files. Set this option to YES to get a
+# higher quality PDF documentation.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+USE_PDFLATEX           = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
+# command to the generated LaTeX files. This will instruct LaTeX to keep running
+# if errors occur, instead of asking the user for help. This option is also used
+# when generating formulas in HTML.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BATCHMODE        = YES
+
+# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the
+# index chapters (such as File Index, Compound Index, etc.) in the output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HIDE_INDICES     = NO
+
+# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
+# code with syntax highlighting in the LaTeX output.
+#
+# Note that which sources are shown also depends on other settings such as
+# SOURCE_BROWSER.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_SOURCE_CODE      = NO
+
+# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
+# bibliography, e.g. plainnat, or ieeetr. See
+# http://en.wikipedia.org/wiki/BibTeX and \cite for more info.
+# The default value is: plain.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BIB_STYLE        = plain
+
+#---------------------------------------------------------------------------
+# Configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES doxygen will generate RTF output. The
+# RTF output is optimized for Word 97 and may not look too pretty with other RTF
+# readers/editors.
+# The default value is: NO.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: rtf.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES doxygen generates more compact RTF
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will
+# contain hyperlink fields. The RTF file will contain links (just like the HTML
+# output) instead of page references. This makes the output suitable for online
+# browsing using Word or some other Word compatible readers that support those
+# fields.
+#
+# Note: WordPad (write) and others do not support links.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_HYPERLINKS         = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's config
+# file, i.e. a series of assignments. You only have to provide replacements,
+# missing definitions are set to their default value.
+#
+# See also section "Doxygen usage" for information on how to generate the
+# default style sheet that doxygen normally uses.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_STYLESHEET_FILE    =
+
+# Set optional variables used in the generation of an RTF document. Syntax is
+# similar to doxygen's config file. A template extensions file can be generated
+# using doxygen -e rtf extensionFile.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_EXTENSIONS_FILE    =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES doxygen will generate man pages for
+# classes and files.
+# The default value is: NO.
+
+GENERATE_MAN           = YES
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it. A directory man3 will be created inside the directory specified by
+# MAN_OUTPUT.
+# The default directory is: man.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to the generated
+# man pages. In case the manual section does not start with a number, the number
+# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is
+# optional.
+# The default value is: .3.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_EXTENSION          = .3
+
+# The MAN_SUBDIR tag determines the name of the directory created within
+# MAN_OUTPUT in which the man pages are placed. If defaults to man followed by
+# MAN_EXTENSION with the initial . removed.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_SUBDIR             =
+
+# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it
+# will generate one additional man file for each entity documented in the real
+# man page(s). These additional files only source the real man page, but without
+# them the man command would be unable to find the correct page.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES doxygen will generate an XML file that
+# captures the structure of the code including all documentation.
+# The default value is: NO.
+
+GENERATE_XML           = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: xml.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_OUTPUT             = xml
+
+# If the XML_PROGRAMLISTING tag is set to YES doxygen will dump the program
+# listings (including syntax highlighting and cross-referencing information) to
+# the XML output. Note that enabling this will significantly increase the size
+# of the XML output.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_PROGRAMLISTING     = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to the DOCBOOK output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_DOCBOOK tag is set to YES doxygen will generate Docbook files
+# that can be used to generate PDF.
+# The default value is: NO.
+
+GENERATE_DOCBOOK       = NO
+
+# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
+# front of it.
+# The default directory is: docbook.
+# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
+
+DOCBOOK_OUTPUT         = docbook
+
+# If the DOCBOOK_PROGRAMLISTING tag is set to YES doxygen will include the
+# program listings (including syntax highlighting and cross-referencing
+# information) to the DOCBOOK output. Note that enabling this will significantly
+# increase the size of the DOCBOOK output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
+
+DOCBOOK_PROGRAMLISTING = NO
+
+#---------------------------------------------------------------------------
+# Configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES doxygen will generate an AutoGen
+# Definitions (see http://autogen.sf.net) file that captures the structure of
+# the code including all documentation. Note that this feature is still
+# experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES doxygen will generate a Perl module
+# file that captures the structure of the code including all documentation.
+#
+# Note that this feature is still experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_PERLMOD       = NO
+
+# If the PERLMOD_LATEX tag is set to YES doxygen will generate the necessary
+# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI
+# output from the Perl module output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_LATEX          = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be nicely
+# formatted so it can be parsed by a human reader. This is useful if you want to
+# understand what is going on. On the other hand, if this tag is set to NO the
+# size of the Perl module output will be much smaller and Perl will parse it
+# just the same.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_PRETTY         = YES
+
+# The names of the make variables in the generated doxyrules.make file are
+# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful
+# so different doxyrules.make files included by the same Makefile don't
+# overwrite each other's variables.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES doxygen will evaluate all
+# C-preprocessor directives found in the sources and include files.
+# The default value is: YES.
+
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES doxygen will expand all macro names
+# in the source code. If set to NO only conditional compilation will be
+# performed. Macro expansion can be done in a controlled way by setting
+# EXPAND_ONLY_PREDEF to YES.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+MACRO_EXPANSION        = YES
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
+# the macro expansion is limited to the macros specified with the PREDEFINED and
+# EXPAND_AS_DEFINED tags.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_ONLY_PREDEF     = NO
+
+# If the SEARCH_INCLUDES tag is set to YES the includes files in the
+# INCLUDE_PATH will be searched if a #include is found.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by the
+# preprocessor.
+# This tag requires that the tag SEARCH_INCLUDES is set to YES.
+
+INCLUDE_PATH           =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will be
+# used.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+INCLUDE_FILE_PATTERNS  =
+
+# The PREDEFINED tag can be used to specify one or more macro names that are
+# defined before the preprocessor is started (similar to the -D option of e.g.
+# gcc). The argument of the tag is a list of macros of the form: name or
+# name=definition (no spaces). If the definition and the "=" are omitted, "=1"
+# is assumed. To prevent a macro definition from being undefined via #undef or
+# recursively expanded use the := operator instead of the = operator.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+PREDEFINED             = DOXYGEN \
+                         PRINTF_ATTRIBUTE(x,y)=
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
+# tag can be used to specify a list of macro names that should be expanded. The
+# macro definition that is found in the sources will be used. Use the PREDEFINED
+# tag if you want to use a different macro definition that overrules the
+# definition found in the source code.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_AS_DEFINED      =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
+# remove all references to function-like macros that are alone on a line, have
+# an all uppercase name, and do not end with a semicolon. Such function macros
+# are typically used for boiler-plate code, and will confuse the parser if not
+# removed.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SKIP_FUNCTION_MACROS   = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES tag can be used to specify one or more tag files. For each tag
+# file the location of the external documentation should be added. The format of
+# a tag file without this location is as follows:
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where loc1 and loc2 can be relative or absolute paths or URLs. See the
+# section "Linking to external documentation" for more information about the use
+# of tag files.
+# Note: Each tag file must have a unique name (where the name does NOT include
+# the path). If a tag file is not located in the directory in which doxygen is
+# run, you must also specify the path to the tagfile here.
+
+TAGFILES               =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
+# tag file that is based on the input files it reads. See section "Linking to
+# external documentation" for more information about the usage of tag files.
+
+GENERATE_TAGFILE       = @CMAKE_CURRENT_BINARY_DIR@/html/@PROJECT_NAME at .TAGFILE
+
+# If the ALLEXTERNALS tag is set to YES all external class will be listed in the
+# class index. If set to NO only the inherited external classes will be listed.
+# The default value is: NO.
+
+ALLEXTERNALS           = YES
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed in
+# the modules index. If set to NO, only the current project's groups will be
+# listed.
+# The default value is: YES.
+
+EXTERNAL_GROUPS        = YES
+
+# If the EXTERNAL_PAGES tag is set to YES all external pages will be listed in
+# the related pages index. If set to NO, only the current project's pages will
+# be listed.
+# The default value is: YES.
+
+EXTERNAL_PAGES         = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of 'which perl').
+# The default file (with absolute path) is: /usr/bin/perl.
+
+PERL_PATH              = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES doxygen will generate a class diagram
+# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
+# NO turns the diagrams off. Note that this option also works with HAVE_DOT
+# disabled, but it is recommended to install and use dot, since it yields more
+# powerful graphs.
+# The default value is: YES.
+
+CLASS_DIAGRAMS         = NO
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see:
+# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH            =
+
+# You can include diagrams made with dia in doxygen documentation. Doxygen will
+# then run dia to produce the diagram and insert it in the documentation. The
+# DIA_PATH tag allows you to specify the directory where the dia binary resides.
+# If left empty dia is assumed to be found in the default search path.
+
+DIA_PATH               =
+
+# If set to YES, the inheritance and collaboration graphs will hide inheritance
+# and usage relations if the target is undocumented or is not a class.
+# The default value is: YES.
+
+HIDE_UNDOC_RELATIONS   = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz (see:
+# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
+# Bell Labs. The other options in this section have no effect if this option is
+# set to NO
+# The default value is: NO.
+
+HAVE_DOT               = @DOXYGEN_DOT_FOUND@
+
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
+# to run in parallel. When set to 0 doxygen will base this on the number of
+# processors available in the system. You can set it explicitly to a value
+# larger than 0 to get control over the balance between CPU load and processing
+# speed.
+# Minimum value: 0, maximum value: 32, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_NUM_THREADS        = 0
+
+# When you want a differently looking font in the dot files that doxygen
+# generates you can specify the font name using DOT_FONTNAME. You need to make
+# sure dot is able to find the font, which can be done by putting it in a
+# standard location or by setting the DOTFONTPATH environment variable or by
+# setting DOT_FONTPATH to the directory containing the font.
+# The default value is: Helvetica.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTNAME           =
+
+# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
+# dot graphs.
+# Minimum value: 4, maximum value: 24, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTSIZE           = 10
+
+# By default doxygen will tell dot to use the default font as specified with
+# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
+# the path where dot can find it using this tag.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTPATH           =
+
+# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
+# each documented class showing the direct and indirect inheritance relations.
+# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a
+# graph for each documented class showing the direct and indirect implementation
+# dependencies (inheritance, containment, and class references variables) of the
+# class with other documented classes.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+COLLABORATION_GRAPH    = YES
+
+# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
+# groups, showing the direct groups dependencies.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GROUP_GRAPHS           = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LOOK               = NO
+
+# If the UML_LOOK tag is enabled, the fields and methods are shown inside the
+# class node. If there are many fields or methods and many nodes the graph may
+# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the
+# number of items for each type to make the size more manageable. Set this to 0
+# for no limit. Note that the threshold may be exceeded by 50% before the limit
+# is enforced. So when you set the threshold to 10, up to 15 fields may appear,
+# but if the number exceeds 15, the total amount of fields shown is limited to
+# 10.
+# Minimum value: 0, maximum value: 100, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LIMIT_NUM_FIELDS   = 10
+
+# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
+# collaboration graphs will show the relations between templates and their
+# instances.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+TEMPLATE_RELATIONS     = YES
+
+# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to
+# YES then doxygen will generate a graph for each documented file showing the
+# direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDE_GRAPH          = NO
+
+# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are
+# set to YES then doxygen will generate a graph for each documented file showing
+# the direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDED_BY_GRAPH      = YES
+
+# If the CALL_GRAPH tag is set to YES then doxygen will generate a call
+# dependency graph for every global function or class method.
+#
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable call graphs for selected
+# functions only using the \callgraph command.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CALL_GRAPH             = NO
+
+# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller
+# dependency graph for every global function or class method.
+#
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable caller graphs for selected
+# functions only using the \callergraph command.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CALLER_GRAPH           = NO
+
+# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical
+# hierarchy of all classes instead of a textual one.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GRAPHICAL_HIERARCHY    = YES
+
+# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the
+# dependencies a directory has on other directories in a graphical way. The
+# dependency relations are determined by the #include relations between the
+# files in the directories.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DIRECTORY_GRAPH        = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot.
+# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
+# to make the SVG files visible in IE 9+ (other browsers do not have this
+# requirement).
+# Possible values are: png, jpg, gif and svg.
+# The default value is: png.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_IMAGE_FORMAT       = png
+
+# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
+# enable generation of interactive SVG images that allow zooming and panning.
+#
+# Note that this requires a modern browser other than Internet Explorer. Tested
+# and working are Firefox, Chrome, Safari, and Opera.
+# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make
+# the SVG files visible. Older versions of IE do not have SVG support.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INTERACTIVE_SVG        = NO
+
+# The DOT_PATH tag can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_PATH               = @DOXYGEN_DOT_EXECUTABLE_PATH@
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the \dotfile
+# command).
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOTFILE_DIRS           =
+
+# The MSCFILE_DIRS tag can be used to specify one or more directories that
+# contain msc files that are included in the documentation (see the \mscfile
+# command).
+
+MSCFILE_DIRS           =
+
+# The DIAFILE_DIRS tag can be used to specify one or more directories that
+# contain dia files that are included in the documentation (see the \diafile
+# command).
+
+DIAFILE_DIRS           =
+
+# When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the
+# path where java can find the plantuml.jar file. If left blank, it is assumed
+# PlantUML is not used or called during a preprocessing step. Doxygen will
+# generate a warning when it encounters a \startuml command in this case and
+# will not generate output for the diagram.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+PLANTUML_JAR_PATH      =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes
+# that will be shown in the graph. If the number of nodes in a graph becomes
+# larger than this value, doxygen will truncate the graph, which is visualized
+# by representing a node as a red box. Note that doxygen if the number of direct
+# children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that
+# the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+# Minimum value: 0, maximum value: 10000, default value: 50.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_GRAPH_MAX_NODES    = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs
+# generated by dot. A depth value of 3 means that only nodes reachable from the
+# root by following a path via at most 3 edges will be shown. Nodes that lay
+# further from the root node will be omitted. Note that setting this option to 1
+# or 2 may greatly reduce the computation time needed for large code bases. Also
+# note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+# Minimum value: 0, maximum value: 1000, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+MAX_DOT_GRAPH_DEPTH    = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not seem
+# to support this out of the box.
+#
+# Warning: Depending on the platform used, enabling this option may lead to
+# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
+# read).
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_TRANSPARENT        = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10) support
+# this, this feature is disabled by default.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_MULTI_TARGETS      = YES
+
+# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page
+# explaining the meaning of the various boxes and arrows in the dot generated
+# graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES doxygen will remove the intermediate dot
+# files that are used to generate the various graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_CLEANUP            = YES
diff --git a/third_party/cmocka/doc/index.html b/third_party/cmocka/doc/index.html
index 8db0247..5f7c5a7 100644
--- a/third_party/cmocka/doc/index.html
+++ b/third_party/cmocka/doc/index.html
@@ -137,7 +137,7 @@ calls to <b>mock_assert()</b> occur during the function called via
 #include <assert.h>
 
 // If unit testing is enabled override assert with mock_assert().
-#if UNIT_TESTING
+#ifdef UNIT_TESTING
 extern void mock_assert(const int result, const char* const expression, 
                         const char * const file, const int line);
 #undef assert
@@ -285,7 +285,7 @@ the test application to exit prematurely.</p>
 <listing>
 #include <malloc.h>
 
-#if UNIT_TESTING
+#ifdef UNIT_TESTING
 extern void* _test_malloc(const size_t size, const char* file, const int line);
 extern void* _test_calloc(const size_t number_of_elements, const size_t size, 
                           const char* file, const int line);
diff --git a/third_party/cmocka/doc/mainpage.dox b/third_party/cmocka/doc/mainpage.dox
index d7f2027..925bfd2 100644
--- a/third_party/cmocka/doc/mainpage.dox
+++ b/third_party/cmocka/doc/mainpage.dox
@@ -2,25 +2,18 @@
 
 @mainpage
 
-This is the online reference for developing with the CMocka library. It
-documents the CMocka C API.
+This is the online reference for developing with the cmocka library. It
+documents the cmocka C API.
 
- at section main-motivation Motivation
+cmocka is an elegant unit testing framework for C with support for mock
+objects. It only requires the standard C library, works on a lot of platforms
+(including embedded) and with different compilers.
 
-There are a variety of C unit testing frameworks available supporting different
-platforms and compilers. Some development requires a lot of different compilers
-and older versions which makes it difficult to use unit testing frameworks.
-
-The idea of CMocka is that a test application only requires the standard C
-library and CMocka itself to minimize the conflicts with standard C library
-headers especially on a lot of different platforms.
-
-Currently CMocka is tested on Linux, FreeBSD, Solaris and Windows. See the
-<a href="http://mock.cryptomilk.org/index.php?project=cmocka">Testing Dashboard</a>.
+http://cmocka.org/
 
 @section main-features Features
 
-CMocka tests are compiled into stand-alone executables and linked with the
+Tests written with cmocka are compiled into stand-alone executables and linked with the
 CMock library, the standard C library and module being tested. Any symbols
 external to the module being tested should be mocked - replaced with functions
 that return values determined by the test - within the test application. Even
@@ -32,16 +25,22 @@ execution environment.
 
 The CMocka library provides:
 
- - An easy to use framework to write unit tests.
  - Support for mock objects.
- - Fixtures to implement a setup and teardown function.
+ - Test fixtures.
+ - Only requires a C library
+ - Exception handling for signals (SIGSEGV, SIGILL, ...)
+ - No use of fork()
+ - Very well tested
+ - Testing of memory leaks, buffer overflows and underflows.
  - A set of assert macros.
+ - Several supported output formats (stdout, TAP, xUnit XML, Subunit)
+ - License: Apache License 2.0
 
- at section main-test A CMocka test
+ at section main-test A cmocka test
 
-CMocka unit test cases are functions with the signature void function(void **state).
-CMocka test applications initialize a table with test case function pointers
-using unit_test() macros. This table is then passed to the run_tests() macro to
+Test cases are functions with the signature void function(void **state).  Test
+applications initialize a table with test case function pointers using
+unit_test() macros. This table is then passed to the run_tests() macro to
 execute the tests. run_tests() sets up the appropriate exception / signal
 handlers and other data structures prior to running each test function. When a
 unit test is complete run_tests() performs various checks to determine whether
@@ -53,17 +52,17 @@ the test succeeded.
 #include <setjmp.h>
 #include <cmocka.h>
 
-/* A test case that does nothing and succeeds. * /
+/* A test case that does nothing and succeeds. */
 static void null_test_success(void **state) {
-    (void) state; /* unused * /
+    (void) state; /* unused */
 }
 
 int main(void) {
-    const UnitTest tests[] = {
-        unit_test(null_test_success),
+    const struct CMUnitTest tests[] = {
+        cmocka_unit_test(null_test_success),
     };
 
-    return run_tests(tests);
+    return cmocka_run_group_tests(tests, NULL, NULL);
 }
 @endcode
 
@@ -82,7 +81,50 @@ behaviour and state. The object can call some functions or act on different
 input (abort a test if it is wrong). The test driver injects what it expects
 the mock object to return. CMocka provides and API to easily mock code.
 
-Read the article <a href="https://lwn.net/Articles/558106/">Unit testing with mock objects in C</a>
-to learn more.
+<a href="https://lwn.net/Articles/558106/">Learn more ...</a>
+
+ at section main-embedded Embedded platforms
+
+It is possible that some embedded platforms do not provide definitions for
+required types or that the guards to protect them are not defined. To address
+this issue you can create a header file name 'cmocka_platform.h' with the
+required types and definitions. After that point cmake to the include directory
+using:
+
+<pre>
+    cmake -DCMOCKA_PLATFORM_INCLUDE=/home/compiler/my/include_directory ..
+</pre>
+
+ at section main-threads Threading
+
+cmocka is not fully thread safe and it is not the goal of it to be it. We have
+several global variables to track test states. They are marked as thread local
+but it is possible that you still run into issues. However if you use cmocka
+for writing tests in an application which uses threads, you can set the
+following envionment variable:
+
+<pre>
+    CMOCKA_TEST_ABORT='1' ./my_threading_test
+</pre>
+
+With this environment variable set to '1', cmocka will call <tt>abort()</tt> if
+a test fails.
+
+ at section main-output Output formats
+
+By default, cmocka prints human-readable test output to stderr. It is
+possible to configure several other output formats.  The configuration is
+done using the <tt>CMOCKA_MESSAGE_OUTPUT</tt> environment variable. The
+supported values are:
+ - <tt>STDOUT</tt> for the default standard output printer
+ - <tt>SUBUNIT</tt> for subunit output
+ - <tt>TAP</tt> for Test Anything Protocol (TAP) output
+ - <tt>XML</tt> for xUnit XML format
+The case doesn't matter.
+
+The XML output goes to stderr by default. If the environment variable
+<tt>CMOCKA_XML_FILE</tt> exists and the file specified by this variable
+doesn't exist yet, then cmocka will put the output to this file.
+
 
 */
diff --git a/third_party/cmocka/example/CMakeLists.txt b/third_party/cmocka/example/CMakeLists.txt
index c2d3423..e46a4fc 100644
--- a/third_party/cmocka/example/CMakeLists.txt
+++ b/third_party/cmocka/example/CMakeLists.txt
@@ -8,35 +8,58 @@ include_directories(
 
 set_source_files_properties(
     calculator.c
-    calculator_test.c
     allocate_module.c
-    allocate_module_test.c
-    run_tests.c
+    assert_module.c
     PROPERTIES
-        COMPILE_FLAGS -DUNIT_TESTING=1)
+        COMPILE_DEFINITIONS UNIT_TESTING=1)
 
-add_executable(fixture_test fixture_test.c)
-target_link_libraries(fixture_test ${CMOCKA_SHARED_LIBRARY})
+if (WIN32)
+    set(DLL_PATH_ENV "${CMOCKA_DLL_PATH};$ENV{PATH}")
 
-add_test(fixture_test ${CMAKE_CURRENT_BINARY_DIR}/fixture_test)
+    #
+    # IMPORTANT NOTE: The set_tests_properties(), below, internally
+    # stores its name/value pairs with a semicolon delimiter.
+    # because of this we must protect the semicolons in the path
+    #
+    string(REPLACE ";" "\\;" DLL_PATH_ENV "${DLL_PATH_ENV}")
+endif (WIN32)
 
-add_executable(calculator_test calculator.c calculator_test.c)
-target_link_libraries(calculator_test ${CMOCKA_SHARED_LIBRARY})
 
-add_test(calculator_test ${CMAKE_CURRENT_BINARY_DIR}/calculator_test)
+### The most simple test
+add_executable(simple_test simple_test.c)
+target_link_libraries(simple_test ${CMOCKA_SHARED_LIBRARY})
 
+add_test(simple_test ${CMAKE_CURRENT_BINARY_DIR}/simple_test)
+if (WIN32)
+    set_tests_properties(simple_test PROPERTIES ENVIRONMENT "PATH=${DLL_PATH_ENV}")
+endif (WIN32)
+
+### Calulator test
+if (NOT WIN32)
+    add_executable(calculator_test calculator.c calculator_test.c)
+    target_link_libraries(calculator_test ${CMOCKA_SHARED_LIBRARY})
+
+    add_test(calculator_test ${CMAKE_CURRENT_BINARY_DIR}/calculator_test)
+endif (NOT WIN32)
+
+# FIXME These tests fail on Windows when run with ctest but look correct excuted manually.
+if (NOT WIN32)
+### Allocate module test
 add_executable(allocate_module_test allocate_module.c allocate_module_test.c)
 target_link_libraries(allocate_module_test ${CMOCKA_SHARED_LIBRARY})
 
 # This is a test that should detect leaks and overflows and will fail for that
 add_test(allocate_module_test ${CMAKE_CURRENT_BINARY_DIR}/allocate_module_test)
+if (WIN32)
+    set_tests_properties(allocate_module_test PROPERTIES ENVIRONMENT "PATH=${DLL_PATH_ENV}")
+endif (WIN32)
 set_tests_properties(
     allocate_module_test
         PROPERTIES
-        PASS_REGULAR_EXPRESSION
-        "\\[  FAILED  \\] 3 test"
+            WILL_FAIL 1
 )
 
+### Assert macro test
 add_executable(assert_macro_test assert_macro.c assert_macro_test.c)
 target_link_libraries(assert_macro_test ${CMOCKA_SHARED_LIBRARY})
 
@@ -44,31 +67,46 @@ add_test(assert_macro_test ${CMAKE_CURRENT_BINARY_DIR}/assert_macro_test)
 set_tests_properties(
     assert_macro_test
         PROPERTIES
-        PASS_REGULAR_EXPRESSION
-        "\\[  FAILED  \\] 2 test"
+        WILL_FAIL 1
 )
+if (WIN32)
+    set_tests_properties(assert_macro_test PROPERTIES ENVIRONMENT "PATH=${DLL_PATH_ENV}")
+endif (WIN32)
 
+### Assert module test
 add_executable(assert_module_test assert_module.c assert_module_test.c)
 target_link_libraries(assert_module_test ${CMOCKA_SHARED_LIBRARY})
 
-add_test(assert_module_test ${CMAKE_CURRENT_BINARY_DIR}/assert_macro_test)
+add_test(assert_module_test ${CMAKE_CURRENT_BINARY_DIR}/assert_module_test)
 set_tests_properties(
     assert_module_test
         PROPERTIES
-        PASS_REGULAR_EXPRESSION
-        "\\[  FAILED  \\] 2 test"
+        WILL_FAIL 1
 )
+if (WIN32)
+    set_tests_properties(assert_module_test PROPERTIES ENVIRONMENT "PATH=${DLL_PATH_ENV}")
+endif (WIN32)
+endif (NOT WIN32) # FIXME FAIL
 
+### Customer database test
 add_executable(customer_database_test customer_database.c customer_database_test.c)
 target_link_libraries(customer_database_test ${CMOCKA_SHARED_LIBRARY})
 
 add_test(customer_database_test ${CMAKE_CURRENT_BINARY_DIR}/customer_database_test)
+if (WIN32)
+    set_tests_properties(customer_database_test PROPERTIES ENVIRONMENT "PATH=${DLL_PATH_ENV}")
+endif (WIN32)
 
+### Key Value Test
 add_executable(key_value_test key_value.c key_value_test.c)
 target_link_libraries(key_value_test ${CMOCKA_SHARED_LIBRARY})
 
 add_test(key_value_test ${CMAKE_CURRENT_BINARY_DIR}/key_value_test)
+if (WIN32)
+    set_tests_properties(key_value_test PROPERTIES ENVIRONMENT "PATH=${DLL_PATH_ENV}")
+endif (WIN32)
 
+### Product database test
 add_executable(product_database_test product_database.c product_database_test.c)
 target_link_libraries(product_database_test ${CMOCKA_SHARED_LIBRARY})
 
@@ -79,12 +117,11 @@ set_tests_properties(
         PASS_REGULAR_EXPRESSION
         "\\[  FAILED  \\] 2 test"
 )
+if (WIN32)
+    set_tests_properties(product_database_test PROPERTIES ENVIRONMENT "PATH=${DLL_PATH_ENV}")
+endif (WIN32)
 
-add_executable(run_tests run_tests.c)
-target_link_libraries(run_tests ${CMOCKA_SHARED_LIBRARY})
-
-add_test(run_tests ${CMAKE_CURRENT_BINARY_DIR}/run_tests)
-
-if (${CMAKE_C_COMPILER_ID} MATCHES "(GNU|Clang)")
+# TODO Execute "$CMAKE_LINKER --help" and check for --wrap
+if (${CMAKE_C_COMPILER_ID} MATCHES "(GNU|Clang)" AND NOT APPLE)
     add_subdirectory(chef_wrap)
 endif()
diff --git a/third_party/cmocka/example/allocate_module.c b/third_party/cmocka/example/allocate_module.c
index 295e10e..3c4fb49 100644
--- a/third_party/cmocka/example/allocate_module.c
+++ b/third_party/cmocka/example/allocate_module.c
@@ -22,7 +22,7 @@
 #include <sys/types.h>
 #include <stdlib.h>
 
-#if UNIT_TESTING
+#ifdef UNIT_TESTING
 extern void* _test_malloc(const size_t size, const char* file, const int line);
 extern void* _test_calloc(const size_t number_of_elements, const size_t size,
                           const char* file, const int line);
diff --git a/third_party/cmocka/example/allocate_module_test.c b/third_party/cmocka/example/allocate_module_test.c
index 1d1e164..cd5d371 100644
--- a/third_party/cmocka/example/allocate_module_test.c
+++ b/third_party/cmocka/example/allocate_module_test.c
@@ -44,10 +44,10 @@ static void buffer_underflow_test(void **state) {
 }
 
 int main(void) {
-    const UnitTest tests[] = {
-        unit_test(leak_memory_test),
-        unit_test(buffer_overflow_test),
-        unit_test(buffer_underflow_test),
+    const struct CMUnitTest tests[] = {
+        cmocka_unit_test(leak_memory_test),
+        cmocka_unit_test(buffer_overflow_test),
+        cmocka_unit_test(buffer_underflow_test),
     };
-    return run_tests(tests);
+    return cmocka_run_group_tests(tests, NULL, NULL);
 }
diff --git a/third_party/cmocka/example/assert_macro_test.c b/third_party/cmocka/example/assert_macro_test.c
index efe1c64..2cd355c 100644
--- a/third_party/cmocka/example/assert_macro_test.c
+++ b/third_party/cmocka/example/assert_macro_test.c
@@ -38,9 +38,9 @@ static void string_to_status_code_test(void **state) {
 }
 
 int main(void) {
-    const UnitTest tests[] = {
-        unit_test(get_status_code_string_test),
-        unit_test(string_to_status_code_test),
+    const struct CMUnitTest tests[] = {
+        cmocka_unit_test(get_status_code_string_test),
+        cmocka_unit_test(string_to_status_code_test),
     };
-    return run_tests(tests);
+    return cmocka_run_group_tests(tests, NULL, NULL);
 }
diff --git a/third_party/cmocka/example/assert_module.c b/third_party/cmocka/example/assert_module.c
index bb75aaa..381069b 100644
--- a/third_party/cmocka/example/assert_module.c
+++ b/third_party/cmocka/example/assert_module.c
@@ -18,7 +18,7 @@
 #include "assert_module.h"
 
 /* If unit testing is enabled override assert with mock_assert(). */
-#if UNIT_TESTING
+#ifdef UNIT_TESTING
 extern void mock_assert(const int result, const char* const expression,
                         const char * const file, const int line);
 #undef assert
diff --git a/third_party/cmocka/example/assert_module_test.c b/third_party/cmocka/example/assert_module_test.c
index 6f4f0a9..f387754 100644
--- a/third_party/cmocka/example/assert_module_test.c
+++ b/third_party/cmocka/example/assert_module_test.c
@@ -47,10 +47,10 @@ static void decrement_value_fail(void **state) {
 }
 
 int main(void) {
-    const UnitTest tests[] = {
-        unit_test(increment_value_fail),
-        unit_test(increment_value_assert),
-        unit_test(decrement_value_fail),
+    const struct CMUnitTest tests[] = {
+        cmocka_unit_test(increment_value_fail),
+        cmocka_unit_test(increment_value_assert),
+        cmocka_unit_test(decrement_value_fail),
     };
-    return run_tests(tests);
+    return cmocka_run_group_tests(tests, NULL, NULL);
 }
diff --git a/third_party/cmocka/example/calculator.c b/third_party/cmocka/example/calculator.c
index 684fb9b..307b551 100644
--- a/third_party/cmocka/example/calculator.c
+++ b/third_party/cmocka/example/calculator.c
@@ -28,7 +28,7 @@
 #include <string.h>
 
 /* If this is being built for a unit test. */
-#if UNIT_TESTING
+#ifdef UNIT_TESTING
 
 /* Redirect printf to a function in the test application so it's possible to
  * test the standard output. */
diff --git a/third_party/cmocka/example/calculator_test.c b/third_party/cmocka/example/calculator_test.c
index fc2bca0..ab8cad8 100644
--- a/third_party/cmocka/example/calculator_test.c
+++ b/third_party/cmocka/example/calculator_test.c
@@ -54,10 +54,10 @@ extern int perform_operation(
         int ** const intermediate_values, int * const error_occurred);
 extern int example_main(int argc, char *argv[]);
 
-int example_test_fprintf(FILE* const file, const char *format, ...) PRINTF_ATTRIBUTE(2, 3);
-int example_test_printf(const char *format, ...) PRINTF_ATTRIBUTE(1, 2);
+int example_test_fprintf(FILE* const file, const char *format, ...) CMOCKA_PRINTF_ATTRIBUTE(2, 3);
+int example_test_printf(const char *format, ...) CMOCKA_PRINTF_ATTRIBUTE(1, 2);
 
-char temporary_buffer[256];
+static char temporary_buffer[256];
 
 /* A mock fprintf function that checks the value of strings printed to the
  * standard error stream. */
@@ -68,7 +68,7 @@ int example_test_fprintf(FILE* const file, const char *format, ...) {
 	va_start(args, format);
 	return_value = vsnprintf(temporary_buffer, sizeof(temporary_buffer),
 	                         format, args);
-	check_expected(temporary_buffer);
+	check_expected_ptr(temporary_buffer);
 	va_end(args);
 	return return_value;
 }
@@ -81,7 +81,7 @@ int example_test_printf(const char *format, ...) {
 	va_start(args, format);
 	return_value = vsnprintf(temporary_buffer, sizeof(temporary_buffer),
 	                         format, args);
-	check_expected(temporary_buffer);
+	check_expected_ptr(temporary_buffer);
 	va_end(args);
 	return return_value;
 }
@@ -159,7 +159,7 @@ static void test_find_operator_function_by_string_null_string(void **state) {
 static void test_find_operator_function_by_string_valid_null_functions(void **state) {
         (void) state; /* unused */
 
-  assert_int_equal(find_operator_function_by_string(0, NULL, "test"), NULL);
+	assert_null(find_operator_function_by_string(0, NULL, "test"));
 }
 
 /* Ensure find_operator_function_by_string() returns NULL when searching for
@@ -173,9 +173,8 @@ static void test_find_operator_function_by_string_not_found(void **state) {
 
         (void) state; /* unused */
 
-	assert_int_equal(find_operator_function_by_string(
-	        array_length(operator_functions), operator_functions, "test"),
-	        NULL);
+	assert_null(find_operator_function_by_string(
+	        array_length(operator_functions), operator_functions, "test"));
 }
 
 /* Ensure find_operator_function_by_string() returns the correct function when
@@ -189,8 +188,11 @@ static void test_find_operator_function_by_string_found(void **state) {
 
         (void) state; /* unused */
 
-	assert_int_equal(find_operator_function_by_string(
-	        array_length(operator_functions), operator_functions, "-"),
+	assert_int_equal(
+            cast_ptr_to_largest_integral_type(
+                find_operator_function_by_string(array_length(operator_functions),
+                                                 operator_functions,
+                                                 "-")),
 	    0xDEADBEEF);
 }
 
@@ -392,7 +394,7 @@ static void test_perform_operation(void **state) {
 		"1", "+", "3", "*", "10",
 	};
 	int number_of_intermediate_values;
-	int *intermediate_values;
+	int *intermediate_values = NULL;
 	int error_occurred;
 
         (void) state; /* unused */
@@ -414,7 +416,7 @@ static void test_perform_operation(void **state) {
 	    &intermediate_values, &error_occurred), 40);
 	assert_int_equal(error_occurred, 0);
 
-	assert_true(intermediate_values);
+	assert_non_null(intermediate_values);
 	assert_int_equal(intermediate_values[0], 4);
 	assert_int_equal(intermediate_values[1], 40);
 	test_free(intermediate_values);
@@ -452,29 +454,29 @@ static void test_example_main(void **state) {
 
 
 int main(void) {
-	UnitTest tests[] = {
-		unit_test(test_add),
-		unit_test(test_subtract),
-		unit_test(test_multiply),
-		unit_test(test_divide),
-		unit_test(test_divide_by_zero),
-		unit_test(test_find_operator_function_by_string_null_functions),
-		unit_test(test_find_operator_function_by_string_null_string),
-		unit_test(test_find_operator_function_by_string_valid_null_functions),
-		unit_test(test_find_operator_function_by_string_not_found),
-		unit_test(test_find_operator_function_by_string_found),
-		unit_test(test_perform_operation_null_args),
-		unit_test(test_perform_operation_null_operator_functions),
-		unit_test(test_perform_operation_null_number_of_intermediate_values),
-		unit_test(test_perform_operation_null_intermediate_values),
-		unit_test(test_perform_operation_no_arguments),
-		unit_test(test_perform_operation_first_arg_not_integer),
-		unit_test(test_perform_operation_unknown_operator),
-		unit_test(test_perform_operation_missing_argument),
-		unit_test(test_perform_operation_no_integer_after_operator),
-		unit_test(test_perform_operation),
-		unit_test(test_example_main_no_args),
-		unit_test(test_example_main),
+	const struct CMUnitTest tests[] = {
+		cmocka_unit_test(test_add),
+		cmocka_unit_test(test_subtract),
+		cmocka_unit_test(test_multiply),
+		cmocka_unit_test(test_divide),
+		cmocka_unit_test(test_divide_by_zero),
+		cmocka_unit_test(test_find_operator_function_by_string_null_functions),
+		cmocka_unit_test(test_find_operator_function_by_string_null_string),
+		cmocka_unit_test(test_find_operator_function_by_string_valid_null_functions),
+		cmocka_unit_test(test_find_operator_function_by_string_not_found),
+		cmocka_unit_test(test_find_operator_function_by_string_found),
+		cmocka_unit_test(test_perform_operation_null_args),
+		cmocka_unit_test(test_perform_operation_null_operator_functions),
+		cmocka_unit_test(test_perform_operation_null_number_of_intermediate_values),
+		cmocka_unit_test(test_perform_operation_null_intermediate_values),
+		cmocka_unit_test(test_perform_operation_no_arguments),
+		cmocka_unit_test(test_perform_operation_first_arg_not_integer),
+		cmocka_unit_test(test_perform_operation_unknown_operator),
+		cmocka_unit_test(test_perform_operation_missing_argument),
+		cmocka_unit_test(test_perform_operation_no_integer_after_operator),
+		cmocka_unit_test(test_perform_operation),
+		cmocka_unit_test(test_example_main_no_args),
+		cmocka_unit_test(test_example_main),
 	};
-	return run_tests(tests);
+	return cmocka_run_group_tests(tests, NULL, NULL);
 }
diff --git a/third_party/cmocka/example/chef_wrap/CMakeLists.txt b/third_party/cmocka/example/chef_wrap/CMakeLists.txt
index 60d5a36..5902438 100644
--- a/third_party/cmocka/example/chef_wrap/CMakeLists.txt
+++ b/third_party/cmocka/example/chef_wrap/CMakeLists.txt
@@ -15,3 +15,6 @@ set_target_properties(waiter_test_wrap
         PROPERTIES
         LINK_FLAGS  "-Wl,--wrap=chef_cook"
 )
+if (WIN32)
+    set_tests_properties(waiter_test_wrap PROPERTIES ENVIRONMENT "PATH=${DLL_PATH_ENV}")
+endif (WIN32)
diff --git a/third_party/cmocka/example/chef_wrap/waiter_test_wrap.c b/third_party/cmocka/example/chef_wrap/waiter_test_wrap.c
index 1b8ed94..4146818 100644
--- a/third_party/cmocka/example/chef_wrap/waiter_test_wrap.c
+++ b/third_party/cmocka/example/chef_wrap/waiter_test_wrap.c
@@ -60,7 +60,7 @@ int __wrap_chef_cook(const char *order, char **dish_out)
     bool knows_dish;
     char *dish;
 
-    check_expected(order);
+    check_expected_ptr(order);
 
     knows_dish = mock_type(bool);
     if (knows_dish == false) {
@@ -120,7 +120,7 @@ static void test_order_hotdog(void **state)
     will_return(__wrap_chef_cook, true);
     will_return(__wrap_chef_cook, true);
     /* The result will be a hotdog and the cooking process will succeed */
-    will_return(__wrap_chef_cook, "hotdog");
+    will_return(__wrap_chef_cook, cast_ptr_to_largest_integral_type("hotdog"));
     will_return(__wrap_chef_cook, 0);
 
     /* Test the waiter */
@@ -153,7 +153,7 @@ static void test_bad_dish(void **state)
      * We expect the waiter to handle the bad dish and return an error
      * code
      */
-    will_return(__wrap_chef_cook, "burger");
+    will_return(__wrap_chef_cook, cast_ptr_to_largest_integral_type("burger"));
     will_return(__wrap_chef_cook, 0);
 
     /* Test the waiter */
@@ -167,10 +167,10 @@ static void test_bad_dish(void **state)
 
 int main(void)
 {
-    const UnitTest tests[] = {
-        unit_test(test_order_hotdog),
-        unit_test(test_bad_dish),
+    const struct CMUnitTest tests[] = {
+        cmocka_unit_test(test_order_hotdog),
+        cmocka_unit_test(test_bad_dish),
     };
 
-    return run_tests(tests);
+    return cmocka_run_group_tests(tests, NULL, NULL);
 }
diff --git a/third_party/cmocka/example/customer_database_test.c b/third_party/cmocka/example/customer_database_test.c
index 33364d9..2f78b05 100644
--- a/third_party/cmocka/example/customer_database_test.c
+++ b/third_party/cmocka/example/customer_database_test.c
@@ -72,7 +72,8 @@ static void test_get_customer_id_by_name(void **state) {
 
     (void) state; /* unused */
 
-    will_return(mock_query_database, &customer_ids);
+    will_return(mock_query_database,
+                cast_ptr_to_largest_integral_type(&customer_ids));
     will_return(mock_query_database, 1);
 
     rc = get_customer_id_by_name(&connection, "john doe");
@@ -80,9 +81,9 @@ static void test_get_customer_id_by_name(void **state) {
 }
 
 int main(void) {
-    const UnitTest tests[] = {
-        unit_test(test_connect_to_customer_database),
-        unit_test(test_get_customer_id_by_name),
+    const struct CMUnitTest tests[] = {
+        cmocka_unit_test(test_connect_to_customer_database),
+        cmocka_unit_test(test_get_customer_id_by_name),
     };
-    return run_tests(tests);
+    return cmocka_run_group_tests(tests, NULL, NULL);
 }
diff --git a/third_party/cmocka/example/key_value_test.c b/third_party/cmocka/example/key_value_test.c
index da72ea2..102a2be 100644
--- a/third_party/cmocka/example/key_value_test.c
+++ b/third_party/cmocka/example/key_value_test.c
@@ -28,16 +28,20 @@ static KeyValue key_values[] = {
     { 13, "is" },
 };
 
-static void create_key_values(void **state) {
+static int create_key_values(void **state) {
     KeyValue * const items = (KeyValue*)test_malloc(sizeof(key_values));
     memcpy(items, key_values, sizeof(key_values));
     *state = (void*)items;
     set_key_values(items, sizeof(key_values) / sizeof(key_values[0]));
+
+    return 0;
 }
 
-static void destroy_key_values(void **state) {
+static int destroy_key_values(void **state) {
     test_free(*state);
     set_key_values(NULL, 0);
+
+    return 0;
 }
 
 static void test_find_item_by_value(void **state) {
@@ -63,11 +67,11 @@ static void test_sort_items_by_key(void **state) {
 }
 
 int main(void) {
-    const UnitTest tests[] = {
-        unit_test_setup_teardown(test_find_item_by_value, create_key_values,
-                                 destroy_key_values),
-        unit_test_setup_teardown(test_sort_items_by_key, create_key_values,
-                                 destroy_key_values),
+    const struct CMUnitTest tests[] = {
+        cmocka_unit_test_setup_teardown(test_find_item_by_value,
+                                        create_key_values, destroy_key_values),
+        cmocka_unit_test_setup_teardown(test_sort_items_by_key,
+                                        create_key_values, destroy_key_values),
     };
-    return run_tests(tests);
+    return cmocka_run_group_tests(tests, NULL, NULL);
 }
diff --git a/third_party/cmocka/example/product_database_test.c b/third_party/cmocka/example/product_database_test.c
index c8d7587..e09eeab 100644
--- a/third_party/cmocka/example/product_database_test.c
+++ b/third_party/cmocka/example/product_database_test.c
@@ -26,7 +26,7 @@ extern DatabaseConnection* connect_to_product_database(void);
  * that use the imaginary database.h module. */
 DatabaseConnection* connect_to_database(const char * const url,
                                         const unsigned int port) {
-    check_expected(url);
+    check_expected_ptr(url);
     check_expected(port);
     return (DatabaseConnection*)((size_t)mock());
 }
@@ -63,10 +63,10 @@ static void test_connect_to_product_database_missing_parameter(void **state) {
 }
 
 int main(void) {
-    const UnitTest tests[] = {
-        unit_test(test_connect_to_product_database),
-        unit_test(test_connect_to_product_database_bad_url),
-        unit_test(test_connect_to_product_database_missing_parameter),
+    const struct CMUnitTest tests[] = {
+        cmocka_unit_test(test_connect_to_product_database),
+        cmocka_unit_test(test_connect_to_product_database_bad_url),
+        cmocka_unit_test(test_connect_to_product_database_missing_parameter),
     };
-    return run_tests(tests);
+    return cmocka_run_group_tests(tests, NULL, NULL);
 }
diff --git a/third_party/cmocka/example/simple_test.c b/third_party/cmocka/example/simple_test.c
new file mode 100644
index 0000000..c6eee9c
--- /dev/null
+++ b/third_party/cmocka/example/simple_test.c
@@ -0,0 +1,17 @@
+#include <stdarg.h>
+#include <stddef.h>
+#include <setjmp.h>
+#include <cmocka.h>
+
+/* A test case that does nothing and succeeds. */
+static void null_test_success(void **state) {
+    (void) state; /* unused */
+}
+
+int main(void) {
+    const struct CMUnitTest tests[] = {
+        cmocka_unit_test(null_test_success),
+    };
+
+    return cmocka_run_group_tests(tests, NULL, NULL);
+}
diff --git a/third_party/cmocka/include/CMakeLists.txt b/third_party/cmocka/include/CMakeLists.txt
index 9172633..4cca031 100644
--- a/third_party/cmocka/include/CMakeLists.txt
+++ b/third_party/cmocka/include/CMakeLists.txt
@@ -2,6 +2,7 @@ project(cmocka-headers C)
 
 set(cmocka_HDRS
   cmocka.h
+  cmocka_pbc.h
 )
 
 install(
@@ -12,3 +13,15 @@ install(
   COMPONENT
     headers
 )
+
+if (WITH_CMOCKERY_SUPPORT)
+    install(
+      FILES
+        cmockery/cmockery.h
+        cmockery/pbc.h
+      DESTINATION
+        ${INCLUDE_INSTALL_DIR}/cmockery
+      COMPONENT
+        headers
+    )
+endif()
diff --git a/third_party/cmocka/include/cmocka.h b/third_party/cmocka/include/cmocka.h
index 0df2e90..797fbe2 100644
--- a/third_party/cmocka/include/cmocka.h
+++ b/third_party/cmocka/include/cmocka.h
@@ -17,69 +17,84 @@
 #define CMOCKA_H_
 
 #ifdef _WIN32
-#if _MSC_VER < 1500
-#ifdef __cplusplus
+# ifdef _MSC_VER
+
+#define __func__ __FUNCTION__
+
+# ifndef inline
+#define inline __inline
+# endif /* inline */
+
+#  if _MSC_VER < 1500
+#   ifdef __cplusplus
 extern "C" {
-#endif   /* __cplusplus */
+#   endif   /* __cplusplus */
 int __stdcall IsDebuggerPresent();
-#ifdef __cplusplus
+#   ifdef __cplusplus
 } /* extern "C" */
-#endif   /* __cplusplus */
-#endif  /* _MSC_VER < 1500 */
+#   endif   /* __cplusplus */
+#  endif  /* _MSC_VER < 1500 */
+# endif /* _MSC_VER */
 #endif  /* _WIN32 */
 
-/*
+/**
+ * @defgroup cmocka The CMocka API
+ *
  * These headers or their equivalents should be included prior to including
  * this header file.
- *
+ * @code
  * #include <stdarg.h>
  * #include <stddef.h>
  * #include <setjmp.h>
+ * @endcode
  *
  * This allows test applications to use custom definitions of C standard
  * library functions and types.
+ *
+ * @{
  */
 
-/* For those who are used to __func__ from gcc. */
-#ifndef __func__
-#define __func__ __FUNCTION__
+/* If __WORDSIZE is not set, try to figure it out and default to 32 bit. */
+#ifndef __WORDSIZE
+# if defined(__x86_64__) && !defined(__ILP32__)
+#  define __WORDSIZE 64
+# else
+#  define __WORDSIZE 32
+# endif
 #endif
 
-/* GCC have printf type attribute check.  */
-#ifdef __GNUC__
-#define PRINTF_ATTRIBUTE(a,b) __attribute__ ((__format__ (__printf__, a, b)))
-#else
-#define PRINTF_ATTRIBUTE(a,b)
-#endif /* __GNUC__ */
-
+#ifdef DOXYGEN
 /**
- * @defgroup cmocka The CMocka API
- *
- * TODO Describe cmocka.
- *
- * @{
- */
-
-/*
  * Largest integral type.  This type should be large enough to hold any
  * pointer or integer supported by the compiler.
  */
+typedef uintmax_t LargestIntegralType;
+#else /* DOXGEN */
 #ifndef LargestIntegralType
-#define LargestIntegralType unsigned long long
+# if __WORDSIZE == 64
+#  define LargestIntegralType unsigned long int
+# else
+#  define LargestIntegralType unsigned long long int
+# endif
 #endif /* LargestIntegralType */
+#endif /* DOXYGEN */
 
 /* Printf format used to display LargestIntegralType. */
 #ifndef LargestIntegralTypePrintfFormat
-#ifdef _WIN32
-#define LargestIntegralTypePrintfFormat "%I64x"
-#else
-#define LargestIntegralTypePrintfFormat "%llx"
-#endif /* _WIN32 */
+# ifdef _WIN32
+#  define LargestIntegralTypePrintfFormat "0x%I64x"
+# else
+#  if __WORDSIZE == 64
+#   define LargestIntegralTypePrintfFormat "%#lx"
+#  else
+#   define LargestIntegralTypePrintfFormat "%#llx"
+#  endif
+# endif /* _WIN32 */
 #endif /* LargestIntegralTypePrintfFormat */
 
 /* Perform an unsigned cast to LargestIntegralType. */
 #define cast_to_largest_integral_type(value) \
-    ((LargestIntegralType)((size_t)(value)))
+    ((LargestIntegralType)(value))
 
 /* Smallest integral type capable of holding a pointer. */
 #if !defined(_UINTPTR_T) && !defined(_UINTPTR_T_DEFINED)
@@ -112,12 +127,28 @@ int __stdcall IsDebuggerPresent();
 
 /* Perform an unsigned cast to uintptr_t. */
 #define cast_to_pointer_integral_type(value) \
-    ((uintptr_t)(value))
+    ((uintptr_t)((size_t)(value)))
 
-/* Perform a cast of a pointer to uintmax_t */
+/* Perform a cast of a pointer to LargestIntegralType */
 #define cast_ptr_to_largest_integral_type(value) \
 cast_to_largest_integral_type(cast_to_pointer_integral_type(value))
 
+/* GCC have printf type attribute check.  */
+#ifdef __GNUC__
+#define CMOCKA_PRINTF_ATTRIBUTE(a,b) \
+    __attribute__ ((__format__ (__printf__, a, b)))
+#else
+#define CMOCKA_PRINTF_ATTRIBUTE(a,b)
+#endif /* __GNUC__ */
+
+#if defined(__GNUC__)
+#define CMOCKA_DEPRECATED __attribute__ ((deprecated))
+#elif defined(_MSC_VER)
+#define CMOCKA_DEPRECATED __declspec(deprecated)
+#else
+#define CMOCKA_DEPRECATED
+#endif
+
 /**
  * @defgroup cmocka_mock Mock Objects
  * @ingroup cmocka
@@ -126,7 +157,7 @@ cast_to_largest_integral_type(cast_to_pointer_integral_type(value))
  * real objects. Instead of calling the real objects, the tested object calls a
  * mock object that merely asserts that the correct methods were called, with
  * the expected parameters, in the correct order.
- * 
+ *
  * <ul>
  * <li><strong>will_return(function, value)</strong> - The will_return() macro
  * pushes a value onto a stack of mock values. This macro is intended to be
@@ -174,7 +205,7 @@ cast_to_largest_integral_type(cast_to_pointer_integral_type(value))
  *
  * @see will_return()
  */
-void *mock(void);
+LargestIntegralType mock(void);
 #else
 #define mock() _mock(__func__, __FILE__, __LINE__)
 #endif
@@ -200,7 +231,7 @@ void *mock(void);
  * @see mock()
  * @see mock_ptr_type()
  */
-void *mock_type(#type);
+#type mock_type(#type);
 #else
 #define mock_type(type) ((type) mock())
 #endif
@@ -227,7 +258,7 @@ void *mock_type(#type);
  * @see mock()
  * @see mock_type()
  */
-void *mock_ptr_type(#type);
+type mock_ptr_type(#type);
 #else
 #define mock_ptr_type(type) ((type) (uintptr_t) mock())
 #endif
@@ -258,7 +289,7 @@ void *mock_ptr_type(#type);
  * @see mock()
  * @see will_return_count()
  */
-void will_return(#function, void *value);
+void will_return(#function, LargestIntegralType value);
 #else
 #define will_return(function, value) \
     _will_return(#function, __FILE__, __LINE__, \
@@ -279,7 +310,7 @@ void will_return(#function, void *value);
  *
  * @see mock()
  */
-void will_return_count(#function, void *value, int count);
+void will_return_count(#function, LargestIntegralType value, int count);
 #else
 #define will_return_count(function, value, count) \
     _will_return(#function, __FILE__, __LINE__, \
@@ -292,7 +323,7 @@ void will_return_count(#function, void *value, int count);
  *
  * @param[in]  #function  The function which should return the given value.
  *
- * @param[in]  value The value to be returned by mock().
+ * @param[in]  #value The value to be returned by mock().
  *
  * This is equivalent to:
  * @code
@@ -302,7 +333,7 @@ void will_return_count(#function, void *value, int count);
  * @see will_return_count()
  * @see mock()
  */
-void will_return_always(#function, void *value);
+void will_return_always(#function, LargestIntegralType value);
 #else
 #define will_return_always(function, value) \
     will_return_count(function, (value), -1)
@@ -368,10 +399,10 @@ void will_return_always(#function, void *value);
  * by this function. If the parameter is provided it must be allocated on the
  * heap and doesn't need to be deallocated by the caller.
  *
- * @param[in]  #function  The fuction to add a custom paramater checking function
- *                        for.
+ * @param[in]  #function  The function to add a custom parameter checking
+ *                        function for.
  *
- * @param[in]  #parameter The parametes passed to the function.
+ * @param[in]  #parameter The parameters passed to the function.
  *
  * @param[in]  #check_function  The check function to call.
  *
@@ -381,10 +412,10 @@ void expect_check(#function, #parameter, #check_function, const void *check_data
 #else
 #define expect_check(function, parameter, check_function, check_data) \
     _expect_check(#function, #parameter, __FILE__, __LINE__, check_function, \
-                  cast_to_largest_integral_type(check_data), NULL, 0)
+                  cast_to_largest_integral_type(check_data), NULL, 1)
 #endif
 
-#if DOXYGEN
+#ifdef DOXYGEN
 /**
  * @brief Add an event to check if the parameter value is part of the provided
  *        array.
@@ -399,13 +430,13 @@ void expect_check(#function, #parameter, #check_function, const void *check_data
  *
  * @see check_expected().
  */
-void expect_in_set(#function, #parameter, uintmax_t value_array[]);
+void expect_in_set(#function, #parameter, LargestIntegralType value_array[]);
 #else
 #define expect_in_set(function, parameter, value_array) \
     expect_in_set_count(function, parameter, value_array, 1)
 #endif
 
-#if DOXYGEN
+#ifdef DOXYGEN
 /**
  * @brief Add an event to check if the parameter value is part of the provided
  *        array.
@@ -424,14 +455,14 @@ void expect_in_set(#function, #parameter, uintmax_t value_array[]);
  *
  * @see check_expected().
  */
-void expect_in_set_count(#function, #parameter, uintmax_t value_array[], size_t count);
+void expect_in_set_count(#function, #parameter, LargestIntegralType value_array[], size_t count);
 #else
 #define expect_in_set_count(function, parameter, value_array, count) \
     _expect_in_set(#function, #parameter, __FILE__, __LINE__, value_array, \
                    sizeof(value_array) / sizeof((value_array)[0]), count)
 #endif
 
-#if DOXYGEN
+#ifdef DOXYGEN
 /**
  * @brief Add an event to check if the parameter value is not part of the
  *        provided array.
@@ -446,13 +477,13 @@ void expect_in_set_count(#function, #parameter, uintmax_t value_array[], size_t
  *
  * @see check_expected().
  */
-void expect_not_in_set(#function, #parameter, uintmax_t value_array[]);
+void expect_not_in_set(#function, #parameter, LargestIntegralType value_array[]);
 #else
 #define expect_not_in_set(function, parameter, value_array) \
     expect_not_in_set_count(function, parameter, value_array, 1)
 #endif
 
-#if DOXYGEN
+#ifdef DOXYGEN
 /**
  * @brief Add an event to check if the parameter value is not part of the
  *        provided array.
@@ -471,7 +502,7 @@ void expect_not_in_set(#function, #parameter, uintmax_t value_array[]);
  *
  * @see check_expected().
  */
-void expect_not_in_set_count(#function, #parameter, uintmax_t value_array[], size_t count);
+void expect_not_in_set_count(#function, #parameter, LargestIntegralType value_array[], size_t count);
 #else
 #define expect_not_in_set_count(function, parameter, value_array, count) \
     _expect_not_in_set( \
@@ -480,7 +511,7 @@ void expect_not_in_set_count(#function, #parameter, uintmax_t value_array[], siz
 #endif
 
 
-#if DOXYGEN
+#ifdef DOXYGEN
 /**
  * @brief Add an event to check a parameter is inside a numerical range.
  * The check would succeed if minimum <= value <= maximum.
@@ -497,13 +528,13 @@ void expect_not_in_set_count(#function, #parameter, uintmax_t value_array[], siz
  *
  * @see check_expected().
  */
-void expect_in_range(#function, #parameter, uintmax_t minimum, uintmax_t maximum);
+void expect_in_range(#function, #parameter, LargestIntegralType minimum, LargestIntegralType maximum);
 #else
 #define expect_in_range(function, parameter, minimum, maximum) \
     expect_in_range_count(function, parameter, minimum, maximum, 1)
 #endif
 
-#if DOXYGEN
+#ifdef DOXYGEN
 /**
  * @brief Add an event to repeatedly check a parameter is inside a
  * numerical range. The check would succeed if minimum <= value <= maximum.
@@ -524,14 +555,14 @@ void expect_in_range(#function, #parameter, uintmax_t minimum, uintmax_t maximum
  *
  * @see check_expected().
  */
-void expect_in_range_count(#function, #parameter, uintmax_t minimum, uintmax_t maximum, size_t count);
+void expect_in_range_count(#function, #parameter, LargestIntegralType minimum, LargestIntegralType maximum, size_t count);
 #else
 #define expect_in_range_count(function, parameter, minimum, maximum, count) \
     _expect_in_range(#function, #parameter, __FILE__, __LINE__, minimum, \
                      maximum, count)
 #endif
 
-#if DOXYGEN
+#ifdef DOXYGEN
 /**
  * @brief Add an event to check a parameter is outside a numerical range.
  * The check would succeed if minimum > value > maximum.
@@ -548,13 +579,13 @@ void expect_in_range_count(#function, #parameter, uintmax_t minimum, uintmax_t m
  *
  * @see check_expected().
  */
-void expect_not_in_range(#function, #parameter, uintmax_t minimum, uintmax_t maximum);
+void expect_not_in_range(#function, #parameter, LargestIntegralType minimum, LargestIntegralType maximum);
 #else
 #define expect_not_in_range(function, parameter, minimum, maximum) \
     expect_not_in_range_count(function, parameter, minimum, maximum, 1)
 #endif
 
-#if DOXYGEN
+#ifdef DOXYGEN
 /**
  * @brief Add an event to repeatedly check a parameter is outside a
  * numerical range. The check would succeed if minimum > value > maximum.
@@ -575,7 +606,7 @@ void expect_not_in_range(#function, #parameter, uintmax_t minimum, uintmax_t max
  *
  * @see check_expected().
  */
-void expect_not_in_range_count(#function, #parameter, uintmax_t minimum, uintmax_t maximum, size_t count);
+void expect_not_in_range_count(#function, #parameter, LargestIntegralType minimum, LargestIntegralType maximum, size_t count);
 #else
 #define expect_not_in_range_count(function, parameter, minimum, maximum, \
                                   count) \
@@ -583,7 +614,7 @@ void expect_not_in_range_count(#function, #parameter, uintmax_t minimum, uintmax
                          minimum, maximum, count)
 #endif
 
-#if DOXYGEN
+#ifdef DOXYGEN
 /**
  * @brief Add an event to check if a parameter is the given value.
  *
@@ -597,13 +628,13 @@ void expect_not_in_range_count(#function, #parameter, uintmax_t minimum, uintmax
  *
  * @see check_expected().
  */
-void expect_value(#function, #parameter, uintmax_t value);
+void expect_value(#function, #parameter, LargestIntegralType value);
 #else
 #define expect_value(function, parameter, value) \
     expect_value_count(function, parameter, value, 1)
 #endif
 
-#if DOXYGEN
+#ifdef DOXYGEN
 /**
  * @brief Add an event to repeatedly check if a parameter is the given value.
  *
@@ -621,14 +652,14 @@ void expect_value(#function, #parameter, uintmax_t value);
  *
  * @see check_expected().
  */
-void expect_value_count(#function, #parameter, uintmax_t value, size_t count);
+void expect_value_count(#function, #parameter, LargestIntegralType value, size_t count);
 #else
 #define expect_value_count(function, parameter, value, count) \
     _expect_value(#function, #parameter, __FILE__, __LINE__, \
                   cast_to_largest_integral_type(value), count)
 #endif
 
-#if DOXYGEN
+#ifdef DOXYGEN
 /**
  * @brief Add an event to check if a parameter isn't the given value.
  *
@@ -642,13 +673,13 @@ void expect_value_count(#function, #parameter, uintmax_t value, size_t count);
  *
  * @see check_expected().
  */
-void expect_not_value(#function, #parameter, uintmax_t value);
+void expect_not_value(#function, #parameter, LargestIntegralType value);
 #else
 #define expect_not_value(function, parameter, value) \
     expect_not_value_count(function, parameter, value, 1)
 #endif
 
-#if DOXYGEN
+#ifdef DOXYGEN
 /**
  * @brief Add an event to repeatedly check if a parameter isn't the given value.
  *
@@ -666,14 +697,14 @@ void expect_not_value(#function, #parameter, uintmax_t value);
  *
  * @see check_expected().
  */
-void expect_not_value_count(#function, #parameter, uintmax_t value, size_t count);
+void expect_not_value_count(#function, #parameter, LargestIntegralType value, size_t count);
 #else
 #define expect_not_value_count(function, parameter, value, count) \
     _expect_not_value(#function, #parameter, __FILE__, __LINE__, \
                       cast_to_largest_integral_type(value), count)
 #endif
 
-#if DOXYGEN
+#ifdef DOXYGEN
 /**
  * @brief Add an event to check if the parameter value is equal to the
  *        provided string.
@@ -694,7 +725,7 @@ void expect_string(#function, #parameter, const char *string);
     expect_string_count(function, parameter, string, 1)
 #endif
 
-#if DOXYGEN
+#ifdef DOXYGEN
 /**
  * @brief Add an event to check if the parameter value is equal to the
  *        provided string.
@@ -720,7 +751,7 @@ void expect_string_count(#function, #parameter, const char *string, size_t count
                    (const char*)(string), count)
 #endif
 
-#if DOXYGEN
+#ifdef DOXYGEN
 /**
  * @brief Add an event to check if the parameter value isn't equal to the
  *        provided string.
@@ -741,7 +772,7 @@ void expect_not_string(#function, #parameter, const char *string);
     expect_not_string_count(function, parameter, string, 1)
 #endif
 
-#if DOXYGEN
+#ifdef DOXYGEN
 /**
  * @brief Add an event to check if the parameter value isn't equal to the
  *        provided string.
@@ -767,7 +798,7 @@ void expect_not_string_count(#function, #parameter, const char *string, size_t c
                        (const char*)(string), count)
 #endif
 
-#if DOXYGEN
+#ifdef DOXYGEN
 /**
  * @brief Add an event to check if the parameter does match an area of memory.
  *
@@ -789,7 +820,7 @@ void expect_memory(#function, #parameter, void *memory, size_t size);
     expect_memory_count(function, parameter, memory, size, 1)
 #endif
 
-#if DOXYGEN
+#ifdef DOXYGEN
 /**
  * @brief Add an event to repeatedly check if the parameter does match an area
  *        of memory.
@@ -817,7 +848,7 @@ void expect_memory_count(#function, #parameter, void *memory, size_t size, size_
                    (const void*)(memory), size, count)
 #endif
 
-#if DOXYGEN
+#ifdef DOXYGEN
 /**
  * @brief Add an event to check if the parameter doesn't match an area of
  *        memory.
@@ -840,7 +871,7 @@ void expect_not_memory(#function, #parameter, void *memory, size_t size);
     expect_not_memory_count(function, parameter, memory, size, 1)
 #endif
 
-#if DOXYGEN
+#ifdef DOXYGEN
 /**
  * @brief Add an event to repeatedly check if the parameter doesn't match an
  *        area of memory.
@@ -869,7 +900,7 @@ void expect_not_memory_count(#function, #parameter, void *memory, size_t size, s
 #endif
 
 
-#if DOXYGEN
+#ifdef DOXYGEN
 /**
  * @brief Add an event to check if a parameter (of any value) has been passed.
  *
@@ -887,7 +918,7 @@ void expect_any(#function, #parameter);
     expect_any_count(function, parameter, 1)
 #endif
 
-#if DOXYGEN
+#ifdef DOXYGEN
 /**
  * @brief Add an event to repeatedly check if a parameter (of any value) has
  *        been passed.
@@ -910,7 +941,7 @@ void expect_any_count(#function, #parameter, size_t count);
     _expect_any(#function, #parameter, __FILE__, __LINE__, count)
 #endif
 
-#if DOXYGEN
+#ifdef DOXYGEN
 /**
  * @brief Determine whether a function parameter is correct.
  *
@@ -928,6 +959,24 @@ void check_expected(#parameter);
                     cast_to_largest_integral_type(parameter))
 #endif
 
+#ifdef DOXYGEN
+/**
+ * @brief Determine whether a function parameter is correct.
+ *
+ * This ensures the next value queued by one of the expect_*() macros matches
+ * the specified variable.
+ *
+ * This function needs to be called in the mock object.
+ *
+ * @param[in]  #parameter  The pointer to check.
+ */
+void check_expected_ptr(#parameter);
+#else
+#define check_expected_ptr(parameter) \
+    _check_expected(__func__, #parameter, __FILE__, __LINE__, \
+                    cast_ptr_to_largest_integral_type(parameter))
+#endif
+
 /** @} */
 
 /**
@@ -988,6 +1037,28 @@ void assert_false(scalar expression);
 
 #ifdef DOXYGEN
 /**
+ * @brief Assert that the return_code is greater than or equal to 0.
+ *
+ * The function prints an error message to standard error and terminates the
+ * test by calling fail() if the return code is smaller than 0. If the function
+ * you check sets an errno if it fails you can pass it to the function and
+ * it will be printed as part of the error message.
+ *
+ * @param[in]  rc       The return code to evaluate.
+ *
+ * @param[in]  error    Pass errno here or 0.
+ */
+void assert_return_code(int rc, int error);
+#else
+#define assert_return_code(rc, error) \
+    _assert_return_code(cast_to_largest_integral_type(rc), \
+                        sizeof(rc), \
+                        cast_to_largest_integral_type(error), \
+                        #rc, __FILE__, __LINE__)
+#endif
+
+#ifdef DOXYGEN
+/**
  * @brief Assert that the given pointer is non-NULL.
  *
  * The function prints an error message to standard error and terminates the
@@ -1022,6 +1093,44 @@ __FILE__, __LINE__)
 
 #ifdef DOXYGEN
 /**
+ * @brief Assert that the two given pointers are equal.
+ *
+ * The function prints an error message and terminates the test by calling
+ * fail() if the pointers are not equal.
+ *
+ * @param[in]  a        The first pointer to compare.
+ *
+ * @param[in]  b        The pointer to compare against the first one.
+ */
+void assert_ptr_equal(void *a, void *b);
+#else
+#define assert_ptr_equal(a, b) \
+    _assert_int_equal(cast_ptr_to_largest_integral_type(a), \
+                      cast_ptr_to_largest_integral_type(b), \
+                      __FILE__, __LINE__)
+#endif
+
+#ifdef DOXYGEN
+/**
+ * @brief Assert that the two given pointers are not equal.
+ *
+ * The function prints an error message and terminates the test by calling
+ * fail() if the pointers are equal.
+ *
+ * @param[in]  a        The first pointer to compare.
+ *
+ * @param[in]  b        The pointer to compare against the first one.
+ */
+void assert_ptr_not_equal(void *a, void *b);
+#else
+#define assert_ptr_not_equal(a, b) \
+    _assert_int_not_equal(cast_ptr_to_largest_integral_type(a), \
+                          cast_ptr_to_largest_integral_type(b), \
+                          __FILE__, __LINE__)
+#endif
+
+#ifdef DOXYGEN
+/**
  * @brief Assert that the two given integers are equal.
  *
  * The function prints an error message to standard error and terminates the
@@ -1142,8 +1251,8 @@ void assert_memory_not_equal(const void *a, const void *b, size_t size);
 
 #ifdef DOXYGEN
 /**
- * @brief Assert that the specified value is bigger than the minimum and
- * smaller than the maximum.
+ * @brief Assert that the specified value is not smaller than the minimum
+ * and and not greater than the maximum.
  *
  * The function prints an error message to standard error and terminates the
  * test by calling fail() if value is not in range.
@@ -1154,7 +1263,7 @@ void assert_memory_not_equal(const void *a, const void *b, size_t size);
  *
  * @param[in]  maximum  The maximum value allowed.
  */
-void assert_in_range(uintmax_t value, uintmax_t minimum, uintmax_t maximum);
+void assert_in_range(LargestIntegralType value, LargestIntegralType minimum, LargestIntegralType maximum);
 #else
 #define assert_in_range(value, minimum, maximum) \
     _assert_in_range( \
@@ -1165,8 +1274,8 @@ void assert_in_range(uintmax_t value, uintmax_t minimum, uintmax_t maximum);
 
 #ifdef DOXYGEN
 /**
- * @brief Assert that the specified value is smaller than the minimum and
- * bigger than the maximum.
+ * @brief Assert that the specified value is smaller than the minimum or
+ * greater than the maximum.
  *
  * The function prints an error message to standard error and terminates the
  * test by calling fail() if value is in range.
@@ -1177,7 +1286,7 @@ void assert_in_range(uintmax_t value, uintmax_t minimum, uintmax_t maximum);
  *
  * @param[in]  maximum  The maximum value to compare.
  */
-void assert_not_in_range(uintmax_t value, uintmax_t minimum, uintmax_t maximum);
+void assert_not_in_range(LargestIntegralType value, LargestIntegralType minimum, LargestIntegralType maximum);
 #else
 #define assert_not_in_range(value, minimum, maximum) \
     _assert_not_in_range( \
@@ -1199,7 +1308,7 @@ void assert_not_in_range(uintmax_t value, uintmax_t minimum, uintmax_t maximum);
  *
  * @param[in]  count  The size of the values array.
  */
-void assert_in_set(uintmax_t value, uintmax_t values[], size_t count);
+void assert_in_set(LargestIntegralType value, LargestIntegralType values[], size_t count);
 #else
 #define assert_in_set(value, values, number_of_values) \
     _assert_in_set(value, values, number_of_values, __FILE__, __LINE__)
@@ -1218,7 +1327,7 @@ void assert_in_set(uintmax_t value, uintmax_t values[], size_t count);
  *
  * @param[in]  count  The size of the values array.
  */
-void assert_not_in_set(uintmax_t value, uintmax_t values[], size_t count);
+void assert_not_in_set(LargestIntegralType value, LargestIntegralType values[], size_t count);
 #else
 #define assert_not_in_set(value, values, number_of_values) \
     _assert_not_in_set(value, values, number_of_values, __FILE__, __LINE__)
@@ -1240,12 +1349,12 @@ void assert_not_in_set(uintmax_t value, uintmax_t values[], size_t count);
  *
  * int main(void)
  * {
- *     const UnitTest tests[] = {
- *         unit_test(Test0),
- *         unit_test(Test1),
+ *     const struct CMUnitTest tests[] = {
+ *         cmocka_unit_test(Test0),
+ *         cmocka_unit_test(Test1),
  *     };
  *
- *     return run_tests(tests);
+ *     return cmocka_run_group_tests(tests, NULL, NULL);
  * }
  * @endcode
  *
@@ -1263,7 +1372,27 @@ void fail(void);
 
 #ifdef DOXYGEN
 /**
+ * @brief Forces the test to not be executed, but marked as skipped
+ */
+void skip(void);
+#else
+#define skip() _skip(__FILE__, __LINE__)
+#endif
+
+#ifdef DOXYGEN
+/**
  * @brief Forces the test to fail immediately and quit, printing the reason.
+ *
+ * @code
+ * fail_msg("This is some error message for test");
+ * @endcode
+ *
+ * or
+ *
+ * @code
+ * char *error_msg = "This is some error message for test";
+ * fail_msg("%s", error_msg);
+ * @endcode
  */
 void fail_msg(const char *msg, ...);
 #else
@@ -1277,6 +1406,8 @@ void fail_msg(const char *msg, ...);
 /**
  * @brief Generic method to run a single test.
  *
+ * @deprecated This function was deprecated in favor of cmocka_run_group_tests
+ *
  * @param[in]  #function The function to test.
  *
  * @return 0 on success, 1 if an error occured.
@@ -1296,54 +1427,184 @@ int run_test(#function);
 #define run_test(f) _run_test(#f, f, NULL, UNIT_TEST_FUNCTION_TYPE_TEST, NULL)
 #endif
 
-/** Initializes a UnitTest structure. */
+static inline void _unit_test_dummy(void **state) {
+    (void)state;
+}
+
+/** Initializes a UnitTest structure.
+ *
+ * @deprecated This function was deprecated in favor of cmocka_unit_test
+ */
 #define unit_test(f) { #f, f, UNIT_TEST_FUNCTION_TYPE_TEST }
 
 #define _unit_test_setup(test, setup) \
     { #test "_" #setup, setup, UNIT_TEST_FUNCTION_TYPE_SETUP }
 
-/** Initializes a UnitTest structure with a setup function. */
+/** Initializes a UnitTest structure with a setup function.
+ *
+ * @deprecated This function was deprecated in favor of cmocka_unit_test_setup
+ */
 #define unit_test_setup(test, setup) \
     _unit_test_setup(test, setup), \
-    unit_test(test)
+    unit_test(test), \
+    _unit_test_teardown(test, _unit_test_dummy)
 
 #define _unit_test_teardown(test, teardown) \
     { #test "_" #teardown, teardown, UNIT_TEST_FUNCTION_TYPE_TEARDOWN }
 
-/** Initializes a UnitTest structure with a teardown function. */
+/** Initializes a UnitTest structure with a teardown function.
+ *
+ * @deprecated This function was deprecated in favor of cmocka_unit_test_teardown
+ */
 #define unit_test_teardown(test, teardown) \
+    _unit_test_setup(test, _unit_test_dummy), \
     unit_test(test), \
     _unit_test_teardown(test, teardown)
 
+/** Initializes a UnitTest structure for a group setup function.
+ *
+ * @deprecated This function was deprecated in favor of cmocka_run_group_tests
+ */
+#define group_test_setup(setup) \
+    { "group_" #setup, setup, UNIT_TEST_FUNCTION_TYPE_GROUP_SETUP }
+
+/** Initializes a UnitTest structure for a group teardown function.
+ *
+ * @deprecated This function was deprecated in favor of cmocka_run_group_tests
+ */
+#define group_test_teardown(teardown) \
+    { "group_" #teardown, teardown, UNIT_TEST_FUNCTION_TYPE_GROUP_TEARDOWN }
+
 /**
  * Initialize an array of UnitTest structures with a setup function for a test
  * and a teardown function.  Either setup or teardown can be NULL.
+ *
+ * @deprecated This function was deprecated in favor of
+ * cmocka_unit_test_setup_teardown
  */
 #define unit_test_setup_teardown(test, setup, teardown) \
     _unit_test_setup(test, setup), \
     unit_test(test), \
     _unit_test_teardown(test, teardown)
 
+
+/** Initializes a CMUnitTest structure. */
+#define cmocka_unit_test(f) { #f, f, NULL, NULL }
+
+/** Initializes a CMUnitTest structure with a setup function. */
+#define cmocka_unit_test_setup(f, setup) { #f, f, setup, NULL }
+
+/** Initializes a CMUnitTest structure with a teardown function. */
+#define cmocka_unit_test_teardown(f, teardown) { #f, f, NULL, teardown }
+
+/**
+ * Initialize an array of CMUnitTest structures with a setup function for a test
+ * and a teardown function. Either setup or teardown can be NULL.
+ */
+#define cmocka_unit_test_setup_teardown(f, setup, teardown) { #f, f, setup, teardown }
+
+#define run_tests(tests) _run_tests(tests, sizeof(tests) / sizeof(tests)[0])
+#define run_group_tests(tests) _run_group_tests(tests, sizeof(tests) / sizeof(tests)[0])
+
 #ifdef DOXYGEN
 /**
- * @brief Run tests specified by an array of UnitTest structures.
+ * @brief Run tests specified by an array of CMUnitTest structures.
  *
- * @param[in]  tests[] The array of unit tests to execute.
+ * @param[in]  group_tests[]  The array of unit tests to execute.
  *
- * @return 0 on success, 1 if an error occured.
+ * @param[in]  group_setup    The setup function which should be called before
+ *                            all unit tests are executed.
+ *
+ * @param[in]  group_teardown The teardown function to be called after all
+ *                            tests have finished.
+ *
+ * @return 0 on success, or the number of failed tests.
  *
  * @code
- * static void setup(void **state) {
+ * static int setup(void **state) {
  *      int *answer = malloc(sizeof(int));
- *      assert_non_null(answer);
+ *      if (*answer == NULL) {
+ *          return -1;
+ *      }
+ *      *answer = 42;
+ *
+ *      *state = answer;
+ *
+ *      return 0;
+ * }
  *
+ * static int teardown(void **state) {
+ *      free(*state);
+ *
+ *      return 0;
+ * }
+ *
+ * static void null_test_success(void **state) {
+ *     (void) state;
+ * }
+ *
+ * static void int_test_success(void **state) {
+ *      int *answer = *state;
+ *      assert_int_equal(*answer, 42);
+ * }
+ *
+ * int main(void) {
+ *     const struct CMUnitTest tests[] = {
+ *         cmocka_unit_test(null_test_success),
+ *         cmocka_unit_test_setup_teardown(int_test_success, setup, teardown),
+ *     };
+ *
+ *     return cmocka_run_group_tests(tests, NULL, NULL);
+ * }
+ * @endcode
+ *
+ * @see cmocka_unit_test
+ * @see cmocka_unit_test_setup
+ * @see cmocka_unit_test_teardown
+ * @see cmocka_unit_test_setup_teardown
+ */
+int cmocka_run_group_tests(const struct CMUnitTest group_tests[],
+                           CMFixtureFunction group_setup,
+                           CMFixtureFunction group_teardown);
+#else
+# define cmocka_run_group_tests(group_tests, group_setup, group_teardown) \
+        _cmocka_run_group_tests(#group_tests, group_tests, sizeof(group_tests) / sizeof(group_tests)[0], group_setup, group_teardown)
+#endif
+
+#ifdef DOXYGEN
+/**
+ * @brief Run tests specified by an array of CMUnitTest structures and specify
+ *        a name.
+ *
+ * @param[in]  group_name     The name of the group test.
+ *
+ * @param[in]  group_tests[]  The array of unit tests to execute.
+ *
+ * @param[in]  group_setup    The setup function which should be called before
+ *                            all unit tests are executed.
+ *
+ * @param[in]  group_teardown The teardown function to be called after all
+ *                            tests have finished.
+ *
+ * @return 0 on success, or the number of failed tests.
+ *
+ * @code
+ * static int setup(void **state) {
+ *      int *answer = malloc(sizeof(int));
+ *      if (*answer == NULL) {
+ *          return -1;
+ *      }
  *      *answer = 42;
  *
  *      *state = answer;
+ *
+ *      return 0;
  * }
  *
- * static void teardown(void **state) {
+ * static int teardown(void **state) {
  *      free(*state);
+ *
+ *      return 0;
  * }
  *
  * static void null_test_success(void **state) {
@@ -1356,23 +1617,27 @@ int run_test(#function);
  * }
  *
  * int main(void) {
- *     const UnitTest tests[] = {
- *         unit_test(null_test_success),
- *         unit_test_setup_teardown(int_test_success, setup, teardown),
+ *     const struct CMUnitTest tests[] = {
+ *         cmocka_unit_test(null_test_success),
+ *         cmocka_unit_test_setup_teardown(int_test_success, setup, teardown),
  *     };
  *
- *     return run_tests(tests);
+ *     return cmocka_run_group_tests_name("success_test", tests, NULL, NULL);
  * }
  * @endcode
  *
- * @see unit_test
- * @see unit_test_setup
- * @see unit_test_teardown
- * @see unit_test_setup_teardown
+ * @see cmocka_unit_test
+ * @see cmocka_unit_test_setup
+ * @see cmocka_unit_test_teardown
+ * @see cmocka_unit_test_setup_teardown
  */
-int run_tests(const UnitTest tests[]);
+int cmocka_run_group_tests_name(const char *group_name,
+                                const struct CMUnitTest group_tests[],
+                                CMFixtureFunction group_setup,
+                                CMFixtureFunction group_teardown);
 #else
-#define run_tests(tests) _run_tests(tests, sizeof(tests) / sizeof(tests)[0])
+# define cmocka_run_group_tests_name(group_name, group_tests, group_setup, group_teardown) \
+        _cmocka_run_group_tests(group_name, group_tests, sizeof(group_tests) / sizeof(group_tests)[0], group_setup, group_teardown)
 #endif
 
 /** @} */
@@ -1409,7 +1674,7 @@ int run_tests(const UnitTest tests[]);
  * @return A pointer to the allocated memory or NULL on error.
  *
  * @code
- * #if UNIT_TESTING
+ * #ifdef UNIT_TESTING
  * extern void* _test_malloc(const size_t size, const char* file, const int line);
  *
  * #define malloc(size) _test_malloc(size, __FILE__, __LINE__)
@@ -1449,6 +1714,22 @@ void *test_calloc(size_t nmemb, size_t size);
 
 #ifdef DOXYGEN
 /**
+ * @brief Test function overriding realloc which detects buffer overruns
+ *        and memoery leaks.
+ *
+ * @param[in]  ptr   The memory block which should be changed.
+ *
+ * @param[in]  size  The bytes which should be allocated.
+ *
+ * @return           The newly allocated memory block, NULL on error.
+ */
+void *test_realloc(void *ptr, size_t size);
+#else
+#define test_realloc(ptr, size) _test_realloc(ptr, size, __FILE__, __LINE__)
+#endif
+
+#ifdef DOXYGEN
+/**
  * @brief Test function overriding free(3).
  *
  * @param[in]  ptr  The pointer to the memory space to free.
@@ -1461,8 +1742,9 @@ void test_free(void *ptr);
 #endif
 
 /* Redirect malloc, calloc and free to the unit test allocators. */
-#if UNIT_TESTING
+#ifdef UNIT_TESTING
 #define malloc test_malloc
+#define realloc test_realloc
 #define calloc test_calloc
 #define free test_free
 #endif /* UNIT_TESTING */
@@ -1502,7 +1784,7 @@ void test_free(void *ptr);
  * @param[in]  line  The line mock_assert() is called.
  *
  * @code
- * #if UNIT_TESTING
+ * #ifdef UNIT_TESTING
  * extern void mock_assert(const int result, const char* const expression,
  *                         const char * const file, const int line);
  *
@@ -1579,6 +1861,8 @@ typedef enum UnitTestFunctionType {
     UNIT_TEST_FUNCTION_TYPE_TEST = 0,
     UNIT_TEST_FUNCTION_TYPE_SETUP,
     UNIT_TEST_FUNCTION_TYPE_TEARDOWN,
+    UNIT_TEST_FUNCTION_TYPE_GROUP_SETUP,
+    UNIT_TEST_FUNCTION_TYPE_GROUP_TEARDOWN,
 } UnitTestFunctionType;
 
 /*
@@ -1592,6 +1876,25 @@ typedef struct UnitTest {
     UnitTestFunctionType function_type;
 } UnitTest;
 
+typedef struct GroupTest {
+    UnitTestFunction setup;
+    UnitTestFunction teardown;
+    const UnitTest *tests;
+    const size_t number_of_tests;
+} GroupTest;
+
+/* Function prototype for test functions. */
+typedef void (*CMUnitTestFunction)(void **state);
+
+/* Function prototype for setup and teardown functions. */
+typedef int (*CMFixtureFunction)(void **state);
+
+struct CMUnitTest {
+    const char *name;
+    CMUnitTestFunction test_func;
+    CMFixtureFunction setup_func;
+    CMFixtureFunction teardown_func;
+};
 
 /* Location within some source code. */
 typedef struct SourceLocation {
@@ -1684,6 +1987,12 @@ void _will_return(const char * const function_name, const char * const file,
 void _assert_true(const LargestIntegralType result,
                   const char* const expression,
                   const char * const file, const int line);
+void _assert_return_code(const LargestIntegralType result,
+                         size_t rlen,
+                         const LargestIntegralType error,
+                         const char * const expression,
+                         const char * const file,
+                         const int line);
 void _assert_int_equal(
     const LargestIntegralType a, const LargestIntegralType b,
     const char * const file, const int line);
@@ -1714,22 +2023,56 @@ void _assert_not_in_set(
     const size_t number_of_values, const char* const file, const int line);
 
 void* _test_malloc(const size_t size, const char* file, const int line);
+void* _test_realloc(void *ptr, const size_t size, const char* file, const int line);
 void* _test_calloc(const size_t number_of_elements, const size_t size,
                    const char* file, const int line);
 void _test_free(void* const ptr, const char* file, const int line);
 
 void _fail(const char * const file, const int line);
+
+void _skip(const char * const file, const int line);
+
 int _run_test(
     const char * const function_name, const UnitTestFunction Function,
     void ** const volatile state, const UnitTestFunctionType function_type,
     const void* const heap_check_point);
-int _run_tests(const UnitTest * const tests, const size_t number_of_tests);
+CMOCKA_DEPRECATED int _run_tests(const UnitTest * const tests,
+                                 const size_t number_of_tests);
+CMOCKA_DEPRECATED int _run_group_tests(const UnitTest * const tests,
+                                       const size_t number_of_tests);
+
+/* Test runner */
+int _cmocka_run_group_tests(const char *group_name,
+                            const struct CMUnitTest * const tests,
+                            const size_t num_tests,
+                            CMFixtureFunction group_setup,
+                            CMFixtureFunction group_teardown);
 
 /* Standard output and error print methods. */
-void print_message(const char* const format, ...) PRINTF_ATTRIBUTE(1, 2);
-void print_error(const char* const format, ...) PRINTF_ATTRIBUTE(1, 2);
-void vprint_message(const char* const format, va_list args) PRINTF_ATTRIBUTE(1, 0);
-void vprint_error(const char* const format, va_list args) PRINTF_ATTRIBUTE(1, 0);
+void print_message(const char* const format, ...) CMOCKA_PRINTF_ATTRIBUTE(1, 2);
+void print_error(const char* const format, ...) CMOCKA_PRINTF_ATTRIBUTE(1, 2);
+void vprint_message(const char* const format, va_list args) CMOCKA_PRINTF_ATTRIBUTE(1, 0);
+void vprint_error(const char* const format, va_list args) CMOCKA_PRINTF_ATTRIBUTE(1, 0);
+
+enum cm_message_output {
+    CM_OUTPUT_STDOUT,
+    CM_OUTPUT_SUBUNIT,
+    CM_OUTPUT_TAP,
+    CM_OUTPUT_XML,
+};
+
+/**
+ * @brief Function to set the output format for a test.
+ *
+ * The ouput format for the test can either be set globally using this
+ * function or overriden with environment variable CMOCKA_MESSAGE_OUTPUT.
+ *
+ * The environment variable can be set to either STDOUT, SUBUNIT, TAP or XML.
+ *
+ * @param[in] output    The output format to use for the test.
+ *
+ */
+void cmocka_set_message_output(enum cm_message_output output);
 
 /** @} */
 
diff --git a/third_party/cmocka/include/cmocka_pbc.h b/third_party/cmocka/include/cmocka_pbc.h
new file mode 100644
index 0000000..a2a1bc1
--- /dev/null
+++ b/third_party/cmocka/include/cmocka_pbc.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2014 Luis Pabon, Jr.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Programming by Contract is a programming methodology
+ * which binds the caller and the function called to a
+ * contract. The contract is represented using Hoare Triple:
+ *      {P} C {Q}
+ * where {P} is the precondition before executing command C,
+ * and {Q} is the postcondition.
+ *
+ * See also:
+ * http://en.wikipedia.org/wiki/Design_by_contract
+ * http://en.wikipedia.org/wiki/Hoare_logic
+ * http://dlang.org/dbc.html
+ */
+#ifndef CMOCKA_PBC_H_
+#define CMOCKA_PBC_H_
+
+#if defined(UNIT_TESTING) || defined (DEBUG)
+
+#include <assert.h>
+
+/*
+ * Checks caller responsibility against contract
+ */
+#define REQUIRE(cond) assert(cond)
+
+/*
+ * Checks function reponsability against contract.
+ */
+#define ENSURE(cond) assert(cond)
+
+/*
+ * While REQUIRE and ENSURE apply to functions, INVARIANT
+ * applies to classes/structs.  It ensures that intances
+ * of the class/struct are consistent. In other words,
+ * that the instance has not been corrupted.
+ */
+#define INVARIANT(invariant_fnc) do{ (invariant_fnc) } while (0);
+
+#else
+#define REQUIRE(cond) do { } while (0);
+#define ENSURE(cond) do { } while (0);
+#define INVARIANT(invariant_fnc) do{ } while (0);
+
+#endif /* defined(UNIT_TESTING) || defined (DEBUG) */
+#endif /* CMOCKA_PBC_H_ */
+
diff --git a/third_party/cmocka/include/cmocka_private.h b/third_party/cmocka/include/cmocka_private.h
index d633d64..d20d841 100644
--- a/third_party/cmocka/include/cmocka_private.h
+++ b/third_party/cmocka/include/cmocka_private.h
@@ -17,7 +17,114 @@
 #ifndef CMOCKA_PRIVATE_H_
 #define CMOCKA_PRIVATE_H_
 
-#include <cmocka.h>
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdint.h>
+
+#ifdef _WIN32
+#include <windows.h>
+
+# ifdef _MSC_VER
+# include <stdio.h> /* _snprintf */
+
+#  undef inline
+#  define inline __inline
+
+#  ifndef va_copy
+#   define va_copy(dest, src) (dest = src)
+#  endif
+
+#  define strcasecmp _stricmp
+#  define strncasecmp _strnicmp
+
+#  if defined(HAVE__SNPRINTF_S)
+#   undef snprintf
+#   define snprintf(d, n, ...) _snprintf_s((d), (n), _TRUNCATE, __VA_ARGS__)
+#  else /* HAVE__SNPRINTF_S */
+#   if defined(HAVE__SNPRINTF)
+#     undef snprintf
+#     define snprintf _snprintf
+#   else /* HAVE__SNPRINTF */
+#    if !defined(HAVE_SNPRINTF)
+#     error "no snprintf compatible function found"
+#    endif /* HAVE_SNPRINTF */
+#   endif /* HAVE__SNPRINTF */
+#  endif /* HAVE__SNPRINTF_S */
+
+#  if defined(HAVE__VSNPRINTF_S)
+#   undef vsnprintf
+#   define vsnprintf(s, n, f, v) _vsnprintf_s((s), (n), _TRUNCATE, (f), (v))
+#  else /* HAVE__VSNPRINTF_S */
+#   if defined(HAVE__VSNPRINTF)
+#    undef vsnprintf
+#    define vsnprintf _vsnprintf
+#   else
+#    if !defined(HAVE_VSNPRINTF)
+#     error "No vsnprintf compatible function found"
+#    endif /* HAVE_VSNPRINTF */
+#   endif /* HAVE__VSNPRINTF */
+#  endif /* HAVE__VSNPRINTF_S */
+# endif /* _MSC_VER */
+
+/*
+ * Backwards compatibility with headers shipped with Visual Studio 2005 and
+ * earlier.
+ */
+WINBASEAPI BOOL WINAPI IsDebuggerPresent(VOID);
+
+#ifndef PRIdS
+# define PRIdS "Id"
+#endif
+
+#ifndef PRIu64
+# define PRIu64 "I64u"
+#endif
+
+#ifndef PRIuMAX
+# define PRIuMAX PRIu64
+#endif
+
+#ifndef PRIxMAX
+#define PRIxMAX "I64x"
+#endif
+
+#ifndef PRIXMAX
+#define PRIXMAX "I64X"
+#endif
+
+#else /* _WIN32 */
+
+#ifndef __PRI64_PREFIX
+# if __WORDSIZE == 64
+#  define __PRI64_PREFIX "l"
+# else
+#  define __PRI64_PREFIX "ll"
+# endif
+#endif
+
+#ifndef PRIdS
+# define PRIdS "zd"
+#endif
+
+#ifndef PRIu64
+# define PRIu64 __PRI64_PREFIX "u"
+#endif
+
+#ifndef PRIuMAX
+# define PRIuMAX __PRI64_PREFIX "u"
+#endif
+
+#ifndef PRIxMAX
+#define PRIxMAX __PRI64_PREFIX "x"
+#endif
+
+#ifndef PRIXMAX
+#define PRIXMAX __PRI64_PREFIX "X"
+#endif
+
+#endif /* _WIN32 */
 
 /** Free memory space */
 #define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
diff --git a/third_party/cmocka/include/cmockery/cmockery.h b/third_party/cmocka/include/cmockery/cmockery.h
new file mode 100644
index 0000000..a252a5f
--- /dev/null
+++ b/third_party/cmocka/include/cmockery/cmockery.h
@@ -0,0 +1 @@
+#include <cmocka.h>
diff --git a/third_party/cmocka/include/cmockery/pbc.h b/third_party/cmocka/include/cmockery/pbc.h
new file mode 100644
index 0000000..50bac87
--- /dev/null
+++ b/third_party/cmocka/include/cmockery/pbc.h
@@ -0,0 +1 @@
+#include <cmocka_pbc.h>
diff --git a/third_party/cmocka/src/CMakeLists.txt b/third_party/cmocka/src/CMakeLists.txt
index 2b3c486..b5a3c7d 100644
--- a/third_party/cmocka/src/CMakeLists.txt
+++ b/third_party/cmocka/src/CMakeLists.txt
@@ -1,7 +1,10 @@
 project(cmocka-library C)
 
+set(CMOCKA_PLATFORM_INCLUDE CACHE PATH "Path to include directory for cmocka_platform.h")
+
 set(CMOCKA_PUBLIC_INCLUDE_DIRS
     ${CMAKE_SOURCE_DIR}/include
+    ${CMOCKA_PLATFORM_INCLUDE}
     CACHE INTERNAL "cmocka public include directories"
 )
 
@@ -43,24 +46,33 @@ include_directories(
 )
 
 add_definitions(-DHAVE_CONFIG_H=1)
+if (CMOCKA_PLATFORM_INCLUDE)
+    add_definitions(-DCMOCKA_PLATFORM_INCLUDE=1)
+endif()
 
 add_library(${CMOCKA_SHARED_LIBRARY} SHARED ${cmocka_SRCS})
 
 target_link_libraries(${CMOCKA_SHARED_LIBRARY} ${CMOCKA_LINK_LIBRARIES})
-
 set_target_properties(
     ${CMOCKA_SHARED_LIBRARY}
         PROPERTIES
-            VERSION
-                ${LIBRARY_VERSION}
-            SOVERSION
-                ${LIBRARY_SOVERSION}
             OUTPUT_NAME
                 cmocka
             DEFINE_SYMBOL
                 CMOCKA_EXPORTS
 )
 
+if (NOT WIN32)
+    set_target_properties(
+        ${CMOCKA_SHARED_LIBRARY}
+            PROPERTIES
+                VERSION
+                    ${LIBRARY_VERSION}
+                SOVERSION
+                    ${LIBRARY_SOVERSION}
+    )
+endif (NOT WIN32)
+
 install(
     TARGETS ${CMOCKA_SHARED_LIBRARY}
     RUNTIME DESTINATION ${BIN_INSTALL_DIR}
@@ -90,3 +102,17 @@ if (WITH_STATIC_LIB)
     )
 endif (WITH_STATIC_LIB)
 
+if (POLICY CMP0026)
+    cmake_policy(SET CMP0026 OLD)
+endif()
+
+#
+# In order to run tests we will need to set the approriate environment
+# variable so that the test program can locate its dependent DLL's. First
+# we want to know what directory our dependent DLL was installed into:
+#
+get_target_property(_cmocka_dir cmocka_shared LOCATION_${CMOCKA_BUILD_TYPE})
+get_filename_component(_cmocka_path "${_cmocka_dir}" PATH)
+file(TO_NATIVE_PATH "${_cmocka_path}" _cmocka_path_native)
+
+set(CMOCKA_DLL_PATH "${_cmocka_path_native}" PARENT_SCOPE)
diff --git a/third_party/cmocka/src/cmocka.c b/third_party/cmocka/src/cmocka.c
index 5700fc9..fc83b57 100644
--- a/third_party/cmocka/src/cmocka.c
+++ b/third_party/cmocka/src/cmocka.c
@@ -1,5 +1,7 @@
 /*
  * Copyright 2008 Google Inc.
+ * Copyright 2014-2015 Andreas Schneider <asn at cryptomilk.org>
+ * Copyright 2015      Jakub Hrozek <jakub.hrozek at posteo.se>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -21,39 +23,39 @@
 #include <malloc.h>
 #endif
 
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+#endif
+
+#ifdef HAVE_SIGNAL_H
+#include <signal.h>
+#endif
+
+#include <stdint.h>
 #include <setjmp.h>
 #include <stdarg.h>
 #include <stddef.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-
-#ifdef _WIN32
-#include <windows.h>
-
-#define vsnprintf _vsnprintf
+#include <time.h>
 
 /*
- * Backwards compatibility with headers shipped with Visual Studio 2005 and
- * earlier.
+ * This allows to add a platform specific header file. Some embedded platforms
+ * sometimes miss certain types and definitions.
+ *
+ * Example:
+ *
+ * typedef unsigned long int uintptr_t
+ * #define _UINTPTR_T 1
+ * #define _UINTPTR_T_DEFINED 1
  */
-WINBASEAPI BOOL WINAPI IsDebuggerPresent(VOID);
-
-#ifndef PRIdS
-#define PRIdS "Id"
-#endif
-
-#else /* _WIN32 */
-
-#ifndef PRIdS
-#define PRIdS "zd"
-#endif
+#ifdef CMOCKA_PLATFORM_INCLUDE
+# include "cmocka_platform.h"
+#endif /* CMOCKA_PLATFORM_INCLUDE */
 
-#include <signal.h>
-#endif /* _WIN32 */
-
-#include <cmocka_private.h>
 #include <cmocka.h>
+#include <cmocka_private.h>
 
 /* Size of guard bytes around dynamically allocated blocks. */
 #define MALLOC_GUARD_SIZE 16
@@ -68,8 +70,19 @@ WINBASEAPI BOOL WINAPI IsDebuggerPresent(VOID);
 /* Printf formatting for source code locations. */
 #define SOURCE_LOCATION_FORMAT "%s:%u"
 
-/* Calculates the number of elements in an array. */
-#define ARRAY_LENGTH(x) (sizeof(x) / sizeof((x)[0]))
+#if defined(HAVE_GCC_THREAD_LOCAL_STORAGE)
+# define CMOCKA_THREAD __thread
+#elif defined(HAVE_MSVC_THREAD_LOCAL_STORAGE)
+# define CMOCKA_THREAD __declspec(thread)
+#else
+# define CMOCKA_THREAD
+#endif
+
+#ifdef HAVE_CLOCK_GETTIME_REALTIME
+#define CMOCKA_CLOCK_GETTIME(clock_id, ts) clock_gettime((clock_id), (ts))
+#else
+#define CMOCKA_CLOCK_GETTIME(clock_id, ts)
+#endif
 
 /*
  * Declare and initialize the pointer member of ValuePointer variable name
@@ -214,34 +227,41 @@ static void initialize_testing(const char *test_name);
 /* This must be called at the end of a test to free() allocated structures. */
 static void teardown_testing(const char *test_name);
 
+static int cm_error_message_enabled = 1;
+static CMOCKA_THREAD char *cm_error_message;
+
+void cm_print_error(const char * const format, ...) CMOCKA_PRINTF_ATTRIBUTE(1, 2);
 
 /*
  * Keeps track of the calling context returned by setenv() so that the fail()
  * method can jump out of a test.
  */
-static jmp_buf global_run_test_env;
-static int global_running_test = 0;
+static CMOCKA_THREAD jmp_buf global_run_test_env;
+static CMOCKA_THREAD int global_running_test = 0;
 
 /* Keeps track of the calling context returned by setenv() so that */
 /* mock_assert() can optionally jump back to expect_assert_failure(). */
 jmp_buf global_expect_assert_env;
 int global_expecting_assert = 0;
 const char *global_last_failed_assert = NULL;
+static int global_skip_test;
 
 /* Keeps a map of the values that functions will have to return to provide */
 /* mocked interfaces. */
-static ListNode global_function_result_map_head;
+static CMOCKA_THREAD ListNode global_function_result_map_head;
 /* Location of the last mock value returned was declared. */
-static SourceLocation global_last_mock_value_location;
+static CMOCKA_THREAD SourceLocation global_last_mock_value_location;
 
 /* Keeps a map of the values that functions expect as parameters to their
  * mocked interfaces. */
-static ListNode global_function_parameter_map_head;
+static CMOCKA_THREAD ListNode global_function_parameter_map_head;
 /* Location of last parameter value checked was declared. */
-static SourceLocation global_last_parameter_location;
+static CMOCKA_THREAD SourceLocation global_last_parameter_location;
 
 /* List of all currently allocated blocks. */
-static ListNode global_allocated_blocks;
+static CMOCKA_THREAD ListNode global_allocated_blocks;
+
+static enum cm_message_output global_msg_output = CM_OUTPUT_STDOUT;
 
 #ifndef _WIN32
 /* Signals caught by exception_handler(). */
@@ -249,14 +269,18 @@ static const int exception_signals[] = {
     SIGFPE,
     SIGILL,
     SIGSEGV,
+#ifdef SIGBUS
     SIGBUS,
+#endif
+#ifdef SIGSYS
     SIGSYS,
+#endif
 };
 
 /* Default signal functions that should be restored after a test is complete. */
 typedef void (*SignalFunction)(int signal);
 static SignalFunction default_signal_functions[
-    ARRAY_LENGTH(exception_signals)];
+    ARRAY_SIZE(exception_signals)];
 
 #else /* _WIN32 */
 
@@ -295,16 +319,44 @@ static const ExceptionCodeInfo exception_codes[] = {
 };
 #endif /* !_WIN32 */
 
+enum CMUnitTestStatus {
+    CM_TEST_NOT_STARTED,
+    CM_TEST_PASSED,
+    CM_TEST_FAILED,
+    CM_TEST_ERROR,
+    CM_TEST_SKIPPED,
+};
+
+struct CMUnitTestState {
+    const ListNode *check_point; /* Check point of the test if there's a setup function. */
+    const struct CMUnitTest *test; /* Point to array element in the tests we get passed */
+    void *state; /* State associated with the test */
+    const char *error_message; /* The error messages by the test */
+    enum CMUnitTestStatus status; /* PASSED, FAILED, ABORT ... */
+    double runtime; /* Time calculations */
+};
 
 /* Exit the currently executing test. */
-static void exit_test(const int quit_application) {
-    if (global_running_test) {
+static void exit_test(const int quit_application)
+{
+    const char *abort_test = getenv("CMOCKA_TEST_ABORT");
+
+    if (abort_test != NULL && abort_test[0] == '1') {
+        print_error("%s", cm_error_message);
+        abort();
+    } else if (global_running_test) {
         longjmp(global_run_test_env, 1);
     } else if (quit_application) {
         exit(-1);
     }
 }
 
+void _skip(const char * const file, const int line)
+{
+    cm_print_error(SOURCE_LOCATION_FORMAT ": Skipped!\n", file, line);
+    global_skip_test = 1;
+    exit_test(1);
+}
 
 /* Initialize a SourceLocation structure. */
 static void initialize_source_location(SourceLocation * const location) {
@@ -602,7 +654,7 @@ static int get_symbol_value(
         }
         return return_value;
     } else {
-        print_error("No entries for symbol %s.\n", symbol_name);
+        cm_print_error("No entries for symbol %s.\n", symbol_name);
     }
     return 0;
 }
@@ -669,18 +721,18 @@ static int check_for_leftover_values(
         if (!list_empty(child_list)) {
             if (number_of_symbol_names == 1) {
                 const ListNode *child_node;
-                print_error(error_message, value->symbol_name);
+                cm_print_error(error_message, value->symbol_name);
 
                 for (child_node = child_list->next; child_node != child_list;
                      child_node = child_node->next) {
                     const SourceLocation * const location =
-			    (const SourceLocation*)child_node->value;
-                    print_error(SOURCE_LOCATION_FORMAT
-                                ": note: remaining item was declared here\n",
-                                location->file, location->line);
+                        (const SourceLocation*)child_node->value;
+                    cm_print_error(SOURCE_LOCATION_FORMAT
+                                   ": note: remaining item was declared here\n",
+                                   location->file, location->line);
                 }
             } else {
-                print_error("%s.", value->symbol_name);
+                cm_print_error("%s.", value->symbol_name);
                 check_for_leftover_values(child_list, error_message,
                                           number_of_symbol_names - 1);
             }
@@ -706,16 +758,16 @@ LargestIntegralType _mock(const char * const function, const char* const file,
         }
         return value;
     } else {
-        print_error(SOURCE_LOCATION_FORMAT ": error: Could not get value "
-                    "to mock function %s\n", file, line, function);
+        cm_print_error(SOURCE_LOCATION_FORMAT ": error: Could not get value "
+                       "to mock function %s\n", file, line, function);
         if (source_location_is_set(&global_last_mock_value_location)) {
-            print_error(SOURCE_LOCATION_FORMAT
-                        ": note: Previously returned mock value was declared here\n",
-                        global_last_mock_value_location.file,
-                        global_last_mock_value_location.line);
+            cm_print_error(SOURCE_LOCATION_FORMAT
+                           ": note: Previously returned mock value was declared here\n",
+                           global_last_mock_value_location.file,
+                           global_last_mock_value_location.line);
         } else {
-            print_error("There were no previously returned mock values for "
-                        "this test.\n");
+            cm_print_error("There were no previously returned mock values for "
+                           "this test.\n");
         }
         exit_test(1);
     }
@@ -767,8 +819,8 @@ static int values_equal_display_error(const LargestIntegralType left,
                                       const LargestIntegralType right) {
     const int equal = left == right;
     if (!equal) {
-        print_error(LargestIntegralTypePrintfFormat " != "
-                    LargestIntegralTypePrintfFormat "\n", left, right);
+        cm_print_error(LargestIntegralTypePrintfFormat " != "
+                       LargestIntegralTypePrintfFormat "\n", left, right);
     }
     return equal;
 }
@@ -780,8 +832,8 @@ static int values_not_equal_display_error(const LargestIntegralType left,
                                           const LargestIntegralType right) {
     const int not_equal = left != right;
     if (!not_equal) {
-        print_error(LargestIntegralTypePrintfFormat " == "
-                    LargestIntegralTypePrintfFormat "\n", left, right);
+        cm_print_error(LargestIntegralTypePrintfFormat " == "
+                       LargestIntegralTypePrintfFormat "\n", left, right);
     }
     return not_equal;
 }
@@ -814,11 +866,12 @@ static int value_in_set_display_error(
         if (succeeded) {
             return 1;
         }
-        print_error("%llu is %sin the set (", value, invert ? "" : "not ");
+        cm_print_error("%" PRIu64 " is %sin the set (", value,
+                       invert ? "" : "not ");
         for (i = 0; i < size_of_set; i++) {
-            print_error("%llu, ", set[i]);
+            cm_print_error("%" PRIu64 ", ", set[i]);
         }
-        print_error(")\n");
+        cm_print_error(")\n");
     }
     return 0;
 }
@@ -835,8 +888,8 @@ static int integer_in_range_display_error(
     if (value >= range_min && value <= range_max) {
         return 1;
     }
-    print_error("%llu is not within the range %llu-%llu\n", value, range_min,
-                range_max);
+    cm_print_error("%" PRIu64 " is not within the range %" PRIu64 "-%" PRIu64 "\n",
+                   value, range_min, range_max);
     return 0;
 }
 
@@ -852,8 +905,8 @@ static int integer_not_in_range_display_error(
     if (value < range_min || value > range_max) {
         return 1;
     }
-    print_error("%llu is within the range %llu-%llu\n", value, range_min,
-                range_max);
+    cm_print_error("%" PRIu64 " is within the range %" PRIu64 "-%" PRIu64 "\n",
+                   value, range_min, range_max);
     return 0;
 }
 
@@ -868,7 +921,7 @@ static int string_equal_display_error(
     if (strcmp(left, right) == 0) {
         return 1;
     }
-    print_error("\"%s\" != \"%s\"\n", left, right);
+    cm_print_error("\"%s\" != \"%s\"\n", left, right);
     return 0;
 }
 
@@ -883,7 +936,7 @@ static int string_not_equal_display_error(
     if (strcmp(left, right) != 0) {
         return 1;
     }
-    print_error("\"%s\" == \"%s\"\n", left, right);
+    cm_print_error("\"%s\" == \"%s\"\n", left, right);
     return 0;
 }
 
@@ -900,13 +953,13 @@ static int memory_equal_display_error(const char* const a, const char* const b,
         const char l = a[i];
         const char r = b[i];
         if (l != r) {
-            print_error("difference at offset %" PRIdS " 0x%02x 0x%02x\n",
-                        i, l, r);
+            cm_print_error("difference at offset %" PRIdS " 0x%02x 0x%02x\n",
+                           i, l, r);
             differences ++;
         }
     }
     if (differences) {
-        print_error("%d bytes of %p and %p differ\n", differences,
+        cm_print_error("%d bytes of %p and %p differ\n", differences,
                     a, b);
         return 0;
     }
@@ -931,7 +984,7 @@ static int memory_not_equal_display_error(
         }
     }
     if (same == size) {
-        print_error("%"PRIdS "bytes of %p and %p the same\n", same,
+        cm_print_error("%"PRIdS "bytes of %p and %p the same\n", same,
                     a, b);
         return 0;
     }
@@ -974,6 +1027,7 @@ static void expect_set(
     assert_true(number_of_values);
     memcpy(set, values, number_of_values * sizeof(values[0]));
     check_integer_set->set = set;
+    check_integer_set->size_of_set = number_of_values;
     _expect_check(
         function, parameter, file, line, check_function,
         check_data.value, &check_integer_set->event, count);
@@ -1245,27 +1299,27 @@ void _check_expected(
             free(check);
         }
         if (!check_succeeded) {
-            print_error(SOURCE_LOCATION_FORMAT
-                        ": error: Check of parameter %s, function %s failed\n"
-                        SOURCE_LOCATION_FORMAT
-                        ": note: Expected parameter declared here\n",
-                        file, line,
-                        parameter_name, function_name,
-                        global_last_parameter_location.file,
-                        global_last_parameter_location.line);
+            cm_print_error(SOURCE_LOCATION_FORMAT
+                           ": error: Check of parameter %s, function %s failed\n"
+                           SOURCE_LOCATION_FORMAT
+                           ": note: Expected parameter declared here\n",
+                           file, line,
+                           parameter_name, function_name,
+                           global_last_parameter_location.file,
+                           global_last_parameter_location.line);
             _fail(file, line);
         }
     } else {
-        print_error(SOURCE_LOCATION_FORMAT ": error: Could not get value "
+        cm_print_error(SOURCE_LOCATION_FORMAT ": error: Could not get value "
                     "to check parameter %s of function %s\n", file, line,
                     parameter_name, function_name);
         if (source_location_is_set(&global_last_parameter_location)) {
-            print_error(SOURCE_LOCATION_FORMAT
+            cm_print_error(SOURCE_LOCATION_FORMAT
                         ": note: Previously declared parameter value was declared here\n",
                         global_last_parameter_location.file,
                         global_last_parameter_location.line);
         } else {
-            print_error("There were no previously declared parameter values "
+            cm_print_error("There were no previously declared parameter values "
                         "for this test.\n");
         }
         exit_test(1);
@@ -1281,7 +1335,7 @@ void mock_assert(const int result, const char* const expression,
             global_last_failed_assert = expression;
             longjmp(global_expect_assert_env, result);
         } else {
-            print_error("ASSERT: %s\n", expression);
+            cm_print_error("ASSERT: %s\n", expression);
             _fail(file, line);
         }
     }
@@ -1292,7 +1346,48 @@ void _assert_true(const LargestIntegralType result,
                   const char * const expression,
                   const char * const file, const int line) {
     if (!result) {
-        print_error("%s\n", expression);
+        cm_print_error("%s\n", expression);
+        _fail(file, line);
+    }
+}
+
+void _assert_return_code(const LargestIntegralType result,
+                         size_t rlen,
+                         const LargestIntegralType error,
+                         const char * const expression,
+                         const char * const file,
+                         const int line)
+{
+    LargestIntegralType valmax;
+
+
+    switch (rlen) {
+    case 1:
+        valmax = 255;
+        break;
+    case 2:
+        valmax = 32767;
+        break;
+    case 4:
+        valmax = 2147483647;
+        break;
+    case 8:
+    default:
+        if (rlen > sizeof(valmax)) {
+            valmax = 2147483647;
+        } else {
+            valmax = 9223372036854775807L;
+        }
+        break;
+    }
+
+    if (result > valmax - 1) {
+        if (error > 0) {
+            cm_print_error("%s < 0, errno(%" PRIu64 "): %s\n",
+                           expression, error, strerror((int)error));
+        } else {
+            cm_print_error("%s < 0\n", expression);
+        }
         _fail(file, line);
     }
 }
@@ -1403,6 +1498,81 @@ static ListNode* get_allocated_blocks_list() {
     return &global_allocated_blocks;
 }
 
+static void *libc_malloc(size_t size)
+{
+#undef malloc
+    return malloc(size);
+#define malloc test_malloc
+}
+
+static void libc_free(void *ptr)
+{
+#undef free
+    free(ptr);
+#define free test_free
+}
+
+static void *libc_realloc(void *ptr, size_t size)
+{
+#undef realloc
+    return realloc(ptr, size);
+#define realloc test_realloc
+}
+
+static void vcm_print_error(const char* const format,
+                            va_list args) CMOCKA_PRINTF_ATTRIBUTE(1, 0);
+
+/* It's important to use the libc malloc and free here otherwise
+ * the automatic free of leaked blocks can reap the error messages
+ */
+static void vcm_print_error(const char* const format, va_list args)
+{
+    char buffer[1024];
+    size_t msg_len = 0;
+    va_list ap;
+    int len;
+
+    len = vsnprintf(buffer, sizeof(buffer), format, args);
+    if (len < 0) {
+        /* TODO */
+        return;
+    }
+
+    if (cm_error_message == NULL) {
+        /* CREATE MESSAGE */
+
+        cm_error_message = libc_malloc(len + 1);
+        if (cm_error_message == NULL) {
+            /* TODO */
+            return;
+        }
+    } else {
+        /* APPEND MESSAGE */
+        char *tmp;
+
+        msg_len = strlen(cm_error_message);
+        tmp = libc_realloc(cm_error_message, msg_len + len + 1);
+        if (tmp == NULL) {
+            return;
+        }
+        cm_error_message = tmp;
+    }
+
+    if (((size_t)len) < sizeof(buffer)) {
+        /* Use len + 1 to also copy '\0' */
+        memcpy(cm_error_message + msg_len, buffer, len + 1);
+    } else {
+        va_copy(ap, args);
+        vsnprintf(cm_error_message + msg_len, len, format, ap);
+        va_end(ap);
+    }
+}
+
+static void vcm_free_error(char *err_msg)
+{
+    libc_free(err_msg);
+}
+
 /* Use the real malloc in this function. */
 #undef malloc
 void* _test_malloc(const size_t size, const char* file, const int line) {
@@ -1451,8 +1621,12 @@ void* _test_calloc(const size_t number_of_elements, const size_t size,
 void _test_free(void* const ptr, const char* file, const int line) {
     unsigned int i;
     char *block = discard_const_p(char, ptr);
-
     MallocBlockInfo *block_info;
+
+    if (ptr == NULL) {
+        return;
+    }
+
     _assert_true(cast_ptr_to_largest_integral_type(ptr), "ptr", file, line);
     block_info = (MallocBlockInfo*)(block - (MALLOC_GUARD_SIZE +
                                                sizeof(*block_info)));
@@ -1460,19 +1634,19 @@ void _test_free(void* const ptr, const char* file, const int line) {
     {
         char *guards[2] = {block - MALLOC_GUARD_SIZE,
                            block + block_info->size};
-        for (i = 0; i < ARRAY_LENGTH(guards); i++) {
+        for (i = 0; i < ARRAY_SIZE(guards); i++) {
             unsigned int j;
             char * const guard = guards[i];
             for (j = 0; j < MALLOC_GUARD_SIZE; j++) {
                 const char diff = guard[j] - MALLOC_GUARD_PATTERN;
                 if (diff) {
-                    print_error(SOURCE_LOCATION_FORMAT
-                                ": error: Guard block of %p size=%lu is corrupt\n"
-                                SOURCE_LOCATION_FORMAT ": note: allocated here at %p\n",
-                                file, line,
-                                ptr, (unsigned long)block_info->size,
-                                block_info->location.file, block_info->location.line,
-                                &guard[j]);
+                    cm_print_error(SOURCE_LOCATION_FORMAT
+                                   ": error: Guard block of %p size=%lu is corrupt\n"
+                                   SOURCE_LOCATION_FORMAT ": note: allocated here at %p\n",
+                                   file, line,
+                                   ptr, (unsigned long)block_info->size,
+                                   block_info->location.file, block_info->location.line,
+                                   &guard[j]);
                     _fail(file, line);
                 }
             }
@@ -1486,6 +1660,46 @@ void _test_free(void* const ptr, const char* file, const int line) {
 }
 #define free test_free
 
+#undef realloc
+void *_test_realloc(void *ptr,
+                   const size_t size,
+                   const char *file,
+                   const int line)
+{
+    MallocBlockInfo *block_info;
+    char *block = ptr;
+    size_t block_size = size;
+    void *new;
+
+    if (ptr == NULL) {
+        return _test_malloc(size, file, line);
+    }
+
+    if (size == 0) {
+        _test_free(ptr, file, line);
+        return NULL;
+    }
+
+    block_info = (MallocBlockInfo*)(block - (MALLOC_GUARD_SIZE +
+                                             sizeof(*block_info)));
+
+    new = _test_malloc(size, file, line);
+    if (new == NULL) {
+        return NULL;
+    }
+
+    if (block_info->size < size) {
+        block_size = block_info->size;
+    }
+
+    memcpy(new, ptr, block_size);
+
+    /* Free previous memory */
+    _test_free(ptr, file, line);
+
+    return new;
+}
+#define realloc test_realloc
 
 /* Crudely checkpoint the current heap state. */
 static const ListNode* check_point_allocated_blocks() {
@@ -1508,12 +1722,12 @@ static int display_allocated_blocks(const ListNode * const check_point) {
         assert_non_null(block_info);
 
         if (!allocated_blocks) {
-            print_error("Blocks allocated...\n");
+            cm_print_error("Blocks allocated...\n");
         }
-        print_error(SOURCE_LOCATION_FORMAT ": note: block %p allocated here\n",
-                    block_info->location.file,
-                    block_info->location.line,
-                    block_info->block);
+        cm_print_error(SOURCE_LOCATION_FORMAT ": note: block %p allocated here\n",
+                       block_info->location.file,
+                       block_info->location.line,
+                       block_info->block);
         allocated_blocks ++;
     }
     return allocated_blocks;
@@ -1543,15 +1757,15 @@ static void fail_if_blocks_allocated(const ListNode * const check_point,
     const int allocated_blocks = display_allocated_blocks(check_point);
     if (allocated_blocks) {
         free_allocated_blocks(check_point);
-        print_error("ERROR: %s leaked %d block(s)\n", test_name,
-                    allocated_blocks);
+        cm_print_error("ERROR: %s leaked %d block(s)\n", test_name,
+                       allocated_blocks);
         exit_test(1);
     }
 }
 
 
 void _fail(const char * const file, const int line) {
-  print_error(SOURCE_LOCATION_FORMAT ": error: Failure!\n", file, line);
+    cm_print_error(SOURCE_LOCATION_FORMAT ": error: Failure!\n", file, line);
     exit_test(1);
 }
 
@@ -1559,9 +1773,9 @@ void _fail(const char * const file, const int line) {
 #ifndef _WIN32
 static void exception_handler(int sig) {
 #ifdef HAVE_STRSIGNAL
-    print_error("%s\n", strsignal(sig));
+    cm_print_error("Test failed with exception: %s\n", strsignal(sig));
 #else
-    print_error("%d\n", sig);
+    cm_print_error("Test failed with exception: %d\n", sig);
 #endif
     exit_test(1);
 }
@@ -1573,15 +1787,15 @@ static LONG WINAPI exception_filter(EXCEPTION_POINTERS *exception_pointers) {
         exception_pointers->ExceptionRecord;
     const DWORD code = exception_record->ExceptionCode;
     unsigned int i;
-    for (i = 0; i < ARRAY_LENGTH(exception_codes); i++) {
+    for (i = 0; i < ARRAY_SIZE(exception_codes); i++) {
         const ExceptionCodeInfo * const code_info = &exception_codes[i];
         if (code == code_info->code) {
             static int shown_debug_message = 0;
             fflush(stdout);
-            print_error("%s occurred at 0x%08x.\n", code_info->description,
+            cm_print_error("%s occurred at %p.\n", code_info->description,
                         exception_record->ExceptionAddress);
             if (!shown_debug_message) {
-                print_error(
+                cm_print_error(
                     "\n"
                     "To debug in Visual Studio...\n"
                     "1. Select menu item File->Open Project\n"
@@ -1603,6 +1817,17 @@ static LONG WINAPI exception_filter(EXCEPTION_POINTERS *exception_pointers) {
 }
 #endif /* !_WIN32 */
 
+void cm_print_error(const char * const format, ...)
+{
+    va_list args;
+    va_start(args, format);
+    if (cm_error_message_enabled) {
+        vcm_print_error(format, args);
+    } else {
+        vprint_error(format, args);
+    }
+    va_end(args);
+}
 
 /* Standard output and error print methods. */
 void vprint_message(const char* const format, va_list args) {
@@ -1642,6 +1867,760 @@ void print_error(const char* const format, ...) {
     va_end(args);
 }
 
+/* New formatter */
+static enum cm_message_output cm_get_output(void)
+{
+    enum cm_message_output output = global_msg_output;
+    char *env;
+
+    env = getenv("CMOCKA_MESSAGE_OUTPUT");
+    if (env != NULL) {
+        if (strcasecmp(env, "STDOUT") == 0) {
+            output = CM_OUTPUT_STDOUT;
+        } else if (strcasecmp(env, "SUBUNIT") == 0) {
+            output = CM_OUTPUT_SUBUNIT;
+        } else if (strcasecmp(env, "TAP") == 0) {
+            output = CM_OUTPUT_TAP;
+        } else if (strcasecmp(env, "XML") == 0) {
+            output = CM_OUTPUT_XML;
+        }
+    }
+
+    return output;
+}
+
+enum cm_printf_type {
+    PRINTF_TEST_START,
+    PRINTF_TEST_SUCCESS,
+    PRINTF_TEST_FAILURE,
+    PRINTF_TEST_ERROR,
+    PRINTF_TEST_SKIPPED,
+};
+
+static void cmprintf_group_finish_xml(const char *group_name,
+                                      size_t total_executed,
+                                      size_t total_failed,
+                                      size_t total_errors,
+                                      size_t total_skipped,
+                                      double total_runtime,
+                                      struct CMUnitTestState *cm_tests)
+{
+    FILE *fp = stdout;
+    int file_opened = 0;
+    char *env;
+    size_t i;
+
+    env = getenv("CMOCKA_XML_FILE");
+    if (env != NULL) {
+        char buf[1024];
+        snprintf(buf, sizeof(buf), "%s", env);
+
+        fp = fopen(buf, "r");
+        if (fp == NULL) {
+            fp = fopen(buf, "w");
+            if (fp != NULL) {
+                file_opened = 1;
+            } else {
+                fp = stderr;
+            }
+        } else {
+            fclose(fp);
+            fp = stderr;
+        }
+    }
+
+    fprintf(fp, "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
+    fprintf(fp, "<testsuites>\n");
+    fprintf(fp, "  <testsuite name=\"%s\" time=\"%.3f\" "
+                "tests=\"%u\" failures=\"%u\" errors=\"%u\" skipped=\"%u\" >\n",
+                group_name,
+                total_runtime * 1000, /* miliseconds */
+                (unsigned)total_executed,
+                (unsigned)total_failed,
+                (unsigned)total_errors,
+                (unsigned)total_skipped);
+
+    for (i = 0; i < total_executed; i++) {
+        struct CMUnitTestState *cmtest = &cm_tests[i];
+
+        fprintf(fp, "    <testcase name=\"%s\" time=\"%.3f\" >\n",
+                cmtest->test->name, cmtest->runtime * 1000);
+
+        switch (cmtest->status) {
+        case CM_TEST_ERROR:
+        case CM_TEST_FAILED:
+            if (cmtest->error_message != NULL) {
+                fprintf(fp, "      <failure><![CDATA[%s]]></failure>\n",
+                        cmtest->error_message);
+            } else {
+                fprintf(fp, "      <failure message=\"Unknown error\" />\n");
+            }
+            break;
+        case CM_TEST_SKIPPED:
+            fprintf(fp, "      <skipped/>\n");
+            break;
+
+        case CM_TEST_PASSED:
+        case CM_TEST_NOT_STARTED:
+            break;
+        }
+
+        fprintf(fp, "    </testcase>\n");
+    }
+
+    fprintf(fp, "  </testsuite>\n");
+    fprintf(fp, "</testsuites>\n");
+
+    if (file_opened) {
+        fclose(fp);
+    }
+}
+
+static void cmprintf_group_start_standard(const size_t num_tests)
+{
+    print_message("[==========] Running %u test(s).\n",
+                  (unsigned)num_tests);
+}
+
+static void cmprintf_group_finish_standard(size_t total_executed,
+                                           size_t total_passed,
+                                           size_t total_failed,
+                                           size_t total_errors,
+                                           size_t total_skipped,
+                                           struct CMUnitTestState *cm_tests)
+{
+    size_t i;
+
+    print_message("[==========] %u test(s) run.\n", (unsigned)total_executed);
+    print_error("[  PASSED  ] %u test(s).\n",
+                (unsigned)(total_passed));
+
+    if (total_skipped) {
+        print_error("[  SKIPPED ] %"PRIdS " test(s), listed below:\n", total_skipped);
+        for (i = 0; i < total_executed; i++) {
+            struct CMUnitTestState *cmtest = &cm_tests[i];
+
+            if (cmtest->status == CM_TEST_SKIPPED) {
+                print_error("[  SKIPPED ] %s\n", cmtest->test->name);
+            }
+        }
+        print_error("\n %u SKIPPED TEST(S)\n", (unsigned)(total_skipped));
+    }
+
+    if (total_failed) {
+        print_error("[  FAILED  ] %"PRIdS " test(s), listed below:\n", total_failed);
+        for (i = 0; i < total_executed; i++) {
+            struct CMUnitTestState *cmtest = &cm_tests[i];
+
+            if (cmtest->status == CM_TEST_FAILED) {
+                print_error("[  FAILED  ] %s\n", cmtest->test->name);
+            }
+        }
+        print_error("\n %u FAILED TEST(S)\n",
+                    (unsigned)(total_failed + total_errors));
+    }
+}
+
+static void cmprintf_standard(enum cm_printf_type type,
+                              const char *test_name,
+                              const char *error_message)
+{
+    switch (type) {
+    case PRINTF_TEST_START:
+        print_message("[ RUN      ] %s\n", test_name);
+        break;
+    case PRINTF_TEST_SUCCESS:
+        print_message("[       OK ] %s\n", test_name);
+        break;
+    case PRINTF_TEST_FAILURE:
+        if (error_message != NULL) {
+            print_error("%s\n", error_message);
+        }
+        print_message("[  FAILED  ] %s\n", test_name);
+        break;
+    case PRINTF_TEST_SKIPPED:
+        print_message("[  SKIPPED ] %s\n", test_name);
+        break;
+    case PRINTF_TEST_ERROR:
+        if (error_message != NULL) {
+            print_error("%s\n", error_message);
+        }
+        print_error("[  ERROR   ] %s\n", test_name);
+        break;
+    }
+}
+
+static void cmprintf_group_start_tap(const size_t num_tests)
+{
+    print_message("\t1..%u\n", (unsigned)num_tests);
+}
+
+static void cmprintf_group_finish_tap(const char *group_name,
+                                      size_t total_executed,
+                                      size_t total_passed,
+                                      size_t total_skipped)
+{
+    const char *status = "not ok";
+    if (total_passed + total_skipped == total_executed) {
+        status = "ok";
+    }
+    print_message("%s - %s\n", status, group_name);
+}
+
+static void cmprintf_tap(enum cm_printf_type type,
+                         uint32_t test_number,
+                         const char *test_name,
+                         const char *error_message)
+{
+    switch (type) {
+    case PRINTF_TEST_START:
+        break;
+    case PRINTF_TEST_SUCCESS:
+        print_message("\tok %u - %s\n", (unsigned)test_number, test_name);
+        break;
+    case PRINTF_TEST_FAILURE:
+        print_message("\tnot ok %u - %s\n", (unsigned)test_number, test_name);
+        if (error_message != NULL) {
+            char *msg;
+            char *p;
+
+            msg = strdup(error_message);
+            if (msg == NULL) {
+                return;
+            }
+            p = msg;
+
+            while (p[0] != '\0') {
+                char *q = p;
+
+                p = strchr(q, '\n');
+                if (p != NULL) {
+                    p[0] = '\0';
+                }
+
+                print_message("\t# %s\n", q);
+
+                if (p == NULL) {
+                    break;
+                }
+                p++;
+            }
+            libc_free(msg);
+        }
+        break;
+    case PRINTF_TEST_SKIPPED:
+        print_message("\tnot ok %u # SKIP %s\n", (unsigned)test_number, test_name);
+        break;
+    case PRINTF_TEST_ERROR:
+        print_message("\tnot ok %u - %s %s\n",
+                      (unsigned)test_number, test_name, error_message);
+        break;
+    }
+}
+
+static void cmprintf_subunit(enum cm_printf_type type,
+                             const char *test_name,
+                             const char *error_message)
+{
+    switch (type) {
+    case PRINTF_TEST_START:
+        print_message("test: %s\n", test_name);
+        break;
+    case PRINTF_TEST_SUCCESS:
+        print_message("success: %s\n", test_name);
+        break;
+    case PRINTF_TEST_FAILURE:
+        print_message("failure: %s", test_name);
+        if (error_message != NULL) {
+            print_message(" [\n%s]\n", error_message);
+        }
+        break;
+    case PRINTF_TEST_SKIPPED:
+        print_message("skip: %s\n", test_name);
+        break;
+    case PRINTF_TEST_ERROR:
+        print_message("error: %s [ %s ]\n", test_name, error_message);
+        break;
+    }
+}
+
+static void cmprintf_group_start(const size_t num_tests)
+{
+    enum cm_message_output output;
+
+    output = cm_get_output();
+
+    switch (output) {
+    case CM_OUTPUT_STDOUT:
+        cmprintf_group_start_standard(num_tests);
+        break;
+    case CM_OUTPUT_SUBUNIT:
+        break;
+    case CM_OUTPUT_TAP:
+        cmprintf_group_start_tap(num_tests);
+        break;
+    case CM_OUTPUT_XML:
+        break;
+    }
+}
+
+static void cmprintf_group_finish(const char *group_name,
+                                  size_t total_executed,
+                                  size_t total_passed,
+                                  size_t total_failed,
+                                  size_t total_errors,
+                                  size_t total_skipped,
+                                  double total_runtime,
+                                  struct CMUnitTestState *cm_tests)
+{
+    enum cm_message_output output;
+
+    output = cm_get_output();
+
+    switch (output) {
+    case CM_OUTPUT_STDOUT:
+        cmprintf_group_finish_standard(total_executed,
+                                    total_passed,
+                                    total_failed,
+                                    total_errors,
+                                    total_skipped,
+                                    cm_tests);
+        break;
+    case CM_OUTPUT_SUBUNIT:
+        break;
+    case CM_OUTPUT_TAP:
+        cmprintf_group_finish_tap(group_name, total_executed, total_passed, total_skipped);
+        break;
+    case CM_OUTPUT_XML:
+        cmprintf_group_finish_xml(group_name,
+                                  total_executed,
+                                  total_failed,
+                                  total_errors,
+                                  total_skipped,
+                                  total_runtime,
+                                  cm_tests);
+        break;
+    }
+}
+
+static void cmprintf(enum cm_printf_type type,
+                     size_t test_number,
+                     const char *test_name,
+                     const char *error_message)
+{
+    enum cm_message_output output;
+
+    output = cm_get_output();
+
+    switch (output) {
+    case CM_OUTPUT_STDOUT:
+        cmprintf_standard(type, test_name, error_message);
+        break;
+    case CM_OUTPUT_SUBUNIT:
+        cmprintf_subunit(type, test_name, error_message);
+        break;
+    case CM_OUTPUT_TAP:
+        cmprintf_tap(type, test_number, test_name, error_message);
+        break;
+    case CM_OUTPUT_XML:
+        break;
+    }
+}
+
+void cmocka_set_message_output(enum cm_message_output output)
+{
+    global_msg_output = output;
+}
+
+/****************************************************************************
+ * TIME CALCULATIONS
+ ****************************************************************************/
+
+#ifdef HAVE_STRUCT_TIMESPEC
+static struct timespec cm_tspecdiff(struct timespec time1,
+                                    struct timespec time0)
+{
+    struct timespec ret;
+    int xsec = 0;
+    int sign = 1;
+
+    if (time0.tv_nsec > time1.tv_nsec) {
+        xsec = (int) ((time0.tv_nsec - time1.tv_nsec) / (1E9 + 1));
+        time0.tv_nsec -= (long int) (1E9 * xsec);
+        time0.tv_sec += xsec;
+    }
+
+    if ((time1.tv_nsec - time0.tv_nsec) > 1E9) {
+        xsec = (int) ((time1.tv_nsec - time0.tv_nsec) / 1E9);
+        time0.tv_nsec += (long int) (1E9 * xsec);
+        time0.tv_sec -= xsec;
+    }
+
+    ret.tv_sec = time1.tv_sec - time0.tv_sec;
+    ret.tv_nsec = time1.tv_nsec - time0.tv_nsec;
+
+    if (time1.tv_sec < time0.tv_sec) {
+        sign = -1;
+    }
+
+    ret.tv_sec = ret.tv_sec * sign;
+
+    return ret;
+}
+
+static double cm_secdiff(struct timespec clock1, struct timespec clock0)
+{
+    double ret;
+    struct timespec diff;
+
+    diff = cm_tspecdiff(clock1, clock0);
+
+    ret = diff.tv_sec;
+    ret += (double) diff.tv_nsec / (double) 1E9;
+
+    return ret;
+}
+#endif /* HAVE_STRUCT_TIMESPEC */
+
+/****************************************************************************
+ * CMOCKA TEST RUNNER
+ ****************************************************************************/
+static int cmocka_run_one_test_or_fixture(const char *function_name,
+                                          CMUnitTestFunction test_func,
+                                          CMFixtureFunction setup_func,
+                                          CMFixtureFunction teardown_func,
+                                          void ** const volatile state,
+                                          const void *const heap_check_point)
+{
+    const ListNode * const volatile check_point = (const ListNode*)
+        (heap_check_point != NULL ?
+         heap_check_point : check_point_allocated_blocks());
+    int handle_exceptions = 1;
+    void *current_state = NULL;
+    int rc = 0;
+
+    /* FIXME check only one test or fixture is set */
+
+    /* Detect if we should handle exceptions */
+#ifdef _WIN32
+    handle_exceptions = !IsDebuggerPresent();
+#endif /* _WIN32 */
+#ifdef UNIT_TESTING_DEBUG
+    handle_exceptions = 0;
+#endif /* UNIT_TESTING_DEBUG */
+
+
+    if (handle_exceptions) {
+#ifndef _WIN32
+        unsigned int i;
+        for (i = 0; i < ARRAY_SIZE(exception_signals); i++) {
+            default_signal_functions[i] = signal(
+                    exception_signals[i], exception_handler);
+        }
+#else /* _WIN32 */
+        previous_exception_filter = SetUnhandledExceptionFilter(
+                exception_filter);
+#endif /* !_WIN32 */
+    }
+
+    /* Init the test structure */
+    initialize_testing(function_name);
+
+    global_running_test = 1;
+
+    if (setjmp(global_run_test_env) == 0) {
+        if (test_func != NULL) {
+            test_func(state != NULL ? state : &current_state);
+
+            fail_if_blocks_allocated(check_point, function_name);
+            rc = 0;
+        } else if (setup_func != NULL) {
+            rc = setup_func(state != NULL ? state : &current_state);
+
+            /*
+             * For setup we can ignore any allocated blocks. We just need to
+             * ensure they're deallocated on tear down.
+             */
+        } else if (teardown_func != NULL) {
+            rc = teardown_func(state != NULL ? state : &current_state);
+
+            fail_if_blocks_allocated(check_point, function_name);
+        } else {
+            /* ERROR */
+        }
+        fail_if_leftover_values(function_name);
+        global_running_test = 0;
+    } else {
+        /* TEST FAILED */
+        global_running_test = 0;
+        rc = -1;
+    }
+    teardown_testing(function_name);
+
+    if (handle_exceptions) {
+#ifndef _WIN32
+        unsigned int i;
+        for (i = 0; i < ARRAY_SIZE(exception_signals); i++) {
+            signal(exception_signals[i], default_signal_functions[i]);
+        }
+#else /* _WIN32 */
+        if (previous_exception_filter) {
+            SetUnhandledExceptionFilter(previous_exception_filter);
+            previous_exception_filter = NULL;
+        }
+#endif /* !_WIN32 */
+    }
+
+    return rc;
+}
+
+static int cmocka_run_group_fixture(const char *function_name,
+                                    CMFixtureFunction setup_func,
+                                    CMFixtureFunction teardown_func,
+                                    void **state,
+                                    const void *const heap_check_point)
+{
+    int rc;
+
+    if (setup_func != NULL) {
+        rc = cmocka_run_one_test_or_fixture(function_name,
+                                        NULL,
+                                        setup_func,
+                                        NULL,
+                                        state,
+                                        heap_check_point);
+    } else {
+        rc = cmocka_run_one_test_or_fixture(function_name,
+                                        NULL,
+                                        NULL,
+                                        teardown_func,
+                                        state,
+                                        heap_check_point);
+    }
+
+    return rc;
+}
+
+static int cmocka_run_one_tests(struct CMUnitTestState *test_state)
+{
+#ifdef HAVE_STRUCT_TIMESPEC
+    struct timespec start = {
+        .tv_sec = 0,
+        .tv_nsec = 0,
+    };
+    struct timespec finish = {
+        .tv_sec = 0,
+        .tv_nsec = 0,
+    };
+#endif
+    int rc = 0;
+
+    /* Run setup */
+    if (test_state->test->setup_func != NULL) {
+        /* Setup the memory check point, it will be evaluated on teardown */
+        test_state->check_point = check_point_allocated_blocks();
+
+        rc = cmocka_run_one_test_or_fixture(test_state->test->name,
+                                            NULL,
+                                            test_state->test->setup_func,
+                                            NULL,
+                                            &test_state->state,
+                                            test_state->check_point);
+        if (rc != 0) {
+            test_state->status = CM_TEST_ERROR;
+            cm_print_error("Test setup failed");
+        }
+    }
+
+    /* Run test */
+#ifdef HAVE_STRUCT_TIMESPEC
+    CMOCKA_CLOCK_GETTIME(CLOCK_REALTIME, &start);
+#endif
+
+    if (rc == 0) {
+        rc = cmocka_run_one_test_or_fixture(test_state->test->name,
+                                            test_state->test->test_func,
+                                            NULL,
+                                            NULL,
+                                            &test_state->state,
+                                            NULL);
+        if (rc == 0) {
+            test_state->status = CM_TEST_PASSED;
+        } else {
+            if (global_skip_test) {
+                test_state->status = CM_TEST_SKIPPED;
+                global_skip_test = 0; /* Do not skip the next test */
+            } else {
+                test_state->status = CM_TEST_FAILED;
+            }
+        }
+        rc = 0;
+    }
+
+    test_state->runtime = 0.0;
+
+#ifdef HAVE_STRUCT_TIMESPEC
+    CMOCKA_CLOCK_GETTIME(CLOCK_REALTIME, &finish);
+    test_state->runtime = cm_secdiff(finish, start);
+#endif
+
+    /* Run teardown */
+    if (rc == 0 && test_state->test->teardown_func != NULL) {
+        rc = cmocka_run_one_test_or_fixture(test_state->test->name,
+                                            NULL,
+                                            NULL,
+                                            test_state->test->teardown_func,
+                                            &test_state->state,
+                                            test_state->check_point);
+        if (rc != 0) {
+            test_state->status = CM_TEST_ERROR;
+            cm_print_error("Test teardown failed");
+        }
+    }
+
+    test_state->error_message = cm_error_message;
+    cm_error_message = NULL;
+
+    return rc;
+}
+
+int _cmocka_run_group_tests(const char *group_name,
+                            const struct CMUnitTest * const tests,
+                            const size_t num_tests,
+                            CMFixtureFunction group_setup,
+                            CMFixtureFunction group_teardown)
+{
+    struct CMUnitTestState *cm_tests;
+    const ListNode *group_check_point = check_point_allocated_blocks();
+    void *group_state = NULL;
+    size_t total_failed = 0;
+    size_t total_passed = 0;
+    size_t total_executed = 0;
+    size_t total_errors = 0;
+    size_t total_skipped = 0;
+    double total_runtime = 0;
+    size_t i;
+    int rc;
+
+    /* Make sure LargestIntegralType is at least the size of a pointer. */
+    assert_true(sizeof(LargestIntegralType) >= sizeof(void*));
+
+    cm_tests = (struct CMUnitTestState *)libc_malloc(sizeof(struct CMUnitTestState) * num_tests);
+    if (cm_tests == NULL) {
+        return -1;
+    }
+
+    cmprintf_group_start(num_tests);
+
+    /* Setup cmocka test array */
+    for (i = 0; i < num_tests; i++) {
+        cm_tests[i] = (struct CMUnitTestState) {
+            .test = &tests[i],
+            .status = CM_TEST_NOT_STARTED,
+            .state = NULL,
+        };
+    }
+
+    rc = 0;
+
+    /* Run group setup */
+    if (group_setup != NULL) {
+        rc = cmocka_run_group_fixture("cmocka_group_setup",
+                                      group_setup,
+                                      NULL,
+                                      &group_state,
+                                      group_check_point);
+    }
+
+    if (rc == 0) {
+        /* Execute tests */
+        for (i = 0; i < num_tests; i++) {
+            struct CMUnitTestState *cmtest = &cm_tests[i];
+            size_t test_number = i + 1;
+
+            cmprintf(PRINTF_TEST_START, test_number, cmtest->test->name, NULL);
+
+            if (group_state != NULL) {
+                cm_tests[i].state = group_state;
+            }
+            rc = cmocka_run_one_tests(cmtest);
+            total_executed++;
+            total_runtime += cmtest->runtime;
+            if (rc == 0) {
+                switch (cmtest->status) {
+                    case CM_TEST_PASSED:
+                        cmprintf(PRINTF_TEST_SUCCESS,
+                                 test_number,
+                                 cmtest->test->name,
+                                 cmtest->error_message);
+                        total_passed++;
+                        break;
+                    case CM_TEST_SKIPPED:
+                        cmprintf(PRINTF_TEST_SKIPPED,
+                                 test_number,
+                                 cmtest->test->name,
+                                 cmtest->error_message);
+                        total_skipped++;
+                        break;
+                    case CM_TEST_FAILED:
+                        cmprintf(PRINTF_TEST_FAILURE,
+                                 test_number,
+                                 cmtest->test->name,
+                                 cmtest->error_message);
+                        total_failed++;
+                        break;
+                    default:
+                        cmprintf(PRINTF_TEST_ERROR,
+                                 test_number,
+                                 cmtest->test->name,
+                                 "Internal cmocka error");
+                        total_errors++;
+                        break;
+                }
+            } else {
+                cmprintf(PRINTF_TEST_ERROR,
+                         test_number,
+                         cmtest->test->name,
+                         "Could not run the test - check test fixtures");
+                total_errors++;
+            }
+        }
+    } else {
+        cmprintf(PRINTF_TEST_ERROR, 0,
+                 group_name, "Group setup failed");
+        total_errors++;
+    }
+
+    /* Run group teardown */
+    if (group_teardown != NULL) {
+        rc = cmocka_run_group_fixture("cmocka_group_teardown",
+                                      NULL,
+                                      group_teardown,
+                                      &group_state,
+                                      group_check_point);
+    }
+
+    cmprintf_group_finish(group_name,
+                          total_executed,
+                          total_passed,
+                          total_failed,
+                          total_errors,
+                          total_skipped,
+                          total_runtime,
+                          cm_tests);
+
+    for (i = 0; i < num_tests; i++) {
+        vcm_free_error(discard_const_p(char, cm_tests[i].error_message));
+    }
+    libc_free(cm_tests);
+    fail_if_blocks_allocated(group_check_point, "cmocka_group_tests");
+
+    return total_failed + total_errors;
+}
+
+/****************************************************************************
+ * DEPRECATED TEST RUNNER
+ ****************************************************************************/
 
 int _run_test(
         const char * const function_name,  const UnitTestFunction Function,
@@ -1656,14 +2635,16 @@ int _run_test(
 #ifdef _WIN32
     handle_exceptions = !IsDebuggerPresent();
 #endif /* _WIN32 */
-#if UNIT_TESTING_DEBUG
+#ifdef UNIT_TESTING_DEBUG
     handle_exceptions = 0;
 #endif /* UNIT_TESTING_DEBUG */
 
+    cm_error_message_enabled = 0;
+
     if (handle_exceptions) {
 #ifndef _WIN32
         unsigned int i;
-        for (i = 0; i < ARRAY_LENGTH(exception_signals); i++) {
+        for (i = 0; i < ARRAY_SIZE(exception_signals); i++) {
             default_signal_functions[i] = signal(
                 exception_signals[i], exception_handler);
         }
@@ -1703,7 +2684,7 @@ int _run_test(
     if (handle_exceptions) {
 #ifndef _WIN32
         unsigned int i;
-        for (i = 0; i < ARRAY_LENGTH(exception_signals); i++) {
+        for (i = 0; i < ARRAY_SIZE(exception_signals); i++) {
             signal(exception_signals[i], default_signal_functions[i]);
         }
 #else /* _WIN32 */
@@ -1723,6 +2704,8 @@ int _run_tests(const UnitTest * const tests, const size_t number_of_tests) {
     int run_next_test = 1;
     /* Whether the previous test failed. */
     int previous_test_failed = 0;
+    /* Whether the previous setup failed. */
+    int previous_setup_failed = 0;
     /* Check point of the heap state. */
     const ListNode * const check_point = check_point_allocated_blocks();
     /* Current test being executed. */
@@ -1735,19 +2718,35 @@ int _run_tests(const UnitTest * const tests, const size_t number_of_tests) {
     size_t setups = 0;
     /* Number of teardown functions. */
     size_t teardowns = 0;
+    size_t i;
     /*
      * A stack of test states.  A state is pushed on the stack
      * when a test setup occurs and popped on tear down.
      */
     TestState* test_states =
 	    (TestState*)malloc(number_of_tests * sizeof(*test_states));
-    size_t number_of_test_states = 0;
+    /* The number of test states which should be 0 at the end */
+    long number_of_test_states = 0;
     /* Names of the tests that failed. */
     const char** failed_names = (const char**)malloc(number_of_tests *
                                        sizeof(*failed_names));
     void **current_state = NULL;
 
-    print_message("[==========] Running %"PRIdS " test(s).\n", number_of_tests);
+    /* Count setup and teardown functions */
+    for (i = 0; i < number_of_tests; i++) {
+        const UnitTest * const test = &tests[i];
+
+        if (test->function_type == UNIT_TEST_FUNCTION_TYPE_SETUP) {
+            setups++;
+        }
+
+        if (test->function_type == UNIT_TEST_FUNCTION_TYPE_TEARDOWN) {
+            teardowns++;
+        }
+    }
+
+    print_message("[==========] Running %"PRIdS " test(s).\n",
+                  number_of_tests - setups - teardowns);
 
     /* Make sure LargestIntegralType is at least the size of a pointer. */
     assert_true(sizeof(LargestIntegralType) >= sizeof(void*));
@@ -1762,7 +2761,9 @@ int _run_tests(const UnitTest * const tests, const size_t number_of_tests) {
 
         switch (test->function_type) {
         case UNIT_TEST_FUNCTION_TYPE_TEST:
-            run_next_test = 1;
+            if (! previous_setup_failed) {
+                run_next_test = 1;
+            }
             break;
         case UNIT_TEST_FUNCTION_TYPE_SETUP: {
             /* Checkpoint the heap before the setup. */
@@ -1772,7 +2773,6 @@ int _run_tests(const UnitTest * const tests, const size_t number_of_tests) {
             current_state = &current_TestState->state;
             *current_state = NULL;
             run_next_test = 1;
-            setups ++;
             break;
         }
         case UNIT_TEST_FUNCTION_TYPE_TEARDOWN:
@@ -1781,7 +2781,6 @@ int _run_tests(const UnitTest * const tests, const size_t number_of_tests) {
             current_TestState = &test_states[--number_of_test_states];
             test_check_point = current_TestState->check_point;
             current_state = &current_TestState->state;
-            teardowns ++;
             break;
         default:
             print_error("Invalid unit test function type %d\n",
@@ -1810,6 +2809,7 @@ int _run_tests(const UnitTest * const tests, const size_t number_of_tests) {
                     tests_executed ++;
                     /* Skip forward until the next test or setup function. */
                     run_next_test = 0;
+                    previous_setup_failed = 1;
                 }
                 previous_test_failed = 0;
                 break;
@@ -1832,8 +2832,7 @@ int _run_tests(const UnitTest * const tests, const size_t number_of_tests) {
     print_message("[==========] %"PRIdS " test(s) run.\n", tests_executed);
     print_error("[  PASSED  ] %"PRIdS " test(s).\n", tests_executed - total_failed);
 
-    if (total_failed) {
-        size_t i;
+    if (total_failed > 0) {
         print_error("[  FAILED  ] %"PRIdS " test(s), listed below:\n", total_failed);
         for (i = 0; i < total_failed; i++) {
             print_error("[  FAILED  ] %s\n", failed_names[i]);
@@ -1842,7 +2841,7 @@ int _run_tests(const UnitTest * const tests, const size_t number_of_tests) {
         print_error("\n %"PRIdS " FAILED TEST(S)\n", total_failed);
     }
 
-    if (number_of_test_states) {
+    if (number_of_test_states != 0) {
         print_error("[  ERROR   ] Mismatched number of setup %"PRIdS " and "
                     "teardown %"PRIdS " functions\n", setups, teardowns);
         total_failed = (size_t)-1;
@@ -1854,3 +2853,148 @@ int _run_tests(const UnitTest * const tests, const size_t number_of_tests) {
     fail_if_blocks_allocated(check_point, "run_tests");
     return (int)total_failed;
 }
+
+int _run_group_tests(const UnitTest * const tests, const size_t number_of_tests)
+{
+    UnitTestFunction setup = NULL;
+    const char *setup_name;
+    size_t num_setups = 0;
+    UnitTestFunction teardown = NULL;
+    const char *teardown_name;
+    size_t num_teardowns = 0;
+    size_t current_test = 0;
+    size_t i;
+
+    /* Number of tests executed. */
+    size_t tests_executed = 0;
+    /* Number of failed tests. */
+    size_t total_failed = 0;
+    /* Check point of the heap state. */
+    const ListNode * const check_point = check_point_allocated_blocks();
+    const char** failed_names = (const char**)malloc(number_of_tests *
+                                       sizeof(*failed_names));
+    void **current_state = NULL;
+    TestState group_state;
+
+    /* Find setup and teardown function */
+    for (i = 0; i < number_of_tests; i++) {
+        const UnitTest * const test = &tests[i];
+
+        if (test->function_type == UNIT_TEST_FUNCTION_TYPE_GROUP_SETUP) {
+            if (setup == NULL) {
+                setup = test->function;
+                setup_name = test->name;
+                num_setups = 1;
+            } else {
+                print_error("[  ERROR   ] More than one group setup function detected\n");
+                exit_test(1);
+            }
+        }
+
+        if (test->function_type == UNIT_TEST_FUNCTION_TYPE_GROUP_TEARDOWN) {
+            if (teardown == NULL) {
+                teardown = test->function;
+                teardown_name = test->name;
+                num_teardowns = 1;
+            } else {
+                print_error("[  ERROR   ] More than one group teardown function detected\n");
+                exit_test(1);
+            }
+        }
+    }
+
+    print_message("[==========] Running %"PRIdS " test(s).\n",
+                  number_of_tests - num_setups - num_teardowns);
+
+    if (setup != NULL) {
+        int failed;
+
+        group_state.check_point = check_point_allocated_blocks();
+        current_state = &group_state.state;
+        *current_state = NULL;
+        failed = _run_test(setup_name,
+                           setup,
+                           current_state,
+                           UNIT_TEST_FUNCTION_TYPE_SETUP,
+                           group_state.check_point);
+        if (failed) {
+            failed_names[total_failed] = setup_name;
+        }
+
+        total_failed += failed;
+        tests_executed++;
+    }
+
+    while (current_test < number_of_tests) {
+        int run_test = 0;
+        const UnitTest * const test = &tests[current_test++];
+        if (test->function == NULL) {
+            continue;
+        }
+
+        switch (test->function_type) {
+        case UNIT_TEST_FUNCTION_TYPE_TEST:
+            run_test = 1;
+            break;
+        case UNIT_TEST_FUNCTION_TYPE_SETUP:
+        case UNIT_TEST_FUNCTION_TYPE_TEARDOWN:
+        case UNIT_TEST_FUNCTION_TYPE_GROUP_SETUP:
+        case UNIT_TEST_FUNCTION_TYPE_GROUP_TEARDOWN:
+            break;
+        default:
+            print_error("Invalid unit test function type %d\n",
+                        test->function_type);
+            break;
+        }
+
+        if (run_test) {
+            int failed;
+
+            failed = _run_test(test->name,
+                               test->function,
+                               current_state,
+                               test->function_type,
+                               NULL);
+            if (failed) {
+                failed_names[total_failed] = test->name;
+            }
+
+            total_failed += failed;
+            tests_executed++;
+        }
+    }
+
+    if (teardown != NULL) {
+        int failed;
+
+        failed = _run_test(teardown_name,
+                           teardown,
+                           current_state,
+                           UNIT_TEST_FUNCTION_TYPE_GROUP_TEARDOWN,
+                           group_state.check_point);
+        if (failed) {
+            failed_names[total_failed] = teardown_name;
+        }
+
+        total_failed += failed;
+        tests_executed++;
+    }
+
+    print_message("[==========] %"PRIdS " test(s) run.\n", tests_executed);
+    print_error("[  PASSED  ] %"PRIdS " test(s).\n", tests_executed - total_failed);
+
+    if (total_failed) {
+        print_error("[  FAILED  ] %"PRIdS " test(s), listed below:\n", total_failed);
+        for (i = 0; i < total_failed; i++) {
+            print_error("[  FAILED  ] %s\n", failed_names[i]);
+        }
+    } else {
+        print_error("\n %"PRIdS " FAILED TEST(S)\n", total_failed);
+    }
+
+    free((void*)failed_names);
+    fail_if_blocks_allocated(check_point, "run_group_tests");
+
+    return (int)total_failed;
+}
+
diff --git a/third_party/cmocka/src/cmocka.def b/third_party/cmocka/src/cmocka.def
index 268e1bd..607ad75 100644
--- a/third_party/cmocka/src/cmocka.def
+++ b/third_party/cmocka/src/cmocka.def
@@ -8,10 +8,12 @@ EXPORTS
     _assert_memory_not_equal
     _assert_not_in_range
     _assert_not_in_set
+    _assert_return_code
     _assert_string_equal
     _assert_string_not_equal
     _assert_true
     _check_expected
+    _cmocka_run_group_tests
     _expect_any
     _expect_check
     _expect_in_range
@@ -28,10 +30,13 @@ EXPORTS
     _mock
     _run_test
     _run_tests
+    _skip
     _test_calloc
     _test_free
     _test_malloc
+    _test_realloc
     _will_return
+    cmocka_set_message_output
     global_expect_assert_env
     global_expecting_assert
     global_last_failed_assert
diff --git a/third_party/cmocka/tests/CMakeLists.txt b/third_party/cmocka/tests/CMakeLists.txt
new file mode 100644
index 0000000..2f985a5
--- /dev/null
+++ b/third_party/cmocka/tests/CMakeLists.txt
@@ -0,0 +1,172 @@
+project(tests C)
+
+include_directories(
+  ${CMAKE_BINARY_DIR}
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${CMAKE_SOURCE_DIR}/include
+)
+
+set(CMOCKA_TESTS
+    test_alloc
+    test_group_setup_fail
+    test_fixtures
+    test_group_fixtures
+    test_assert_macros
+    test_assert_macros_fail
+    test_exception_handler
+    test_basics
+    test_skip
+    test_setup_fail)
+
+foreach(_CMOCKA_TEST ${CMOCKA_TESTS})
+    add_cmocka_test(${_CMOCKA_TEST} ${_CMOCKA_TEST}.c ${CMOCKA_STATIC_LIBRARY})
+endforeach()
+
+### Special Cases
+if (${CMAKE_C_COMPILER_ID} MATCHES "(GNU|Clang)")
+    set_source_files_properties(test_cmockery.c PROPERTIES COMPILE_FLAGS "-Wno-deprecated-declarations")
+endif()
+add_cmocka_test(test_cmockery test_cmockery.c ${CMOCKA_STATIC_LIBRARY})
+
+### Exceptions
+
+# test_assert_macros_fail
+set_tests_properties(
+    test_skip
+        PROPERTIES
+        PASS_REGULAR_EXPRESSION
+        "\\[  SKIPPED \\] test_check_skip"
+)
+
+# test_assert_macros_fail
+set_tests_properties(
+    test_assert_macros_fail
+        PROPERTIES
+        PASS_REGULAR_EXPRESSION
+        "\\[  FAILED  \\] 1 test"
+)
+
+# test_exception_handler
+if (WIN32)
+    set_tests_properties(
+        test_exception_handler
+            PROPERTIES
+            PASS_REGULAR_EXPRESSION
+            "EXCEPTION_ACCESS_VIOLATION occurred at")
+else()
+    set_tests_properties(
+        test_exception_handler
+            PROPERTIES
+            PASS_REGULAR_EXPRESSION
+            "Test failed with exception: (Segmentation fault|Segmentation Fault|11)"
+    )
+endif (WIN32)
+
+set_tests_properties(
+    test_setup_fail
+        PROPERTIES
+        WILL_FAIL
+        1
+)
+
+set_tests_properties(
+    test_group_setup_fail
+        PROPERTIES
+        WILL_FAIL
+        1
+)
+
+add_test (test_setup_fail_1_failed test_setup_fail)
+set_tests_properties(
+    test_setup_fail_1_failed
+        PROPERTIES
+        PASS_REGULAR_EXPRESSION
+        "\\[  ERROR   \\] int_test_ignored"
+)
+
+add_test (test_setup_fail_1_passed test_setup_fail)
+set_tests_properties(
+    test_setup_fail_1_passed
+        PROPERTIES
+        PASS_REGULAR_EXPRESSION
+        "\\[  PASSED  \\] 1 test\\(s\\)."
+)
+
+add_test (test_setup_fail_match_failed test_setup_fail)
+set_tests_properties(
+    test_setup_fail_match_failed
+        PROPERTIES
+        PASS_REGULAR_EXPRESSION
+        "\\[  ERROR   \\] int_test_ignored"
+)
+
+add_test (test_setup_fail_match_passed test_setup_fail)
+set_tests_properties(
+    test_setup_fail_match_passed
+        PROPERTIES
+        PASS_REGULAR_EXPRESSION
+        "\\[       OK \\] int_test_success"
+)
+
+### Output formats
+
+# test output of success, failure, skip, fixture failure
+set(OUTPUT_TESTS
+    test_basics
+    test_assert_macros_fail
+    test_skip
+    test_setup_fail)
+
+set(TEST_OUTPUT_FMTS
+    tap
+    subunit
+    xml)
+
+set(test_basics_tap_out
+    "^\t1\\.\\.2[ \n\r]+\tok 1 - null_test_success[ \n\r]+\tok 2 - int_test_success[ \n\r]+ok - tests")
+set(test_assert_macros_fail_tap_out
+    "^\t1\\.\\.1[ \n\r]+\tnot ok 1 - test_assert_return_code_fail[ \n\r]+\t#[^\n\r]+[\n\r]\t#[^\n\r]+[\n\r]not ok - tests")
+
+set(test_skip_tap_out
+    "not ok 1 # SKIP")
+set(test_setup_fail_tap_out
+    "not ok 1 - int_test_ignored Could not run the test - check test fixtures")
+
+set(test_basics_subunit_out
+    "^test: null_test_success[ \n\r]+success: null_test_success")
+set(test_assert_macros_fail_subunit_out
+    "failure: test_assert_return_code_fail \\[")
+set(test_skip_subunit_out
+    "^test: test_check_skip[ \n\r]+skip: test_check_skip")
+set(test_setup_fail_subunit_out
+    "error: int_test_ignored \\[ Could not run the test - check test fixtures \\]")
+
+set(test_basics_xml_out
+    "<testsuite name=\"tests\" time=\"[0-9.]+\" tests=\"2\" failures=\"0\" errors=\"0\" skipped=\"0\" >[ \n\r]+<testcase name=\"null_test_success\" time=\"[0-9.]+\" >.*</testcase>")
+set(test_assert_macros_fail_xml_out
+    "<testcase name=\"test_assert_return_code_fail\" time=\"[0-9.]+\" >[ \n\r]+<failure>")
+set(test_skip_xml_out
+    "<testcase name=\"test_check_skip\" time=\"[0-9.]+\" >[ \n\r]+<skipped/>")
+set(test_setup_fail_xml_out
+    "<testcase name=\"int_test_ignored\" time=\"[0-9.]+\" >[ \n\r]+<failure><!\\[CDATA\\[Test setup failed\\]\\]></failure>")
+
+foreach(_TEST_OUTPUT_FMT ${TEST_OUTPUT_FMTS})
+    foreach(_OUTPUT_TEST ${OUTPUT_TESTS})
+        set(TEST_NAME ${_OUTPUT_TEST}_${_TEST_OUTPUT_FMT})
+        add_test(${TEST_NAME} ${_OUTPUT_TEST})
+
+        set_property(
+            TEST
+            ${TEST_NAME}
+            PROPERTY
+                ENVIRONMENT CMOCKA_MESSAGE_OUTPUT=${_TEST_OUTPUT_FMT}
+            )
+
+            set_tests_properties(
+                    ${TEST_NAME}
+                    PROPERTIES
+                    PASS_REGULAR_EXPRESSION
+                    ${${TEST_NAME}_out}
+            )
+    endforeach()
+endforeach()
diff --git a/third_party/cmocka/tests/ctest-default.cmake b/third_party/cmocka/tests/ctest-default.cmake
new file mode 100644
index 0000000..e21e93c
--- /dev/null
+++ b/third_party/cmocka/tests/ctest-default.cmake
@@ -0,0 +1,74 @@
+## The directory to run ctest in.
+set(CTEST_DIRECTORY "$ENV{HOME}/workspace/tmp/dashboards/cmocka")
+
+## The hostname of the machine
+set(CTEST_SITE "host.cmocka.org")
+## The buildname
+set(CTEST_BUILD_NAME "Linux_GCC_x86_64_default")
+
+## The Makefile generator to use
+set(CTEST_CMAKE_GENERATOR "Unix Makefiles")
+
+## The Build configuration to use.
+set(CTEST_BUILD_CONFIGURATION "Debug")
+
+## The build options for the project
+set(CTEST_BUILD_OPTIONS "-DUNIT_TESTING=ON -DWITH_CMOCKERY_SUPPORT=ON")
+
+#set(CTEST_CUSTOM_MEMCHECK_IGNORE torture_rand)
+
+## The Model to set: Nightly, Continous, Experimental
+set(CTEST_MODEL "Experimental")
+
+## The URL to the git repository
+set(CTEST_GIT_REPOSITORY "git://git.cryptomilk.org/projects/cmocka.git")
+
+## The branch
+#set(CTEST_GIT_BRANCH "--branch v0-5")
+
+## Wether to enable memory checking.
+set(WITH_MEMCHECK FALSE)
+
+## Wether to enable code coverage.
+set(WITH_COVERAGE FALSE)
+
+#######################################################################
+
+if (WITH_COVERAGE AND NOT WIN32)
+    set(CTEST_BUILD_CONFIGURATION "Profiling")
+endif (WITH_COVERAGE AND NOT WIN32)
+
+set(CTEST_SOURCE_DIRECTORY "${CTEST_DIRECTORY}/${CTEST_BUILD_NAME}/source")
+set(CTEST_BINARY_DIRECTORY "${CTEST_DIRECTORY}/${CTEST_BUILD_NAME}/build")
+
+set(CTEST_MEMORYCHECK_SUPPRESSIONS_FILE ${CMAKE_SOURCE_DIR}/tests/valgrind.supp)
+
+find_program(CTEST_GIT_COMMAND NAMES git)
+find_program(CTEST_COVERAGE_COMMAND NAMES gcov)
+find_program(CTEST_MEMORYCHECK_COMMAND NAMES valgrind)
+
+if(NOT EXISTS "${CTEST_SOURCE_DIRECTORY}")
+    set(CTEST_CHECKOUT_COMMAND "${CTEST_GIT_COMMAND} clone ${CTEST_GIT_BRANCH} ${CTEST_GIT_REPOSITORY} ${CTEST_SOURCE_DIRECTORY}")
+endif()
+
+set(CTEST_UPDATE_COMMAND "${CTEST_GIT_COMMAND}")
+
+set(CTEST_CONFIGURE_COMMAND "${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE:STRING=${CTEST_BUILD_CONFIGURATION}")
+set(CTEST_CONFIGURE_COMMAND "${CTEST_CONFIGURE_COMMAND} ${CTEST_BUILD_OPTIONS}")
+set(CTEST_CONFIGURE_COMMAND "${CTEST_CONFIGURE_COMMAND} \"-G${CTEST_CMAKE_GENERATOR}\"")
+set(CTEST_CONFIGURE_COMMAND "${CTEST_CONFIGURE_COMMAND} \"${CTEST_SOURCE_DIRECTORY}\"")
+
+ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY})
+
+ctest_start(${CTEST_MODEL} TRACK ${CTEST_MODEL})
+ctest_update(SOURCE ${CTEST_SOURCE_DIRECTORY})
+ctest_configure(BUILD ${CTEST_BINARY_DIRECTORY})
+ctest_build(BUILD ${CTEST_BINARY_DIRECTORY})
+ctest_test(BUILD ${CTEST_BINARY_DIRECTORY})
+if (WITH_MEMCHECK AND CTEST_COVERAGE_COMMAND)
+  ctest_coverage(BUILD ${CTEST_BINARY_DIRECTORY})
+endif (WITH_MEMCHECK AND CTEST_COVERAGE_COMMAND)
+if (WITH_MEMCHECK AND CTEST_MEMORYCHECK_COMMAND)
+  ctest_memcheck(BUILD ${CTEST_BINARY_DIRECTORY})
+endif (WITH_MEMCHECK AND CTEST_MEMORYCHECK_COMMAND)
+ctest_submit()
diff --git a/third_party/cmocka/tests/test_alloc.c b/third_party/cmocka/tests/test_alloc.c
new file mode 100644
index 0000000..966814a
--- /dev/null
+++ b/third_party/cmocka/tests/test_alloc.c
@@ -0,0 +1,91 @@
+#include "config.h"
+
+#include <stdarg.h>
+#include <stddef.h>
+#include <setjmp.h>
+#include <cmocka.h>
+#include <cmocka_private.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+static void torture_test_malloc(void **state)
+{
+    char *str;
+    size_t str_len;
+    size_t len;
+
+    (void)state; /* unsused */
+
+    str_len = 12;
+    str = (char *)test_malloc(str_len);
+    assert_non_null(str);
+
+    len = snprintf(str, str_len, "test string");
+    assert_int_equal(len, 11);
+
+    len = strlen(str);
+    assert_int_equal(len, 11);
+
+    test_free(str);
+}
+
+static void torture_test_realloc(void **state)
+{
+    char *str;
+    char *tmp;
+    size_t str_len;
+    size_t len;
+
+    (void)state; /* unsused */
+
+    str_len = 16;
+    str = (char *)test_malloc(str_len);
+    assert_non_null(str);
+
+    len = snprintf(str, str_len, "test string 123");
+    assert_int_equal(len, 15);
+
+    len = strlen(str);
+    assert_int_equal(len, 15);
+
+    str_len = 20;
+    tmp = test_realloc(str, str_len);
+    assert_non_null(tmp);
+
+    str = tmp;
+    len = strlen(str);
+    assert_string_equal(tmp, "test string 123");
+
+    snprintf(str + len, str_len - len, "4567");
+    assert_string_equal(tmp, "test string 1234567");
+
+    test_free(str);
+}
+
+static void torture_test_realloc_set0(void **state)
+{
+    char *str;
+    size_t str_len;
+
+    (void)state; /* unsused */
+
+    str_len = 16;
+    str = (char *)test_malloc(str_len);
+    assert_non_null(str);
+
+    /* realloc(ptr, 0) is like a free() */
+    str = (char *)test_realloc(str, 0);
+    assert_null(str);
+}
+
+int main(void) {
+    const struct CMUnitTest alloc_tests[] = {
+        cmocka_unit_test(torture_test_malloc),
+        cmocka_unit_test(torture_test_realloc),
+        cmocka_unit_test(torture_test_realloc_set0),
+    };
+
+    return cmocka_run_group_tests(alloc_tests, NULL, NULL);
+}
diff --git a/third_party/cmocka/tests/test_assert_macros.c b/third_party/cmocka/tests/test_assert_macros.c
new file mode 100644
index 0000000..85b0a38
--- /dev/null
+++ b/third_party/cmocka/tests/test_assert_macros.c
@@ -0,0 +1,41 @@
+#include "config.h"
+
+#include <stdarg.h>
+#include <stddef.h>
+#include <setjmp.h>
+#include <cmocka.h>
+#include <cmocka_private.h>
+
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <fcntl.h>
+
+/**************************************
+ *** assert_return_code
+ **************************************/
+static void test_assert_return_code(void **state)
+{
+    struct stat sb;
+    int rc;
+
+    (void)state; /* unused */
+
+    rc = stat(".", &sb);
+    assert_return_code(rc, 0);
+
+#ifndef _MSC_VER
+    assert_true(S_ISDIR(sb.st_mode));
+#endif
+}
+
+int main(void) {
+    const struct CMUnitTest tests[] = {
+        cmocka_unit_test(test_assert_return_code),
+    };
+
+    return cmocka_run_group_tests(tests, NULL, NULL);
+}
diff --git a/third_party/cmocka/tests/test_assert_macros_fail.c b/third_party/cmocka/tests/test_assert_macros_fail.c
new file mode 100644
index 0000000..aea919a
--- /dev/null
+++ b/third_party/cmocka/tests/test_assert_macros_fail.c
@@ -0,0 +1,43 @@
+#include "config.h"
+
+#include <stdarg.h>
+#include <stddef.h>
+#include <setjmp.h>
+#include <cmocka.h>
+#include <cmocka_private.h>
+
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
+#include <fcntl.h>
+
+/**************************************
+ *** assert_return_code
+ **************************************/
+static void test_assert_return_code_fail(void **state)
+{
+    int fd;
+
+    (void)state; /* unused */
+
+    fd = open("this_file_doesnt_exist.cmocka", 0);
+    assert_return_code(fd, errno);
+
+    if (fd >= 0) {
+        close(fd);
+    }
+}
+
+int main(void) {
+    const struct CMUnitTest tests[] = {
+        cmocka_unit_test(test_assert_return_code_fail),
+    };
+
+    return cmocka_run_group_tests(tests, NULL, NULL);
+}
diff --git a/third_party/cmocka/tests/test_basics.c b/third_party/cmocka/tests/test_basics.c
new file mode 100644
index 0000000..1bb493f
--- /dev/null
+++ b/third_party/cmocka/tests/test_basics.c
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2008 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* Use the unit test allocators */
+#define UNIT_TESTING 1
+
+#include <stdarg.h>
+#include <stddef.h>
+#include <setjmp.h>
+#include <cmocka.h>
+
+static int setup(void **state) {
+    int *answer = malloc(sizeof(int));
+
+    assert_non_null(answer);
+    *answer = 42;
+
+    *state = answer;
+
+    return 0;
+}
+
+static int teardown(void **state) {
+    free(*state);
+
+    return 0;
+}
+
+/* A test case that does nothing and succeeds. */
+static void null_test_success(void **state) {
+    (void) state;
+}
+
+/* A test case that does check if an int is equal. */
+static void int_test_success(void **state) {
+    int *answer = *state;
+
+    assert_int_equal(*answer, 42);
+}
+
+
+int main(void) {
+    const struct CMUnitTest tests[] = {
+        cmocka_unit_test(null_test_success),
+        cmocka_unit_test_setup_teardown(int_test_success, setup, teardown),
+    };
+
+    return cmocka_run_group_tests(tests, NULL, NULL);
+}
diff --git a/third_party/cmocka/tests/test_cmockery.c b/third_party/cmocka/tests/test_cmockery.c
new file mode 100644
index 0000000..83a7451
--- /dev/null
+++ b/third_party/cmocka/tests/test_cmockery.c
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2008 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdarg.h>
+#include <stddef.h>
+#include <setjmp.h>
+#include <cmockery/cmockery.h>
+
+/* A test case that does nothing and succeeds. */
+static void null_test_success(void **state) {
+    (void) state; /* unused */
+}
+
+int main(void) {
+    const UnitTest tests[] = {
+        unit_test(null_test_success),
+    };
+    return run_tests(tests);
+}
diff --git a/third_party/cmocka/tests/test_exception_handler.c b/third_party/cmocka/tests/test_exception_handler.c
new file mode 100644
index 0000000..94c6842
--- /dev/null
+++ b/third_party/cmocka/tests/test_exception_handler.c
@@ -0,0 +1,28 @@
+#include <stdarg.h>
+#include <stddef.h>
+#include <setjmp.h>
+#include <cmocka.h>
+
+#include <stdlib.h>
+
+struct test_segv {
+    int x;
+    int y;
+};
+
+static void test_segfault_recovery(void **state)
+{
+    struct test_segv *s = NULL;
+
+    (void) state; /* unused */
+
+    s->x = 1;
+}
+
+int main(void) {
+    const struct CMUnitTest tests[] = {
+        cmocka_unit_test(test_segfault_recovery),
+    };
+
+    return cmocka_run_group_tests(tests, NULL, NULL);
+}
diff --git a/third_party/cmocka/tests/test_fixtures.c b/third_party/cmocka/tests/test_fixtures.c
new file mode 100644
index 0000000..4597626
--- /dev/null
+++ b/third_party/cmocka/tests/test_fixtures.c
@@ -0,0 +1,45 @@
+#include <stdarg.h>
+#include <stddef.h>
+#include <setjmp.h>
+#include <cmocka.h>
+
+#include <stdlib.h>
+
+static int setup_only(void **state)
+{
+    *state = malloc(1);
+
+    return 0;
+}
+
+static int teardown_only(void **state)
+{
+    free(*state);
+
+    return 0;
+}
+
+static void malloc_setup_test(void **state)
+{
+    assert_non_null(*state);
+    free(*state);
+}
+
+static void malloc_teardown_test(void **state)
+{
+    *state = malloc(1);
+    assert_non_null(*state);
+}
+
+int main(void) {
+    const struct CMUnitTest tests[] = {
+        cmocka_unit_test_setup(malloc_setup_test, setup_only),
+        cmocka_unit_test_setup(malloc_setup_test, setup_only),
+        cmocka_unit_test_teardown(malloc_teardown_test, teardown_only),
+        cmocka_unit_test_teardown(malloc_teardown_test, teardown_only),
+        cmocka_unit_test_teardown(malloc_teardown_test, teardown_only),
+        cmocka_unit_test_teardown(malloc_teardown_test, teardown_only),
+    };
+
+    return cmocka_run_group_tests(tests, NULL, NULL);
+}
diff --git a/third_party/cmocka/tests/test_group_fixtures.c b/third_party/cmocka/tests/test_group_fixtures.c
new file mode 100644
index 0000000..09f39b1
--- /dev/null
+++ b/third_party/cmocka/tests/test_group_fixtures.c
@@ -0,0 +1,48 @@
+/* Use the unit test allocators */
+#define UNIT_TESTING 1
+
+#include <stdarg.h>
+#include <stddef.h>
+#include <setjmp.h>
+#include <cmocka.h>
+
+static int group_setup(void **state)
+{
+    int *answer = malloc(sizeof(int));
+    assert_non_null(answer);
+    *answer = 42;
+
+    *state = answer;
+    return 0;
+}
+
+static int group_teardown(void **state)
+{
+    int *answer = (int *)*state;
+
+    free(answer);
+    return 0;
+}
+
+static void test_value_equal(void **state)
+{
+    int a = *((int *)*state);
+
+    assert_int_equal(a, 42);
+}
+
+static void test_value_range(void **state)
+{
+    int a = *((int *)*state);
+
+    assert_in_range(a, 0, 100);
+}
+
+int main(void) {
+    const struct CMUnitTest tests[] = {
+        cmocka_unit_test(test_value_equal),
+        cmocka_unit_test(test_value_range),
+    };
+
+    return cmocka_run_group_tests(tests, group_setup, group_teardown);
+}
diff --git a/third_party/cmocka/tests/test_group_setup_fail.c b/third_party/cmocka/tests/test_group_setup_fail.c
new file mode 100644
index 0000000..7815c03
--- /dev/null
+++ b/third_party/cmocka/tests/test_group_setup_fail.c
@@ -0,0 +1,34 @@
+/* Use the unit test allocators */
+#define UNIT_TESTING 1
+
+#include <stdarg.h>
+#include <stddef.h>
+#include <setjmp.h>
+#include <cmocka.h>
+
+static int group_setup_failing(void **state)
+{
+    (void) state; /* unused */
+    return 1; /* To indicate the failure */
+}
+
+static void test_true(void **state)
+{
+    (void) state; /* unused */
+    assert_true(1);
+}
+
+static void test_false(void **state)
+{
+    (void) state; /* unused */
+    assert_false(0);
+}
+
+int main(void) {
+    const struct CMUnitTest tests[] = {
+        cmocka_unit_test(test_true),
+        cmocka_unit_test(test_false),
+    };
+
+    return cmocka_run_group_tests(tests, group_setup_failing, NULL);
+}
diff --git a/third_party/cmocka/tests/test_setup_fail.c b/third_party/cmocka/tests/test_setup_fail.c
new file mode 100644
index 0000000..e3f8df8
--- /dev/null
+++ b/third_party/cmocka/tests/test_setup_fail.c
@@ -0,0 +1,54 @@
+#define UNIT_TESTING 1
+
+#include <stdarg.h>
+#include <stddef.h>
+#include <setjmp.h>
+#include <cmocka.h>
+
+static int setup_fail(void **state) {
+    *state = NULL;
+
+    /* We need to fail in setup */
+    return -1;
+}
+
+static void int_test_ignored(void **state) {
+    /* should not be called */
+    assert_non_null(*state);
+}
+
+static int setup_ok(void **state) {
+    int *answer;
+
+    answer = malloc(sizeof(int));
+    if (answer == NULL) {
+        return -1;
+    }
+    *answer = 42;
+
+    *state = answer;
+
+    return 0;
+}
+
+/* A test case that does check if an int is equal. */
+static void int_test_success(void **state) {
+    int *answer = *state;
+
+    assert_int_equal(*answer, 42);
+}
+
+static int teardown(void **state) {
+    free(*state);
+
+    return 0;
+}
+
+int main(void) {
+    const struct CMUnitTest tests[] = {
+        cmocka_unit_test_setup_teardown(int_test_ignored, setup_fail, teardown),
+        cmocka_unit_test_setup_teardown(int_test_success, setup_ok, teardown),
+    };
+
+    return cmocka_run_group_tests(tests, NULL, NULL);
+}
diff --git a/third_party/cmocka/tests/test_skip.c b/third_party/cmocka/tests/test_skip.c
new file mode 100644
index 0000000..127161a
--- /dev/null
+++ b/third_party/cmocka/tests/test_skip.c
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2008 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdarg.h>
+#include <stddef.h>
+#include <setjmp.h>
+#include <cmocka.h>
+
+/* A test case that does check if an int is equal. */
+static void test_check_skip(void **state) {
+    (void)state; /* unused */
+
+    skip();
+
+    assert_true(0);
+}
+
+
+int main(void) {
+    const struct CMUnitTest tests[] = {
+        cmocka_unit_test(test_check_skip),
+    };
+
+    return cmocka_run_group_tests(tests, NULL, NULL);
+}
+
-- 
2.6.2



More information about the waffle mailing list