tester Module

module~~tester~~UsesGraph module~tester tester iso_fortran_env iso_fortran_env iso_fortran_env->module~tester
Help

Routines to test Fortran programs

Used By

module~~tester~~UsedByGraph module~tester tester program~hasty_test_caf_basic hasty_test_caf_basic module~tester->program~hasty_test_caf_basic program~hasty_test_hash_table_homo hasty_test_hash_table_homo module~tester->program~hasty_test_hash_table_homo program~test_tester_3 test_tester_3 module~tester->program~test_tester_3 program~test_tester_4 test_tester_4 module~tester->program~test_tester_4 program~hasty_test_hash_table_homocontent_failure hasty_test_hash_table_homocontent_failure module~tester->program~hasty_test_hash_table_homocontent_failure program~test_tester_2 test_tester_2 module~tester->program~test_tester_2 program~hasty_test_hash_table_homokey_failure hasty_test_hash_table_homokey_failure module~tester->program~hasty_test_hash_table_homokey_failure program~hasty_test_dictionary hasty_test_dictionary module~tester->program~hasty_test_dictionary program~hasty_test_hash_table hasty_test_hash_table module~tester->program~hasty_test_hash_table program~test_tester_1 test_tester_1 module~tester->program~test_tester_1
Help


Derived Types

type, public :: tester_t

The main tester class.

Components

TypeVisibility AttributesNameInitial
integer(kind=int32), public :: n_errors =0_int32

Number of errors.

integer(kind=int32), public :: n_tests =0_int32

Number of tests.

real(kind=real32), public :: tolerance32 =2._real32*epsilon(1._real32)

Real tolerance, 32 bits.

real(kind=real64), public :: tolerance64 =2._real64*epsilon(1._real64)

Real tolerance, 64 bits.

Type-Bound Procedures

procedure, public :: init

Initialize the tester.

procedure, public :: print

Print tests results.

generic, public :: assert_equal => assert_equal_i8, assert_equal_i16, assert_equal_i32, assert_equal_i64, assert_equal_r32, assert_equal_r64, assert_equal_l, assert_equal_i8_1, assert_equal_i16_1, assert_equal_i32_1, assert_equal_i64_1, assert_equal_r32_1, assert_equal_r64_1, assert_equal_l_1

Check if two values (integer, real or logical) are equal.

procedure, private :: assert_equal_i8

Check if two integers (8 bits) are equal.

procedure, private :: assert_equal_i16

Check if two integers (16 bits) are equal.

procedure, private :: assert_equal_i32

Check if two integers (32 bits) are equal.

procedure, private :: assert_equal_i64

Check if two integers (64 bits) are equal.

procedure, private :: assert_equal_r32

Check if two reals (32 bits) are equal.

procedure, private :: assert_equal_r64

Check if two reals (64 bits) are equal.

procedure, private :: assert_equal_l

Check if two logicals are equal.

procedure, private :: assert_equal_i8_1

Check if two integer (8 bits) arrays (rank 1) are equal.

procedure, private :: assert_equal_i16_1

Check if two integer (16 bits) arrays (rank 1) are equal.

procedure, private :: assert_equal_i32_1

Check if two integer (32 bits) arrays (rank 1) are equal.

procedure, private :: assert_equal_i64_1

Check if two integer (64 bits) arrays (rank 1) are equal.

procedure, private :: assert_equal_r32_1

Check if two real (32 bits) arrays (rank 1) are equal.

procedure, private :: assert_equal_r64_1

Check if two real (64 bits) arrays (rank 1) are equal.

procedure, private :: assert_equal_l_1

Check if two logical arrays (rank 1) are equal.

generic, public :: assert_positive => assert_positive_i8, assert_positive_i16, assert_positive_i32, assert_positive_i64, assert_positive_r32, assert_positive_r64, assert_positive_i8_1, assert_positive_i16_1, assert_positive_i32_1, assert_positive_i64_1, assert_positive_r32_1, assert_positive_r64_1

Check if a number (integer or real) is positive.

procedure, private :: assert_positive_i8

Check if a integer (8 bits) is positive.

procedure, private :: assert_positive_i16

Check if a integer (16 bits) is positive.

procedure, private :: assert_positive_i32

Check if a integer (32 bits) is positive.

procedure, private :: assert_positive_i64

Check if a integer (64 bits) is positive.

procedure, private :: assert_positive_r32

Check if a real (32 bits) is positive.

procedure, private :: assert_positive_r64

Check if a real (64 bits) is positive.

procedure, private :: assert_positive_i8_1

Check if a integer (8 bits) array (rank 1) is positive.

procedure, private :: assert_positive_i16_1

Check if a integer (16 bits) array (rank 1) is positive.

procedure, private :: assert_positive_i32_1

Check if a integer (32 bits) array (rank 1) is positive.

procedure, private :: assert_positive_i64_1

Check if a integer (64 bits) array (rank 1) is positive.

procedure, private :: assert_positive_r32_1

Check if a real (32 bits) array (rank 1) is positive.

procedure, private :: assert_positive_r64_1

Check if a real (64 bits) array (rank 1) is positive.

generic, public :: assert_close => assert_close_r32, assert_close_r64, assert_close_r32_1, assert_close_r64_1

Check if two reals are close with respect a tolerance.

procedure, private :: assert_close_r32

Check if two reals (32 bits) are close with respect a tolerance.

procedure, private :: assert_close_r64

Check if two reals (64 bits) are close with respect a tolerance.

procedure, private :: assert_close_r32_1

Check if two real (32 bits) arrays (rank 1) are close with respect a tolerance.

procedure, private :: assert_close_r64_1

Check if two real (64 bits) arrays (rank 1) are close with respect a tolerance.


Subroutines

private subroutine init(this, tolerance32, tolerance64)

Initialize the tester.

Arguments

Type IntentOptional AttributesName
class(tester_t), intent(out) :: this

The tester.

real(kind=real32), intent(in), optional :: tolerance32

Real tolerance, 32 bits.

real(kind=real64), intent(in), optional :: tolerance64

Real tolerance, 64 bits.

private subroutine print(this, errorstop)

Print tests results.

Arguments

Type IntentOptional AttributesName
class(tester_t), intent(in) :: this

The tester.

logical, intent(in), optional :: errorstop

Flag to activate error stop if one test fails.

private subroutine assert_equal_i8(this, i1, i2, fail)

Check if two integers (8 bits) are equal.

Arguments

Type IntentOptional AttributesName
class(tester_t), intent(inout) :: this

The tester.

integer(kind=int8), intent(in) :: i1

Value to compare.

integer(kind=int8), intent(in) :: i2

Value to compare.

logical, intent(in), optional :: fail

Fail flag.

private subroutine assert_equal_i16(this, i1, i2, fail)

Check if two integers (16 bits) are equal.

Arguments

Type IntentOptional AttributesName
class(tester_t), intent(inout) :: this

The tester.

integer(kind=int16), intent(in) :: i1

Value to compare.

integer(kind=int16), intent(in) :: i2

Value to compare.

logical, intent(in), optional :: fail

Fail flag.

private subroutine assert_equal_i32(this, i1, i2, fail)

Check if two integers (32 bits) are equal.

Arguments

Type IntentOptional AttributesName
class(tester_t), intent(inout) :: this

The tester.

integer(kind=int32), intent(in) :: i1

Value to compare.

integer(kind=int32), intent(in) :: i2

Value to compare.

logical, intent(in), optional :: fail

Fail flag.

private subroutine assert_equal_i64(this, i1, i2, fail)

Check if two integers (64 bits) are equal.

Arguments

Type IntentOptional AttributesName
class(tester_t), intent(inout) :: this

The tester.

integer(kind=int64), intent(in) :: i1

Value to compare.

integer(kind=int64), intent(in) :: i2

Value to compare.

logical, intent(in), optional :: fail

Fail flag.

private subroutine assert_equal_r32(this, r1, r2, fail)

Check if two reals (32 bits) are equal.

Arguments

Type IntentOptional AttributesName
class(tester_t), intent(inout) :: this

The tester.

real(kind=real32), intent(in) :: r1

Value to compare.

real(kind=real32), intent(in) :: r2

Value to compare.

logical, intent(in), optional :: fail

Fail flag.

private subroutine assert_equal_r64(this, r1, r2, fail)

Check if two reals (64 bits) are equal.

Arguments

Type IntentOptional AttributesName
class(tester_t), intent(inout) :: this

The tester.

real(kind=real64), intent(in) :: r1

Value to compare.

real(kind=real64), intent(in) :: r2

Value to compare.

logical, intent(in), optional :: fail

Fail flag.

private subroutine assert_equal_l(this, l1, l2, fail)

Check if two logicals are equal.

Arguments

Type IntentOptional AttributesName
class(tester_t), intent(inout) :: this

The tester.

logical, intent(in) :: l1

Value to compare.

logical, intent(in) :: l2

Value to compare.

logical, intent(in), optional :: fail

Fail flag.

private subroutine assert_equal_i8_1(this, i1, i2, fail)

Check if two integer (8 bits) arrays (rank 1) are equal.

Arguments

Type IntentOptional AttributesName
class(tester_t), intent(inout) :: this

The tester.

integer(kind=int8), intent(in), dimension(:):: i1

Value to compare.

integer(kind=int8), intent(in), dimension(:):: i2

Value to compare.

logical, intent(in), optional :: fail

Fail flag.

private subroutine assert_equal_i16_1(this, i1, i2, fail)

Check if two integer (16 bits) arrays (rank 1) are equal.

Arguments

Type IntentOptional AttributesName
class(tester_t), intent(inout) :: this

The tester.

integer(kind=int16), intent(in), dimension(:):: i1

Value to compare.

integer(kind=int16), intent(in), dimension(:):: i2

Value to compare.

logical, intent(in), optional :: fail

Fail flag.

private subroutine assert_equal_i32_1(this, i1, i2, fail)

Check if two integer (32 bits) arrays (rank 1) are equal.

Arguments

Type IntentOptional AttributesName
class(tester_t), intent(inout) :: this

The tester.

integer(kind=int32), intent(in), dimension(:):: i1

Value to compare.

integer(kind=int32), intent(in), dimension(:):: i2

Value to compare.

logical, intent(in), optional :: fail

Fail flag.

private subroutine assert_equal_i64_1(this, i1, i2, fail)

Check if two integer (64 bits) arrays (rank 1) are equal.

Arguments

Type IntentOptional AttributesName
class(tester_t), intent(inout) :: this

The tester.

integer(kind=int64), intent(in), dimension(:):: i1

Value to compare.

integer(kind=int64), intent(in), dimension(:):: i2

Value to compare.

logical, intent(in), optional :: fail

Fail flag.

private subroutine assert_equal_r32_1(this, r1, r2, fail)

Check if two real (32 bits) arrays (rank 1) are equal.

Arguments

Type IntentOptional AttributesName
class(tester_t), intent(inout) :: this

The tester.

real(kind=real32), intent(in), dimension(:):: r1

Value to compare.

real(kind=real32), intent(in), dimension(:):: r2

Value to compare.

logical, intent(in), optional :: fail

Fail flag.

private subroutine assert_equal_r64_1(this, r1, r2, fail)

Check if two real (64 bits) arrays (rank 1) are equal.

Arguments

Type IntentOptional AttributesName
class(tester_t), intent(inout) :: this

The tester.

real(kind=real64), intent(in), dimension(:):: r1

Value to compare.

real(kind=real64), intent(in), dimension(:):: r2

Value to compare.

logical, intent(in), optional :: fail

Fail flag.

private subroutine assert_equal_l_1(this, l1, l2, fail)

Check if two logical arrays (rank 1) are equal.

Arguments

Type IntentOptional AttributesName
class(tester_t), intent(inout) :: this

The tester.

logical, intent(in), dimension(:):: l1

Value to compare.

logical, intent(in), dimension(:):: l2

Value to compare.

logical, intent(in), optional :: fail

Fail flag.

private subroutine assert_positive_i8(this, i, fail)

Check if a integer (32 bits) is positive.

Arguments

Type IntentOptional AttributesName
class(tester_t), intent(inout) :: this

The tester.

integer(kind=int8), intent(in) :: i

Value to check.

logical, intent(in), optional :: fail

Fail flag.

private subroutine assert_positive_i16(this, i, fail)

Check if a integer (16 bits) is positive.

Arguments

Type IntentOptional AttributesName
class(tester_t), intent(inout) :: this

The tester.

integer(kind=int16), intent(in) :: i

Value to check.

logical, intent(in), optional :: fail

Fail flag.

private subroutine assert_positive_i32(this, i, fail)

Check if a integer (32 bits) is positive.

Arguments

Type IntentOptional AttributesName
class(tester_t), intent(inout) :: this

The tester.

integer(kind=int32), intent(in) :: i

Value to check.

logical, intent(in), optional :: fail

Fail flag.

private subroutine assert_positive_i64(this, i, fail)

Check if a integer (32 bits) is positive.

Arguments

Type IntentOptional AttributesName
class(tester_t), intent(inout) :: this

The tester.

integer(kind=int64), intent(in) :: i

Value to check.

logical, intent(in), optional :: fail

Fail flag.

private subroutine assert_positive_r32(this, r, fail)

Check if a real (32 bits) is positive.

Arguments

Type IntentOptional AttributesName
class(tester_t), intent(inout) :: this

The tester.

real(kind=real32), intent(in) :: r

Value to check.

logical, intent(in), optional :: fail

Fail flag.

private subroutine assert_positive_r64(this, r, fail)

Check if a real (64 bits) is positive.

Arguments

Type IntentOptional AttributesName
class(tester_t), intent(inout) :: this

The tester.

real(kind=real64), intent(in) :: r

Value to check.

logical, intent(in), optional :: fail

Fail flag.

private subroutine assert_positive_i8_1(this, i, fail)

Check if a integer (8 bits) array (rank 1) is positive.

Arguments

Type IntentOptional AttributesName
class(tester_t), intent(inout) :: this

The tester.

integer(kind=int8), intent(in), dimension(:):: i

Value to check.

logical, intent(in), optional :: fail

Fail flag.

private subroutine assert_positive_i16_1(this, i, fail)

Check if a integer (16 bits) array (rank 1) is positive.

Arguments

Type IntentOptional AttributesName
class(tester_t), intent(inout) :: this

The tester.

integer(kind=int16), intent(in), dimension(:):: i

Value to check.

logical, intent(in), optional :: fail

Fail flag.

private subroutine assert_positive_i32_1(this, i, fail)

Check if a integer (32 bits) array (rank 1) is positive.

Arguments

Type IntentOptional AttributesName
class(tester_t), intent(inout) :: this

The tester.

integer(kind=int32), intent(in), dimension(:):: i

Value to check.

logical, intent(in), optional :: fail

Fail flag.

private subroutine assert_positive_i64_1(this, i, fail)

Check if a integer (64 bits) array (rank 1) is positive.

Arguments

Type IntentOptional AttributesName
class(tester_t), intent(inout) :: this

The tester.

integer(kind=int64), intent(in), dimension(:):: i

Value to check.

logical, intent(in), optional :: fail

Fail flag.

private subroutine assert_positive_r32_1(this, r, fail)

Check if a real (32 bits) array (rank 1) is positive.

Arguments

Type IntentOptional AttributesName
class(tester_t), intent(inout) :: this

The tester.

real(kind=real32), intent(in), dimension(:):: r

Value to check.

logical, intent(in), optional :: fail

Fail flag.

private subroutine assert_positive_r64_1(this, r, fail)

Check if a real (64 bits) array (rank 1) is positive.

Arguments

Type IntentOptional AttributesName
class(tester_t), intent(inout) :: this

The tester.

real(kind=real64), intent(in), dimension(:):: r

Value to check.

logical, intent(in), optional :: fail

Fail flag.

private subroutine assert_close_r32(this, r1, r2, fail)

Check if two reals (32 bits) are close with respect a tolerance.

Arguments

Type IntentOptional AttributesName
class(tester_t), intent(inout) :: this

The tester.

real(kind=real32), intent(in) :: r1

Value to compare.

real(kind=real32), intent(in) :: r2

Value to compare.

logical, intent(in), optional :: fail

Fail flag.

private subroutine assert_close_r64(this, r1, r2, fail)

Check if two reals (64 bits) are close with respect a tolerance.

Arguments

Type IntentOptional AttributesName
class(tester_t), intent(inout) :: this

The tester.

real(kind=real64), intent(in) :: r1

Value to compare.

real(kind=real64), intent(in) :: r2

Value to compare.

logical, intent(in), optional :: fail

Fail flag.

private subroutine assert_close_r32_1(this, r1, r2, fail)

Check if two real (32 bits) arrays (rank 1) are close with respect a tolerance.

Arguments

Type IntentOptional AttributesName
class(tester_t), intent(inout) :: this

The tester.

real(kind=real32), intent(in), dimension(:):: r1

Value to compare.

real(kind=real32), intent(in), dimension(:):: r2

Value to compare.

logical, intent(in), optional :: fail

Fail flag.

private subroutine assert_close_r64_1(this, r1, r2, fail)

Check if two real (64 bits) arrays (rank 1) are close with respect a tolerance.

Arguments

Type IntentOptional AttributesName
class(tester_t), intent(inout) :: this

The tester.

real(kind=real64), intent(in), dimension(:):: r1

Value to compare.

real(kind=real64), intent(in), dimension(:):: r2

Value to compare.

logical, intent(in), optional :: fail

Fail flag.