...
FRUIT has assertion, fixture, setup, teardown, report, spec, driver generation and uses Rake (Ruby build utility) used as build tool.
FRUIT core is written in FORTRAN , so one can use it without need of installing any additional software.
...
- Fortran compiler (eg. gfortran)
- fruit.f90 source file: https://github.com/mortele/FRUIT/blob/master/src/fruit.f90
- fruit_processor_gem files: https://github.com/mortele/FRUIT/tree/master/fruit_processor_gem
- Ruby
- Rake
Which FRUIT to use
If you create small project with several modules and not so many subroutines, use FORTRAN only version. You need only to download one file and add it to build script, but you need also to fill test_driver file manually.
If you create complex solution FORTRAN + Ruby is much better. You only need to create test subroutines, and Ruby script detects them and generate test_driver nad test_basket. This method is also recommended if you need to use setup and teardown subroutines, because handling script (test_basket) is created automatically.
...
FRUIT Fortran only vs FRUIT Fortran + Ruby
FRUIT Fortran only
- Good for small project
- Good if you do not need setup and teardown subroutines (otherwise you need to create and maintain additional basket file)
- You will need to reate test driver on your own
FRUIT Fortran + Ruby
- Good for complex projects
- Good if you need setup and teardown subroutines
- Needs Ruby interpreter
- You will need only to point test and source files in CMakeLists files
Types of subroutines
- assert - a state of belief. If assert fails your test will also fail (eg. assert_equals(1,2) will fail because 1!=2). Assert is core root of all unit tests.
- setup - subroutine called before every test subroutine. It can be used to initialize variables.
- teardown - subroutine called after every test subroutine. It can be used to clean after test.
Avaivable subroutunes
Code Block |
---|
subroutines: assert_equals assert_not_equals assert_true assert_false setup teardown !examples with different types: !integers and reals assert_equals(a,b) assert_equals(a,b,"Message when assert fails") assert_not_equals(a,b) assert_not_equals(a,b,"Message when assert fails") !NOTE: "Message when assert fails" is optional !reals with tolerance assert_equals(a,b,tolerance) !booleans and expressions assert_true(expression) assert_false(expression) !strings assert_equals("abc","abc") assert_not_equals("abc","abc") |
...