tests: enable fast_atof() benchmark check only for release builds

This commit is contained in:
Hugues Delorme 2016-01-13 10:55:59 +01:00
parent 775c756818
commit 9dc842a35d
3 changed files with 13 additions and 0 deletions

View File

@ -43,6 +43,14 @@ if(CMAKE_COMPILER_IS_GNUCC
set(CMAKE_C_COMPILER_IS_GCC_COMPATIBLE 1) # Compatible with GNUCC options
endif()
# Build type
string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWER)
if(CMAKE_BUILD_TYPE_LOWER MATCHES "debug")
set(GMIO_DEBUG_BUILD 1)
else()
set(GMIO_DEBUG_BUILD 0)
endif()
# Options
option(GMIO_BUILD_STRICT_C90 "Build gmio library(and tests) with strict conformance to C90 standard" OFF)
option(GMIO_BUILD_SHARED_LIBS "Build gmio as a shared library (DLL)" OFF)

View File

@ -18,6 +18,9 @@
#ifndef GMIO_CONFIG_H_CMAKE
#define GMIO_CONFIG_H_CMAKE
/* Build type */
#cmakedefine GMIO_DEBUG_BUILD
/* Size(in bytes) of integer types */
#cmakedefine GMIO_SIZEOF_SHORT @GMIO_SIZEOF_SHORT@
#cmakedefine GMIO_SIZEOF_INT @GMIO_SIZEOF_INT@

View File

@ -177,7 +177,9 @@ const char* test_internal__benchmark_gmio_fast_atof()
header,
bmk_res_array);
#ifndef GMIO_DEBUG_BUILD /* Check only for release builds */
UTEST_ASSERT((1.2*bmk_res.func1_exec_time_ms) < bmk_res.func2_exec_time_ms);
#endif
return NULL;
}