Versions Compared

Key

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

...

  • fruit.f90 - fruit source code.
  • mod - directory used to store .mod files.
  • <your_module>.f90 - your actual module.
  • <your_module>_test.f90 - file with unit tests for your module.
  • fruit_driver.f90 - file with test driving program. You can change this file name, but remember to modify Makefile, so it could find it.

 Install requirements

...

Load gfortran

Code Block
module load itm-gcc/7.3.0

Setup fruit library

Download fruit.f90 https://github.com/mortele/FRUIT/blob/master/src/fruit.f90 into  .<project_dir>/fruit directory.

...

Code Block
!file: <project_dir>/test/fruit_driver.f90

program fruit_driver
	use fruit
	use calculator_test
	call init_fruit

	!if you want to generate XML result
	!call init_fruit_xml

	call test_calculator

	!call fruit_summary_xml
	call fruit_summary
end program fruit_driver

 Create Create your module

Create file named <your_module>.f90 and put it into ./src directory. This file will be tested by module created in step 3.1.

Code Block
!file: <project_dir>/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 your main program

Create file named main.f90 and put it into ./src directory. We won't use this file, but it is needed to compile and build calculator

...

executable.

Code Block
!file: <project_dir>/src/main.f90
program main
use calculator
        integer :: result
        call add(2,2,result)
end program main

Finalization Finalization

Create Makefile

It is a build instruction that makes compiling your project easy. 

...