# Fortran Wiki FUnit

FUnit is a Fortran unit testing framework developed by engineers at NASA. It requires a Fortran 95 compiler and it is designed for testing routines contained in modules. FUnit is written in Ruby and is distributed as a Ruby Gem at RubyForge.

## Installing FUnit

If you have rubygems installed, simply running

sudo gem install funit

will install fUnit. You must also have the FC environment variable set to your Fortran compiler:

export FC="gfortran"

## Tests and Assertions

Tests are simple Fortran fragments stored in a .fun file of the same name as the module. Each unit test file can contain multiple tests as well as setup and teardown commands that are executed once for each test. Tests may make six types of assertions:

• assert_true(expression)
• assert_false(expression)
• assert_equal(a, b)
• assert_real_equal(a, b)
• assert_equal_with(a, b, tol)
• assert_array_equal(a,b)

## Emacs

The current FUnit also includes an funit-mode for Emacs in the utils directory.