Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added more tests cases (those located into Fox_library/test folder. #40

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ PROJECT(FoX Fortran)

SET(CMAKE_VERBOSE_MAKEFILE FALSE)

CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

#======================#
# Enable testing
#======================#

SET(BUILD_TESTING OFF CACHE STRING "")
ENABLE_TESTING()
INCLUDE(CTest)

Expand Down
4 changes: 4 additions & 0 deletions dom/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,7 @@ target_link_libraries(
${PROJECT_NAME}_wxml
${PROJECT_NAME}_sax
)

IF(${BUILD_TESTING})
ADD_SUBDIRECTORY(test)
ENDIF()
25 changes: 25 additions & 0 deletions dom/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

#################################################################
# FoX DOM tests
#################################################################

FILE(GLOB_RECURSE TESTS_DOM_SRC *.f90 *.F90)


FOREACH(TEST_SRC ${TESTS_DOM_SRC})

GET_FILENAME_COMPONENT(EXE_NAME ${TEST_SRC} NAME_WE)
ADD_EXECUTABLE(${EXE_NAME} ${TEST_SRC})
TARGET_LINK_LIBRARIES(${EXE_NAME} ${PROJECT_NAME}_dom)
TARGET_LINK_LIBRARIES(${EXE_NAME} ${PROJECT_NAME}_sax)
TARGET_LINK_LIBRARIES(${EXE_NAME} ${PROJECT_NAME}_common)
TARGET_LINK_LIBRARIES(${EXE_NAME} ${PROJECT_NAME}_fsys)
FOREACH (EXT_LIB ${EXT_LIBS})
IF(DEFINED ${PROJECT_NAME}_ENABLE_${EXT_LIB} AND ${PROJECT_NAME}_ENABLE_${EXT_LIB} AND ${EXT_LIB}_FOUND)
TARGET_LINK_LIBRARIES(${EXE_NAME} ${${EXT_LIB}_LIBRARIES})
ENDIF()
ENDFOREACH()
ADD_CUSTOM_COMMAND(TARGET ${EXE_NAME} PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/wcml/test/test_cmlDumpDec_1.input ${PROJECT_BINARY_DIR}/wcml/test)
ADD_TEST(${EXE_NAME}_TEST ${EXECUTABLE_OUTPUT_PATH}/${EXE_NAME})
ENDFOREACH()

4 changes: 4 additions & 0 deletions sax/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ target_link_libraries(
${PROJECT_NAME}_utils
${PROJECT_NAME}_fsys
)

IF(${BUILD_TESTING})
ADD_SUBDIRECTORY(test)
ENDIF()
28 changes: 28 additions & 0 deletions sax/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

#################################################################
# FoX SAX tests
#################################################################

FILE(GLOB_RECURSE TESTS_SAX_SRC *.f90 *.F90)

FOREACH(TEST_SRC ${TESTS_SAX_SRC})
GET_FILENAME_COMPONENT(EXE_NAME ${TEST_SRC} NAME)
IF(NOT (${EXE_NAME} STREQUAL "m_canonicalize.f90") AND NOT (${EXE_NAME} STREQUAL "m_handlers.f90"))
ADD_EXECUTABLE(${EXE_NAME} ${TEST_SRC})
TARGET_SOURCES(${EXE_NAME} PUBLIC m_handlers.f90)
TARGET_LINK_LIBRARIES(${EXE_NAME} ${PROJECT_NAME}_sax)
TARGET_LINK_LIBRARIES(${EXE_NAME} ${PROJECT_NAME}_common)
TARGET_LINK_LIBRARIES(${EXE_NAME} ${PROJECT_NAME}_fsys)
FOREACH (EXT_LIB ${EXT_LIBS})
IF(DEFINED ${PROJECT_NAME}_ENABLE_${EXT_LIB} AND ${PROJECT_NAME}_ENABLE_${EXT_LIB} AND ${EXT_LIB}_FOUND)
TARGET_LINK_LIBRARIES(${EXE_NAME} ${${EXT_LIB}_LIBRARIES})
ENDIF()
ENDFOREACH()
ADD_CUSTOM_COMMAND(TARGET ${EXE_NAME} PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/sax/test/test_sax_fsm_1.in ${PROJECT_BINARY_DIR}/sax/test)
ADD_CUSTOM_COMMAND(TARGET ${EXE_NAME} PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/sax/test/test_sax_reader_1.in ${PROJECT_BINARY_DIR}/sax/test)
ADD_CUSTOM_COMMAND(TARGET ${EXE_NAME} PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/sax/test/testin.xml ${PROJECT_BINARY_DIR}/sax/test)
ADD_TEST(${EXE_NAME}_TEST ${EXECUTABLE_OUTPUT_PATH}/${EXE_NAME})
ENDIF()
ENDFOREACH()


3 changes: 2 additions & 1 deletion sax/test/m_canonicalize.f90
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ subroutine begin_element_handler(URI, localname, name,attributes)
type(dictionary_t), intent(in) :: attributes

write(unit=*,fmt="(4a)") ">>Begin Element: {", URI, "}", localname
write(unit=*,fmt="(a,i2,a)") "--- ", len(attributes), " attributes:"
write(unit=*,fmt="(a,i2,a)") "--- ", getLength(attributes), " attributes:"
! write(unit=*,fmt="(a,i2,a)") "--- ", len(attributes), " attributes:"
call print_dict(attributes)
end subroutine begin_element_handler

Expand Down
4 changes: 4 additions & 0 deletions wcml/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,7 @@ target_link_libraries(
${PROJECT_NAME}_utils
${PROJECT_NAME}_wxml
)

IF(${BUILD_TESTING})
ADD_SUBDIRECTORY(test)
ENDIF()
25 changes: 25 additions & 0 deletions wcml/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

#################################################################
# FoX Wxml tests
#################################################################

FILE(GLOB_RECURSE TESTS_WCML_SRC *.f90 *.F90)


FOREACH(TEST_SRC ${TESTS_WCML_SRC})

GET_FILENAME_COMPONENT(EXE_NAME ${TEST_SRC} NAME_WE)
ADD_EXECUTABLE(${EXE_NAME} ${TEST_SRC})
TARGET_LINK_LIBRARIES(${EXE_NAME} ${PROJECT_NAME}_wcml)
TARGET_LINK_LIBRARIES(${EXE_NAME} ${PROJECT_NAME}_wxml)
TARGET_LINK_LIBRARIES(${EXE_NAME} ${PROJECT_NAME}_common)
TARGET_LINK_LIBRARIES(${EXE_NAME} ${PROJECT_NAME}_fsys)
FOREACH (EXT_LIB ${EXT_LIBS})
IF(DEFINED ${PROJECT_NAME}_ENABLE_${EXT_LIB} AND ${PROJECT_NAME}_ENABLE_${EXT_LIB} AND ${EXT_LIB}_FOUND)
TARGET_LINK_LIBRARIES(${EXE_NAME} ${${EXT_LIB}_LIBRARIES})
ENDIF()
ENDFOREACH()
ADD_CUSTOM_COMMAND(TARGET ${EXE_NAME} PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/wcml/test/test_cmlDumpDec_1.input ${PROJECT_BINARY_DIR}/wcml/test)
ADD_TEST(${EXE_NAME}_TEST ${EXECUTABLE_OUTPUT_PATH}/${EXE_NAME})
ENDFOREACH()

3 changes: 3 additions & 0 deletions wkml/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,6 @@ target_link_libraries(
${PROJECT_NAME}_wxml
)

IF(${BUILD_TESTING})
ADD_SUBDIRECTORY(test)
ENDIF()
29 changes: 29 additions & 0 deletions wkml/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

#################################################################
# FoX Wkml tests
#################################################################

FILE(GLOB_RECURSE TESTS_WKML_SRC *.f90 *.F90)

FOREACH(TEST_SRC ${TESTS_WKML_SRC})

GET_FILENAME_COMPONENT(EXE_NAME ${TEST_SRC} NAME_WE)
IF(NOT (${EXE_NAME} STREQUAL "m_contours_test_data_sp"))
ADD_EXECUTABLE(${EXE_NAME} ${TEST_SRC})
TARGET_SOURCES(${EXE_NAME} PUBLIC m_contours_test_data_sp.f90)
TARGET_LINK_LIBRARIES(${EXE_NAME} ${PROJECT_NAME}_wkml)
TARGET_LINK_LIBRARIES(${EXE_NAME} ${PROJECT_NAME}_wxml)
TARGET_LINK_LIBRARIES(${EXE_NAME} ${PROJECT_NAME}_common)
TARGET_LINK_LIBRARIES(${EXE_NAME} ${PROJECT_NAME}_fsys)
FOREACH (EXT_LIB ${EXT_LIBS})
IF(DEFINED ${PROJECT_NAME}_ENABLE_${EXT_LIB} AND ${PROJECT_NAME}_ENABLE_${EXT_LIB} AND ${EXT_LIB}_FOUND)
TARGET_LINK_LIBRARIES(${EXE_NAME} ${${EXT_LIB}_LIBRARIES})
ENDIF()
ENDFOREACH()
ADD_CUSTOM_COMMAND(TARGET ${EXE_NAME} PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/sax/test/testin.xml ${PROJECT_BINARY_DIR}/sax/test)
ADD_TEST(${EXE_NAME}_TEST ${EXECUTABLE_OUTPUT_PATH}/${EXE_NAME})
ENDIF()
ENDFOREACH()



4 changes: 4 additions & 0 deletions wxml/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ target_link_libraries(
${PROJECT_NAME}_common
${PROJECT_NAME}_fsys
)

IF(${BUILD_TESTING})
ADD_SUBDIRECTORY(test)
ENDIF()
24 changes: 24 additions & 0 deletions wxml/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

#################################################################
# FoX Wxml tests
#################################################################

FILE(GLOB_RECURSE TESTS_WXML_SRC *.f90 *.F90)
SET(TESTS_WXML_SRC ${TESTS_WXML_SRC} PARENT_SCOPE)

FOREACH(TEST_SRC ${TESTS_WXML_SRC})
GET_FILENAME_COMPONENT(EXE_NAME ${TEST_SRC} NAME_WE)
ADD_EXECUTABLE(${EXE_NAME} ${TEST_SRC})
TARGET_LINK_LIBRARIES(${EXE_NAME} ${PROJECT_NAME}_wxml)
TARGET_LINK_LIBRARIES(${EXE_NAME} ${PROJECT_NAME}_common)
TARGET_LINK_LIBRARIES(${EXE_NAME} ${PROJECT_NAME}_fsys)
FOREACH (EXT_LIB ${EXT_LIBS})
IF(DEFINED ${PROJECT_NAME}_ENABLE_${EXT_LIB} AND ${PROJECT_NAME}_ENABLE_${EXT_LIB} AND ${EXT_LIB}_FOUND)
TARGET_LINK_LIBRARIES(${EXE_NAME} ${${EXT_LIB}_LIBRARIES})
ENDIF()
ENDFOREACH()
ADD_TEST(${EXE_NAME}_TEST ${EXECUTABLE_OUTPUT_PATH}/${EXE_NAME})
ENDFOREACH()