1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-12-03 08:30:03 +00:00
org-mode/testing/examples/ob-fortran-test.org

1.9 KiB

a collection of examples for ob-fortran tests

simple programs

print *, 'Hello world'
integer, parameter :: i = 10
write (*, '(i2)') i

variable resolution

write (*, '(i2)') N

Define for preprocessed fortran

implicit none
write (*, '(i2)') N
write (*, '(a4)') s

arrays

Real array as input

write (*, '(3f5.2)'), s
1.0
2.0
write (*, '(2f5.2)'), s

failing

Should fail (TODO: add input variables for the case with explicit program statement)

program ex
print *, "output of ex program"
end program ex

Fails to compile (TODO: error check in ob-fortran.el)

print *, s

Should fail to compile with gfortran

program ex
integer*8 :: i
end program ex

programs input parameters

Pass parameters to the program

character(len=255) :: cmd
call get_command_argument(1, cmd)
write (*,*) trim(cmd)