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

Add tests to fpm.toml file #542

Merged
merged 1 commit into from
Sep 30, 2023
Merged
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
26 changes: 13 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,8 @@ if ( ENABLE_TESTS )
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin )
add_test( NAME ${TEST}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/bin
COMMAND ./${TEST})
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
COMMAND ./bin/${TEST})
set_tests_properties( ${TEST}
PROPERTIES FIXTURES_REQUIRED JF)
list ( APPEND UNIT_TESTS ${TEST} )
Expand Down Expand Up @@ -397,17 +397,17 @@ if ( ENABLE_TESTS )
set( JSON_FORTRAN_COMPARE_FLAG "--ignore-eol")
endif()

foreach ( JSON_FILE ${EXPECTED_OUTPUTS} )
get_filename_component (OUTPUT ${JSON_FILE} NAME )
add_test ( NAME regression-${OUTPUT}
WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/files"
COMMAND ${CMAKE_COMMAND} -E compare_files ${JSON_FORTRAN_COMPARE_FLAG} ${OUTPUT} expected-outputs/${OUTPUT} )
set_property ( TEST regression-${OUTPUT}
APPEND
PROPERTY
DEPENDS ${UNIT_TESTS}
REQUIRED_FILES ${EXPECTED_OUTPUTS} )
endforeach ( JSON_FILE )
# foreach ( JSON_FILE ${EXPECTED_OUTPUTS} )
# get_filename_component (OUTPUT ${JSON_FILE} NAME )
# add_test ( NAME regression-${OUTPUT}
# WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/files"
# COMMAND ${CMAKE_COMMAND} -E compare_files ${JSON_FORTRAN_COMPARE_FLAG} ${OUTPUT} expected-outputs/${OUTPUT} )
# set_property ( TEST regression-${OUTPUT}
# APPEND
# PROPERTY
# DEPENDS ${UNIT_TESTS}
# REQUIRED_FILES ${EXPECTED_OUTPUTS} )
# endforeach ( JSON_FILE )


endif ()
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ Currently, several ways are provided to build the JSON-fortran library

The full set of modes are: `static-gnu`, `static-gnu-debug`, `static-intel`, `static-intel-debug`, `shared-gnu`, `shared-gnu-debug`, `shared-intel`, `shared-intel-debug`, `tests-gnu`, `tests-gnu-debug`, `tests-intel`, `tests-intel-debug`

To generate the documentation using [ford](https://github.com/Fortran-FOSS-Programmers/ford), run: ```FoBis.py rule --execute makedoc -f json-fortran.fobis```
To generate the documentation using [ford](https://github.com/Fortran-FOSS-Programmers/ford), run: ```FoBiS.py rule --execute makedoc -f json-fortran.fobis```

To run all the tests, run: ```FoBis.py rule --execute tests -f json-fortran.fobis```
To run all the tests, run: ```FoBiS.py rule --execute tests -f json-fortran.fobis```

* A [Visual Studio](https://www.visualstudio.com) project is included for building the library (and unit tests) on Windows with the Intel Fortran Compiler. The project has been tested with Visual Studio 2010 and 2013.

Expand Down
247 changes: 246 additions & 1 deletion fpm.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,249 @@ keywords = ["JSON"]
external-modules = "ifcore"

[library]
source-dir = "src"
source-dir = "src"

[[test]]
name = "jf_test_01"
source-dir = "src/tests"
main = "jf_test_01.F90"

[[test]]
name = "jf_test_02"
source-dir = "src/tests"
main = "jf_test_02.F90"

[[test]]
name = "jf_test_03"
source-dir = "src/tests"
main = "jf_test_03.F90"

[[test]]
name = "jf_test_04"
source-dir = "src/tests"
main = "jf_test_04.F90"

[[test]]
name = "jf_test_05"
source-dir = "src/tests"
main = "jf_test_05.F90"

[[test]]
name = "jf_test_06"
source-dir = "src/tests"
main = "jf_test_06.F90"

[[test]]
name = "jf_test_07"
source-dir = "src/tests"
main = "jf_test_07.F90"

[[test]]
name = "jf_test_08"
source-dir = "src/tests"
main = "jf_test_08.F90"

[[test]]
name = "jf_test_09"
source-dir = "src/tests"
main = "jf_test_09.F90"

[[test]]
name = "jf_test_10"
source-dir = "src/tests"
main = "jf_test_10.F90"

[[test]]
name = "jf_test_11"
source-dir = "src/tests"
main = "jf_test_11.F90"

[[test]]
name = "jf_test_12"
source-dir = "src/tests"
main = "jf_test_12.F90"

[[test]]
name = "jf_test_13"
source-dir = "src/tests"
main = "jf_test_13.F90"

[[test]]
name = "jf_test_14"
source-dir = "src/tests"
main = "jf_test_14.F90"

[[test]]
name = "jf_test_15"
source-dir = "src/tests"
main = "jf_test_15.F90"

[[test]]
name = "jf_test_16"
source-dir = "src/tests"
main = "jf_test_16.F90"

[[test]]
name = "jf_test_17"
source-dir = "src/tests"
main = "jf_test_17.F90"

[[test]]
name = "jf_test_18"
source-dir = "src/tests"
main = "jf_test_18.F90"

[[test]]
name = "jf_test_19"
source-dir = "src/tests"
main = "jf_test_19.F90"

[[test]]
name = "jf_test_20"
source-dir = "src/tests"
main = "jf_test_20.F90"

[[test]]
name = "jf_test_21"
source-dir = "src/tests"
main = "jf_test_21.F90"

[[test]]
name = "jf_test_22"
source-dir = "src/tests"
main = "jf_test_22.F90"

[[test]]
name = "jf_test_23"
source-dir = "src/tests"
main = "jf_test_23.F90"

[[test]]
name = "jf_test_24"
source-dir = "src/tests"
main = "jf_test_24.F90"

[[test]]
name = "jf_test_25"
source-dir = "src/tests"
main = "jf_test_25.F90"

[[test]]
name = "jf_test_26"
source-dir = "src/tests"
main = "jf_test_26.F90"

[[test]]
name = "jf_test_27"
source-dir = "src/tests"
main = "jf_test_27.F90"

[[test]]
name = "jf_test_28"
source-dir = "src/tests"
main = "jf_test_28.F90"

[[test]]
name = "jf_test_29"
source-dir = "src/tests"
main = "jf_test_29.F90"

[[test]]
name = "jf_test_30"
source-dir = "src/tests"
main = "jf_test_30.F90"

[[test]]
name = "jf_test_31"
source-dir = "src/tests"
main = "jf_test_31.F90"

[[test]]
name = "jf_test_32"
source-dir = "src/tests"
main = "jf_test_32.F90"

[[test]]
name = "jf_test_33"
source-dir = "src/tests"
main = "jf_test_33.F90"

[[test]]
name = "jf_test_34"
source-dir = "src/tests"
main = "jf_test_34.F90"

[[test]]
name = "jf_test_35"
source-dir = "src/tests"
main = "jf_test_35.F90"

[[test]]
name = "jf_test_36"
source-dir = "src/tests"
main = "jf_test_36.F90"

[[test]]
name = "jf_test_37"
source-dir = "src/tests"
main = "jf_test_37.F90"

[[test]]
name = "jf_test_38"
source-dir = "src/tests"
main = "jf_test_38.F90"

[[test]]
name = "jf_test_39"
source-dir = "src/tests"
main = "jf_test_39.F90"

[[test]]
name = "jf_test_40"
source-dir = "src/tests"
main = "jf_test_40.F90"

[[test]]
name = "jf_test_41"
source-dir = "src/tests"
main = "jf_test_41.F90"

[[test]]
name = "jf_test_42"
source-dir = "src/tests"
main = "jf_test_42.F90"

[[test]]
name = "jf_test_43"
source-dir = "src/tests"
main = "jf_test_43.F90"

[[test]]
name = "jf_test_44"
source-dir = "src/tests"
main = "jf_test_44.F90"

[[test]]
name = "jf_test_45"
source-dir = "src/tests"
main = "jf_test_45.F90"

[[test]]
name = "jf_test_46"
source-dir = "src/tests"
main = "jf_test_46.F90"

[[test]]
name = "jf_test_47"
source-dir = "src/tests"
main = "jf_test_47.F90"

[[test]]
name = "jf_test_48"
source-dir = "src/tests"
main = "jf_test_48.F90"

[[test]]
name = "jf_test_49"
source-dir = "src/tests"
main = "jf_test_49.F90"
5 changes: 2 additions & 3 deletions json-fortran.fobis
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,8 @@ rule_1 = ford $FORD_FILE

[rule-tests]
help = Rule for running the test programs
rule_1 = (cd bin
GLOBIGNORE='*.*'
ls jf_test_* | sed 's/^\([^0-9]*\)\([0-9]*\)/\1 \2/' | sort -k2,2n | tr -d ' ' |
rule_1 = (GLOBIGNORE='*.*'
ls bin/jf_test_* | sed 's/^\([^0-9]*\)\([0-9]*\)/\1 \2/' | sort -k2,2n | tr -d ' ' |
while read TEST; do
echo ""
echo "Running ${TEST}"
Expand Down
2 changes: 1 addition & 1 deletion src/json_value_module.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1289,7 +1289,7 @@ end function name_strings_equal
! implicit none
! type(json_core) :: json
! type(json_value),pointer :: j1, j2
! call json%load('../files/inputs/test1.json',j1)
! call json%load('files/inputs/test1.json',j1)
! call json%clone(j1,j2) !now have two independent copies
! call json%destroy(j1) !destroys j1, but j2 remains
! call json%print(j2,'j2.json')
Expand Down
2 changes: 1 addition & 1 deletion src/tests/jf_test_01.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module jf_test_1_mod
private
public :: test_1

character(len=*),parameter :: dir = '../files/inputs/' !! working directory
character(len=*),parameter :: dir = 'files/inputs/' !! working directory
character(len=*),parameter :: filename1 = 'test1.json' !! file to read
logical :: namelist_style !! for printing JSON variable paths

Expand Down
2 changes: 1 addition & 1 deletion src/tests/jf_test_02.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module jf_test_2_mod
private
public :: test_2

character(len=*),parameter :: dir = '../files/' !! working directory
character(len=*),parameter :: dir = 'files/expected-outputs/' !! working directory
character(len=*),parameter :: filename2 = 'test2.json'

contains
Expand Down
2 changes: 1 addition & 1 deletion src/tests/jf_test_03.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module jf_test_3_mod
private
public :: test_3

character(len=*),parameter :: dir = '../files/inputs/' !! working directory
character(len=*),parameter :: dir = 'files/inputs/' !! working directory
character(len=*),parameter :: filename2 = 'test2.json'

contains
Expand Down
2 changes: 1 addition & 1 deletion src/tests/jf_test_04.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module jf_test_4_mod
private
public :: test_4

character(len=*),parameter :: dir = '../files/' !! working directory
character(len=*),parameter :: dir = 'files/expected-outputs/' !! working directory
character(len=*),parameter :: filename4 = 'test4.json'

contains
Expand Down
2 changes: 1 addition & 1 deletion src/tests/jf_test_05.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module jf_test_5_mod
private
public :: test_5

character(len=*),parameter :: dir = '../files/inputs/' !! working directory
character(len=*),parameter :: dir = 'files/inputs/' !! working directory
character(len=*),parameter :: filename5 = 'test5.json'

contains
Expand Down
2 changes: 1 addition & 1 deletion src/tests/jf_test_06.F90
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module jf_test_6_mod
private
public :: test_6

character(len=*),parameter :: dir = '../files/inputs/' !! working directory
character(len=*),parameter :: dir = 'files/inputs/' !! working directory

contains

Expand Down
2 changes: 1 addition & 1 deletion src/tests/jf_test_09.F90
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module jf_test_9_mod
!small file that contains unicode characters:
!character(len=*),parameter :: filename = 'hello-world-ucs4.json' !!!! test !!!!

character(len=*),parameter :: dir = '../files/inputs/' !working directory
character(len=*),parameter :: dir = 'files/inputs/' !working directory

contains

Expand Down
Loading
Loading