Files
SPHLite/tests/module/test_input_coupling_load_errors_081.f90
T
2026-07-04 10:46:05 +08:00

44 lines
1.4 KiB
Fortran

program test_input_coupling_load_errors_081
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_load_bad_mode_081.inp')
call expect_fails('tests/data/coupling_load_bad_distribution_081.inp')
call expect_fails('tests/data/coupling_load_bad_contact_state_081.inp')
call expect_fails('tests/data/coupling_load_missing_facet_081.inp')
contains
subroutine expect_fails(filename)
character(len=*), intent(in) :: filename
call sph_initialize(ierr)
call assert_ok(ierr, 'initialize failed for failing 0.8.1 coupling input')
call sph_read_inp(filename, ierr)
if (ierr == SPH_SUCCESS) then
call sph_build_model(ierr)
if (ierr == SPH_SUCCESS) call fail('0.8.1 coupling input unexpectedly built')
end if
call sph_finalize(ierr)
call assert_ok(ierr, 'finalize failed after failing 0.8.1 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_load_errors_081