GRASP rci-qed
|
Public Member Functions | |
subroutine | test_isequal_real64 (test_passed, which, a, b, relative_tolerance) |
Tests if two floating point values are the same withing the specified relative tolerance. More... | |
subroutine | test_isequal_logical (test_passed, which, a, b) |
Tests if two logical values are equal. More... | |
subroutine | test_isequal_integer (test_passed, which, a, b) |
Tests if two integer values are equal. More... | |
subroutine grasptest_testing::test_isequal::test_isequal_integer | ( | logical, intent(inout) | test_passed, |
character(*), intent(in) | which, | ||
integer, intent(in) | a, | ||
integer, intent(in) | b | ||
) |
Tests if two integer values are equal.
subroutine grasptest_testing::test_isequal::test_isequal_logical | ( | logical, intent(inout) | test_passed, |
character(*), intent(in) | which, | ||
logical, intent(in) | a, | ||
logical, intent(in) | b | ||
) |
Tests if two logical values are equal.
subroutine grasptest_testing::test_isequal::test_isequal_real64 | ( | logical, intent(inout) | test_passed, |
character(*), intent(in) | which, | ||
real(real64), intent(in) | a, | ||
real(real64), intent(in) | b, | ||
real(real64), intent(in) | relative_tolerance | ||
) |
Tests if two floating point values are the same withing the specified relative tolerance.
Specifically, it tests that
\[ \frac{|a-b|}{\max(|a|, |b|)} < \sigma \]
where \(\sigma\) is the specified relative tolerance.
If the test fails, test_passed
gets set to .false.
, but the value is unchanged if the tests pass. This allows for the pattern where the test function is called multiple times before checking if any of the tests failed:
On failure, a message gets printed into the standard output that a test failed, which also includes the which
string, allowing for the failed test to be identified easily.
test_passed | Gets set to .false. if the test fails, and is left unchanged otherwise. |
which | A string that identifies the test. |
a,b | Values to be compared. |
relative_tolerance | The relative tolerance \(\sigma\). |