Skip to content
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
1 change: 1 addition & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ add_fortran_tests (
"tan_sfp32.f90"
"tan_sfp64.f90"
"print_tokens.f90"
"custom_r1fp32.f90"
"custom_r1fp64.f90"
"parsing_difficult_r1fp64.f90"
"parsing_vanderpol_sfp64.f90")
Expand Down
33 changes: 33 additions & 0 deletions test/custom_r1fp32.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
program test
use iso_fortran_env,only:i1 => int8,i2 => int16,i4 => int32,i8 => int64, &
r4 => real32,r8 => real64,r16 => real128
use FEQParse

implicit none

write(*,'(A,I20)') "test ",testing()

contains

integer function testing() result(r)
!private
type(EquationParser) :: f
real(r4) :: feval

call AddFunction("myfunc",myfunc32)

f = EquationParser("MYFUNC(x)",["x"])

feval = f%evaluate([1.0_r4])
if((abs(feval-0.5_r4)) <= epsilon(1.0_r4)) then
r = 0
else
r = 1
endif
endfunction

pure real(r4) function myfunc32(x)
real(r4),intent(in) :: x
myfunc32 = x/2.0_r4
endfunction
endprogram