50 lines
1.8 KiB
Fortran
50 lines
1.8 KiB
Fortran
program test_input_coupling_errors_080
|
|
use sph_error, only: SPH_SUCCESS
|
|
use sph_api, only: sph_initialize, sph_finalize, sph_read_inp, sph_build_model
|
|
implicit none
|
|
|
|
integer :: ierr
|
|
|
|
call expect_fails('tests/data/coupling_region_bad_name_080.inp')
|
|
call expect_fails('tests/data/coupling_region_bad_duplicate_080.inp')
|
|
call expect_fails('tests/data/coupling_region_bad_type_080.inp')
|
|
call expect_fails('tests/data/coupling_region_bad_export_080.inp')
|
|
call expect_fails('tests/data/coupling_region_bad_import_080.inp')
|
|
call expect_fails('tests/data/coupling_region_bad_enabled_080.inp')
|
|
call expect_fails('tests/data/coupling_region_missing_set_080.inp')
|
|
call expect_fails('tests/data/coupling_region_unknown_set_080.inp')
|
|
call expect_fails('tests/data/coupling_region_empty_active_080.inp')
|
|
call expect_fails('tests/data/coupling_region_continuum_active_080.inp')
|
|
|
|
contains
|
|
|
|
subroutine expect_fails(filename)
|
|
character(len=*), intent(in) :: filename
|
|
|
|
call sph_initialize(ierr)
|
|
call assert_ok(ierr, 'initialize failed for failing coupling input')
|
|
call sph_read_inp(filename, ierr)
|
|
if (ierr == SPH_SUCCESS) then
|
|
call sph_build_model(ierr)
|
|
if (ierr == SPH_SUCCESS) call fail('coupling input unexpectedly built')
|
|
end if
|
|
call sph_finalize(ierr)
|
|
call assert_ok(ierr, 'finalize failed after failing coupling input')
|
|
end subroutine expect_fails
|
|
|
|
subroutine assert_ok(ierr_value, message)
|
|
integer, intent(in) :: ierr_value
|
|
character(len=*), intent(in) :: message
|
|
|
|
if (ierr_value /= SPH_SUCCESS) call fail(message)
|
|
end subroutine assert_ok
|
|
|
|
subroutine fail(message)
|
|
character(len=*), intent(in) :: message
|
|
|
|
write(*, '(A)') trim(message)
|
|
stop 1
|
|
end subroutine fail
|
|
|
|
end program test_input_coupling_errors_080
|