tests FEATURE include tests into build system
basic tests of ly_set implementation
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0202a3a..6827dc0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -21,19 +21,19 @@
set(CMAKE_BUILD_TYPE debug)
endif()
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -std=c89")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -std=c99")
set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG")
set(CMAKE_C_FLAGS_PACKAGE "-g -O2 -DNDEBUG")
set(CMAKE_C_FLAGS_DEBUG "-g -O0")
# options
-#if((CMAKE_BUILD_TYPE STREQUAL debug) OR (CMAKE_BUILD_TYPE STREQUAL Package))
-# option(ENABLE_BUILD_TESTS "Build tests" ON)
-# option(ENABLE_VALGRIND_TESTS "Build tests with valgrind" ON)
-#else()
-# option(ENABLE_BUILD_TESTS "Build tests" OFF)
-# option(ENABLE_VALGRIND_TESTS "Build tests with valgrind" OFF)
-#endif()
+if((CMAKE_BUILD_TYPE STREQUAL debug) OR (CMAKE_BUILD_TYPE STREQUAL Package))
+ option(ENABLE_BUILD_TESTS "Build tests" ON)
+ option(ENABLE_VALGRIND_TESTS "Build tests with valgrind" ON)
+else()
+ option(ENABLE_BUILD_TESTS "Build tests" OFF)
+ option(ENABLE_VALGRIND_TESTS "Build tests with valgrind" OFF)
+endif()
#option(ENABLE_CALLGRIND_TESTS "Build performance tests to be run with callgrind" OFF)
#option(ENABLE_CACHE "Enable data caching for schemas and hash tables for data (time-efficient at the cost of increased space-complexity)" ON)
@@ -270,12 +270,12 @@
# YANG extensions plugins
#set(EXTENSIONS_LIST "nacm" "metadata" "yangdata")
# if the tests are enabled, build libyang_ext_test
-#if(ENABLE_BUILD_TESTS)
-# find_package(CMocka 1.0.0)
+if(ENABLE_BUILD_TESTS)
+ find_package(CMocka 1.0.0)
# if(CMOCKA_FOUND AND CMAKE_BUILD_TYPE MATCHES debug)
# list(APPEND EXTENSIONS_LIST "libyang_ext_test")
# endif(CMOCKA_FOUND AND CMAKE_BUILD_TYPE MATCHES debug)
-#endif(ENABLE_BUILD_TESTS)
+endif(ENABLE_BUILD_TESTS)
#if(ENABLE_STATIC)
# set(EXTENSIONS_LIST_SIZE " 0 ")
@@ -327,19 +327,19 @@
# yang2yin
#add_executable(yang2yin ${yang2yinsrc})
-#if(ENABLE_VALGRIND_TESTS)
-# set(ENABLE_BUILD_TESTS ON)
-#endif()
+if(ENABLE_VALGRIND_TESTS)
+ set(ENABLE_BUILD_TESTS ON)
+endif()
-#if(ENABLE_BUILD_TESTS)
-# if(CMOCKA_FOUND)
-# enable_testing()
-# add_subdirectory(tests)
-# else(CMOCKA_FOUND)
-# message(STATUS "Disabling tests because of missing CMocka")
-# set(ENABLE_BUILD_TESTS NO)
-# endif(CMOCKA_FOUND)
-#endif(ENABLE_BUILD_TESTS)
+if(ENABLE_BUILD_TESTS)
+ if(CMOCKA_FOUND)
+ enable_testing()
+ add_subdirectory(tests)
+ else(CMOCKA_FOUND)
+ message(STATUS "Disabling tests because of missing CMocka")
+ set(ENABLE_BUILD_TESTS NO)
+ endif(CMOCKA_FOUND)
+endif(ENABLE_BUILD_TESTS)
#if(GEN_LANGUAGE_BINDINGS AND GEN_CPP_BINDINGS)
# add_subdirectory(swig)