Assert methods

naturalFRUIT provides several assert methods to check for and report failures. The following list contains variants of the most commonly used formats. Although only the assert_equal, assert_true and assert_identical methods are described here, analogous formats exist for the assert_not_equal, assert_false and assert_not_identical methods.

1. assert_equal

Syntax Returns true if Underlying subroutine
assert_equal(logical a, logical b)a == bassert_eq_logical_
assert_equal(string a, string b)a == bassert_eq_string_
assert_equal(int a, int b)a == bassert_eq_int_
assert_equal(real a, real b)abs(a-b) < epsassert_eq_real_
assert_equal(real a, real b, real tol)abs(a-b) < tolassert_eq_real_
assert_equal(real(dp) a, real(dp) b)abs(a-b) < epsassert_eq_double_
assert_equal(real(dp) a, real(dp) b, real(dp) tol)abs(a-b) < tolassert_eq_double_
assert_equal(complex a, complex b)abs(a-b) < (eps,eps)assert_eq_complex_
assert_equal(complex a, complex b, tol)abs(a-b) < (tol,tol)assert_eq_complex_
assert_equal(complex(dp) a, complex(dp) b)abs(a-b) < (eps,eps)assert_eq_complex_double_
assert_equal(complex(dp) a, complex(dp) b, real(dp) tol)abs(a-b) < (tol,tol)assert_eq_complex_double_


2. assert_true

Syntax Returns true if Underlying subroutine
assert_true(logical a)a == .true.assert_true


3. assert_identical

Syntax Returns true if Underlying subroutine
assert_identical(string filename1, string filename2)contents are sameassert_identical


Additionally, all assert subroutines that handle int, real, real(dp), complex, and complex(dp) can also accept one and two dimensional arrays as input arguments. An element-wise check is performed in these cases.