Code Monkey home page Code Monkey logo

funit's Introduction

FUnit Fortran Unit Testing Framework

This unit testing framework aims to be nicer and more flexible than existing unit testing frameworks for Fortran.

Installation

$ gem install funit

$ ./configure && make && make install

Getting Started

$ fu init
  • creates test/ structure with fixtures/, example test suite, config file, etc.

Writing Tests

Tests are written with special syntax around Fortran code implementing each test. The special syntax also specifies dependencies which need to be built, setup and teardown routines, etc.

test_suite suite-name
  dep "../file1.F90"
  dep "../file2.F90"
  mod a_module

  tolerance 0.00001

  setup
    ! fortran code to run before each test
  end setup

  teardown
    ! fortran code to run after each test
  end teardown

  test case1
    ...
  end test case1

  test case2
    ...
  end test case2
end test_suite

Note: dependencies must be quoted and unlike Fortran, the strings must not be continued with an ampersand (&).

Assertions

  • assert_true(expression[, msg])
  • assert_false(expression[, msg])
  • assert_equal(a, b[, msg])
  • assert_not_equal(a, b[, msg])
  • assert_equal_with(a, b[, tol][, msg])
  • assert_array_equal(a, b[, msg])
  • assert_array_equal_with(a, b[, tol][, msg])
  • flunk(msg)

The array assertions should be given array variable names rather than complex expressions because their arguments are evaluated several times.

Running Tests

$ fu test/test_XXX.fun

Building suite-name...
Running suite-name
  test test-name        PASSED
  test name2            PASSED
  test third            FAILED

Finished in 2.3 seconds
3 tests in 1 suite, 1 failures

funit's People

Contributors

ieyasu avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.