Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
cd <project_dir>
wget https://raw.githubusercontent.com/mortele/FRUIT/master/rake_base.rb

Create project files

calculator

...

Code Block
!file <project_directory>/src/calculator.f90

module calculator
implicit none
contains
	subroutine add(a,b,output)
		integer, intent (in) :: a,b
		integer, intent (out) :: output
		output=a+b
	end subroutine add
end module calculator

calculator_test.f90

Code Block
!file <project_directory>/test/calculator_test.f90

module calculator_test
use fruit

contains
subroutine setup
	print *, "setup subroutine ran"
end subroutine setup

subroutine teardown
	print *, "teardown subroutine ran"
end subroutine teardown

subroutine test_calculator
	use calculator
	integer :: result

	!test add subroutine
	call add (2,2,result)
	call assert_equals(4,result)

end subroutine test_calculator

end module calculator_test

...

  • files containing tests must be named: *_test.f90
  • test module must be named: *_test
  • test subroutines must be named: test_*

calculator.f90

Code Block
!file <project_directory>/src/calculator.f90

module calculator
implicit none
contains
	subroutine add(a,b,output)
		integer, intent (in) :: a,b
		integer, intent (out) :: output
		output=a+b
	end subroutine add
end module calculator

Create driving files

fruit_generator.rb

...