...
Code Block |
---|
!filename: 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 |
Using setup and teardown subroutines
NOTE: This step is optional and is needed to be done only if you want to use setup and teardown subroutines.
Add setup and teardown subroutines
--TODO--
Code Block |
---|
!filename: calculator_test.f90
module calculator_test
use fruit
contains
subroutine setup
end subroutine setup
!...
subroutine teardown
!...
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 |
Run Run tests
This bash code will compile all source codes and run tests described in ./test/calculator_test.f90 file.
...
Output created with project described above
Output created with different project
NOTE: Fruits Fruit prints "." for every assert passed and "F" for every assert failed, not for every procedure call.
NOTE: Screenshoot below contains list of failed assertions and messages defined by user as optional assert subroutine argument.