Commit a6e63f3a authored by Ken Martin's avatar Ken Martin

ENH: added test for elseif

parent 5e46232a
......@@ -271,6 +271,44 @@ ENDWHILE(while_var LESS 1000)
SET(SHOULD_BE_ZERO )
SET(SHOULD_BE_ONE 1)
# test elseif functionality, the mess below tries to catch problem
# of clauses being executed early or late etc
set (RESULT 3)
if (RESULT EQUAL 1)
if (RESULT EQUAL 2)
set (ELSEIF_RESULT 1)
elseif (RESULT EQUAL 3)
set (ELSEIF_RESULT 1)
endif (RESULT EQUAL 2)
elseif (RESULT EQUAL 2)
set (ELSEIF_RESULT 1)
elseif (RESULT EQUAL 3)
if (RESULT EQUAL 2)
set (ELSEIF_RESULT 1)
elseif (RESULT EQUAL 3)
if (NOT ELSEIF_RESULT EQUAL 1)
set (ELSEIF_RESULT 2)
endif (NOT ELSEIF_RESULT EQUAL 1)
endif (RESULT EQUAL 2)
elseif (RESULT EQUAL 4)
if (RESULT EQUAL 2)
set (ELSEIF_RESULT 1)
elseif (RESULT EQUAL 3)
set (ELSEIF_RESULT 1)
endif (RESULT EQUAL 2)
else (RESULT EQUAL 1)
if (RESULT EQUAL 2)
set (ELSEIF_RESULT 1)
elseif (RESULT EQUAL 3)
set (ELSEIF_RESULT 1)
endif (RESULT EQUAL 2)
endif (RESULT EQUAL 1)
if (NOT ELSEIF_RESULT EQUAL 2)
set (ELSEIF_RESULT 0)
endif (NOT ELSEIF_RESULT EQUAL 2)
#
# Configure file
# (plug vars to #define so that they can be tested)
......@@ -303,6 +341,7 @@ IF(NOT STRING_REGEX_PASSED)
"STRING(REGEX REPLACE ... ) test failed (\"${RESULT}\" v. \"a[b]c[d]e\")")
ENDIF(NOT STRING_REGEX_PASSED)
#
# Create the libs and the main exe
#
......
......@@ -444,6 +444,12 @@ int main()
cmPassed("COMPILE_FLAGS did work with SET_TARGET_PROPERTIES");
#endif
#ifdef ELSEIF_RESULT
cmPassed("ELSEIF did work");
#else
cmFailed("ELSEIF did not work");
#endif
if(file2() != 1)
{
cmFailed("Call to file2 function from library failed.");
......
......@@ -77,3 +77,6 @@
#define CMAKE_SHARED_MODULE_PREFIX "${CMAKE_SHARED_MODULE_PREFIX}"
#define CMAKE_SHARED_MODULE_SUFFIX "${CMAKE_SHARED_MODULE_SUFFIX}"
// test elseif
#cmakedefine ELSEIF_RESULT
......@@ -271,6 +271,44 @@ ENDWHILE(while_var LESS 1000)
SET(SHOULD_BE_ZERO )
SET(SHOULD_BE_ONE 1)
# test elseif functionality, the mess below tries to catch problem
# of clauses being executed early or late etc
set (RESULT 3)
if (RESULT EQUAL 1)
if (RESULT EQUAL 2)
set (ELSEIF_RESULT 1)
elseif (RESULT EQUAL 3)
set (ELSEIF_RESULT 1)
endif (RESULT EQUAL 2)
elseif (RESULT EQUAL 2)
set (ELSEIF_RESULT 1)
elseif (RESULT EQUAL 3)
if (RESULT EQUAL 2)
set (ELSEIF_RESULT 1)
elseif (RESULT EQUAL 3)
if (NOT ELSEIF_RESULT EQUAL 1)
set (ELSEIF_RESULT 2)
endif (NOT ELSEIF_RESULT EQUAL 1)
endif (RESULT EQUAL 2)
elseif (RESULT EQUAL 4)
if (RESULT EQUAL 2)
set (ELSEIF_RESULT 1)
elseif (RESULT EQUAL 3)
set (ELSEIF_RESULT 1)
endif (RESULT EQUAL 2)
else (RESULT EQUAL 1)
if (RESULT EQUAL 2)
set (ELSEIF_RESULT 1)
elseif (RESULT EQUAL 3)
set (ELSEIF_RESULT 1)
endif (RESULT EQUAL 2)
endif (RESULT EQUAL 1)
if (NOT ELSEIF_RESULT EQUAL 2)
set (ELSEIF_RESULT 0)
endif (NOT ELSEIF_RESULT EQUAL 2)
#
# Configure file
# (plug vars to #define so that they can be tested)
......@@ -303,6 +341,7 @@ IF(NOT STRING_REGEX_PASSED)
"STRING(REGEX REPLACE ... ) test failed (\"${RESULT}\" v. \"a[b]c[d]e\")")
ENDIF(NOT STRING_REGEX_PASSED)
#
# Create the libs and the main exe
#
......
......@@ -444,6 +444,12 @@ int main()
cmPassed("COMPILE_FLAGS did work with SET_TARGET_PROPERTIES");
#endif
#ifdef ELSEIF_RESULT
cmPassed("ELSEIF did work");
#else
cmFailed("ELSEIF did not work");
#endif
if(file2() != 1)
{
cmFailed("Call to file2 function from library failed.");
......
......@@ -77,3 +77,6 @@
#define CMAKE_SHARED_MODULE_PREFIX "${CMAKE_SHARED_MODULE_PREFIX}"
#define CMAKE_SHARED_MODULE_SUFFIX "${CMAKE_SHARED_MODULE_SUFFIX}"
// test elseif
#cmakedefine ELSEIF_RESULT
......@@ -271,6 +271,44 @@ ENDWHILE(while_var LESS 1000)
SET(SHOULD_BE_ZERO )
SET(SHOULD_BE_ONE 1)
# test elseif functionality, the mess below tries to catch problem
# of clauses being executed early or late etc
set (RESULT 3)
if (RESULT EQUAL 1)
if (RESULT EQUAL 2)
set (ELSEIF_RESULT 1)
elseif (RESULT EQUAL 3)
set (ELSEIF_RESULT 1)
endif (RESULT EQUAL 2)
elseif (RESULT EQUAL 2)
set (ELSEIF_RESULT 1)
elseif (RESULT EQUAL 3)
if (RESULT EQUAL 2)
set (ELSEIF_RESULT 1)
elseif (RESULT EQUAL 3)
if (NOT ELSEIF_RESULT EQUAL 1)
set (ELSEIF_RESULT 2)
endif (NOT ELSEIF_RESULT EQUAL 1)
endif (RESULT EQUAL 2)
elseif (RESULT EQUAL 4)
if (RESULT EQUAL 2)
set (ELSEIF_RESULT 1)
elseif (RESULT EQUAL 3)
set (ELSEIF_RESULT 1)
endif (RESULT EQUAL 2)
else (RESULT EQUAL 1)
if (RESULT EQUAL 2)
set (ELSEIF_RESULT 1)
elseif (RESULT EQUAL 3)
set (ELSEIF_RESULT 1)
endif (RESULT EQUAL 2)
endif (RESULT EQUAL 1)
if (NOT ELSEIF_RESULT EQUAL 2)
set (ELSEIF_RESULT 0)
endif (NOT ELSEIF_RESULT EQUAL 2)
#
# Configure file
# (plug vars to #define so that they can be tested)
......@@ -303,6 +341,7 @@ IF(NOT STRING_REGEX_PASSED)
"STRING(REGEX REPLACE ... ) test failed (\"${RESULT}\" v. \"a[b]c[d]e\")")
ENDIF(NOT STRING_REGEX_PASSED)
#
# Create the libs and the main exe
#
......
......@@ -444,6 +444,12 @@ int main()
cmPassed("COMPILE_FLAGS did work with SET_TARGET_PROPERTIES");
#endif
#ifdef ELSEIF_RESULT
cmPassed("ELSEIF did work");
#else
cmFailed("ELSEIF did not work");
#endif
if(file2() != 1)
{
cmFailed("Call to file2 function from library failed.");
......
......@@ -77,3 +77,6 @@
#define CMAKE_SHARED_MODULE_PREFIX "${CMAKE_SHARED_MODULE_PREFIX}"
#define CMAKE_SHARED_MODULE_SUFFIX "${CMAKE_SHARED_MODULE_SUFFIX}"
// test elseif
#cmakedefine ELSEIF_RESULT
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment