diff options
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/Fortran/CMakeLists.txt | 3 | ||||
-rw-r--r-- | Tests/Fortran/test_preprocess.F90 | 55 |
2 files changed, 58 insertions, 0 deletions
diff --git a/Tests/Fortran/CMakeLists.txt b/Tests/Fortran/CMakeLists.txt index 3a299b2..54f18d0 100644 --- a/Tests/Fortran/CMakeLists.txt +++ b/Tests/Fortran/CMakeLists.txt @@ -23,6 +23,9 @@ IF(CMAKE_Fortran_COMPILER_SUPPORTS_F90) in_interface/main.f90 in_interface/module.f90) + ADD_DEFINITIONS(-DFOO -DBAR=1) + ADD_EXECUTABLE(test_preprocess test_preprocess.F90) + SET(TEST_MODULE_DEPENDS 1) ENDIF(CMAKE_Fortran_COMPILER_SUPPORTS_F90) diff --git a/Tests/Fortran/test_preprocess.F90 b/Tests/Fortran/test_preprocess.F90 new file mode 100644 index 0000000..374a6ff --- /dev/null +++ b/Tests/Fortran/test_preprocess.F90 @@ -0,0 +1,55 @@ +MODULE Available +! no conent +END MODULE + +PROGRAM PPTEST +! value of InPPFalseBranch ; values of SkipToEnd +! 0 <empty> +#ifndef FOO + ! 1 ; <0> + USE NotAvailable +# ifndef FOO + ! 2 ; <0,0> + USE NotAvailable +# else + ! 2 ; <0,0> + USE NotAvailable +# endif + ! 1 ; <0> +# ifdef FOO + ! 2 ; <0,1> + USE NotAvailable +# else + ! 2 ; <0,1> + USE NotAvailable +# endif + ! 1 ; <0> +#else + ! 0 ; <0> + USE Available +# ifndef FOO + ! 1 ; <0,0> + USE NotAvailable +# else + ! 0 ; <0,0> + USE Available +# endif + ! 0 ; <0> +# ifdef FOO + ! 0 ; <0,1> + USE Available +# else + ! 1 ; <0,1> + USE NotAvailable +# endif + ! 0 ; <0> +#endif +! 0 ; <empty> + +#ifdef BAR + PRINT * , 'BAR was defined via ADD_DEFINITIONS' +#else + PRINT *, 'If you can read this something went wrong' +#endif + +END PROGRAM |