org-mode/testing/examples/ob-fortran-test.org
2011-07-18 12:11:53 -06:00

1.4 KiB

Test org fortran file

print *, 'Hello world'
integer, parameter :: i = 10
print *, 'i = ', i
print *, 'N = ', N

Define for preprocessed fortran

implicit none
print *, 'N = ', N
print *, 's = ', s
print *, 'size(s) = ', size(s)
print *, 's = ', s
print *, 'kind(s) = ', kind(s)
program ex
print *, "output of ex program"
end program ex

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

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

Real array as input

print *, s
1.0
2.0

Real array as input

print *, s

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

Pass parameters to the program

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