fortran_tester
 All Classes Files Functions Variables Pages
test_tester_03.f90
Go to the documentation of this file.
1 ! This file is part of fortran_tester
2 ! Copyright 2015 2018 Pierre de Buyl
3 ! License: BSD
4 
5 program test_tester_1
6  use tester
7  implicit none
8 
9  integer, parameter :: rk = selected_real_kind(15)
10  complex(kind=rk) :: x, y
11  complex(kind=rk) :: a(5), b(5)
12  complex :: c(3), d(3)
13  type(tester_t) :: test
14 
15  call test% init()
16 
17  call test% assert_equal((1234, -1234), (1234, -1234))
18 
19  call test% assert_close((1._rk, 0._rk), (1._rk, 0._rk))
20 
21  call test% assert_close(cmplx(1., epsilon(0.)), (1., 0.))
22 
23  x = (0._rk, 1._rk)
24  y = cmplx(epsilon(0._rk), 1._rk, kind=rk)
25  call test% assert_close(x, y)
26 
27  x = cmplx(-1158.1181871905803291, 779.0494065373754893)
28  y = cmplx(-1158.1181871905803291, 779.0494065373754893)
29 
30  call test% assert_equal(x, y)
31 
32  c = 1
33  d = 1
34  d = d + cmplx(0, epsilon(0.))
35 
36  call test% assert_close(c, d)
37 
38  c = cmplx(1154274.4026509234681726, -461087.8365501734078862)
39  d = cmplx(1154274.4026509234681726, -461087.8365501734078862)
40 
41  call test% assert_equal(c, d)
42 
43  a = -10
44  b = -10
45 
46  call test% assert_equal(a, b)
47 
48  a = 0
49  b = epsilon(0._rk)
50 
51  call test% assert_close(a, b)
52 
53  b(1) = b(1) + cmplx(0._rk, epsilon(real(b(1))), kind=rk)
54 
55  call test% assert_close(a, b)
56 
57  call test% print()
58 
59 end program test_tester_1
program test_tester_1
Routines to test Fortran programs.
Definition: tester.f90:11
The main tester class.
Definition: tester.f90:19