@@ -3,15 +3,15 @@ program test_assert
33 ! uneven assertions fail and even assertions pass
44
55 use unit_test
6-
6+
77 type (test_suite_type) :: test_suite_approximate
88 type (test_suite_type) :: test_suite_boolean
99 type (test_suite_type) :: test_suite_equal
1010 type (test_suite_type) :: test_suite_great_than
11-
11+
1212 ! test assert_approximate routines
13- test_suite_approximate % name = ' Approximate'
14-
13+ call test_suite_init( ' Approximate' , test_suite_approximate)
14+
1515 ! -> real
1616 call test_case_create(' real' , test_suite_approximate)
1717 call assert_approximate(1.0 , 2.0 , suite= test_suite_approximate)
@@ -22,7 +22,7 @@ program test_assert
2222 call assert_approximate(1.0D0 , 1.00000000001D0 , suite= test_suite_approximate)
2323 call assert_approximate(1.0D0 , 1.1D0 , eps= 0.01D0 , suite= test_suite_approximate)
2424 call assert_approximate(1.0D0 , 1.00000000001D0 , eps= 0.01D0 , suite= test_suite_approximate)
25-
25+
2626 call assert_approximate([1.0 , 1.0 ], [1.0 , 1.10 ], suite= test_suite_approximate)
2727 call assert_approximate([1.0 , 1.0 ], [1.0 , 1.00000000001 ], suite= test_suite_approximate)
2828 call assert_approximate([1.0 , 1.0 ], [1.0 , 1.10 ], eps= 0.01 , suite= test_suite_approximate)
@@ -31,7 +31,7 @@ program test_assert
3131 call assert_approximate([1.0D0 , 1.0D0 ], [1.0D0 , 1.00000000001D0 ], suite= test_suite_approximate)
3232 call assert_approximate([1.0D0 , 1.0D0 ], [1.0D0 , 1.1D0 ], eps= 0.01D0 , suite= test_suite_approximate)
3333 call assert_approximate([1.0D0 , 1.0D0 ], [1.0D0 , 1.01D0 ], eps= 0.01D0 , suite= test_suite_approximate)
34-
34+
3535 call assert_approximate(reshape ([1.0 , 1.0 , 1.0 , 1.0 ], [2 , 2 ]), reshape ([1.0 , 1.1 , 1.0 , 1.0 ], [2 , 2 ]), suite= test_suite_approximate)
3636 call assert_approximate(reshape ([1.0 , 1.0 , 1.0 , 1.0 ], [2 , 2 ]), reshape ([1.0 , 1.00000000001 , 1.0 , 1.0 ], [2 , 2 ]), suite= test_suite_approximate)
3737 call assert_approximate(reshape ([1.0 , 1.0 , 1.0 , 1.0 ], [2 , 2 ]), reshape ([1.0 , 1.10 , 1.0 , 1.0 ], [2 , 2 ]), eps= 0.01 , suite= test_suite_approximate)
@@ -40,40 +40,40 @@ program test_assert
4040 call assert_approximate(reshape ([1.0D0 , 1.0D0 , 1.0D0 , 1.0D0 ], [2 , 2 ]), reshape ([1.0D0 , 1.000000000001D0 , 1.0D0 , 1.0D0 ], [2 , 2 ]), suite= test_suite_approximate)
4141 call assert_approximate(reshape ([1.0D0 , 1.0D0 , 1.0D0 , 1.0D0 ], [2 , 2 ]), reshape ([1.0D0 , 1.10D0 , 1.0D0 , 1.0D0 ], [2 , 2 ]), eps= 0.01D0 , suite= test_suite_approximate)
4242 call assert_approximate(reshape ([1.0D0 , 1.0D0 , 1.0D0 , 1.0D0 ], [2 , 2 ]), reshape ([1.0D0 , 1.01D0 , 1.0D0 , 1.0D0 ], [2 , 2 ]), eps= 0.01D0 , suite= test_suite_approximate)
43-
43+
4444 call test_suite_report(test_suite_approximate)
4545 call test_suite_final(test_suite_approximate)
46-
46+
4747 ! test assert_false/_true routines
48- test_suite_boolean % name = ' Boolean'
49-
48+ call test_suite_init( ' Boolean' , test_suite_boolean)
49+
5050 ! -> false
5151 call test_case_create(' false' , test_suite_boolean)
5252 call assert_false(.true. , __FILE__, __LINE__, test_suite_boolean)
5353 call assert_false(.false. , __FILE__, __LINE__, test_suite_boolean)
54-
54+
5555 ! -> true
5656 call test_case_create(' true' , test_suite_boolean)
5757 call assert_true(.false. , __FILE__, __LINE__, test_suite_boolean)
5858 call assert_true(.true. , __FILE__, __LINE__, test_suite_boolean)
59-
59+
6060 call test_suite_report(test_suite_boolean)
6161 call test_suite_final(test_suite_boolean)
62-
62+
6363 ! test assert_equal routines
64- test_suite_equal % name = ' Equal'
65-
64+ call test_suite_init( ' Equal' , test_suite_equal)
65+
6666 ! -> string
6767 call test_case_create(' string' , test_suite_equal)
6868 call assert_equal(' abc' , ' abcd' , __FILE__, __LINE__, test_suite_equal)
6969 call assert_equal(' abc' , ' abc' , __FILE__, __LINE__, test_suite_equal)
70-
70+
7171 call assert_equal([' abc' , ' abc' ], [' abc' , ' abd' ], __FILE__, __LINE__, test_suite_equal)
7272 call assert_equal([' abc' , ' abc' ], [' abc' , ' abc' ], __FILE__, __LINE__, test_suite_equal)
73-
73+
7474 call assert_equal(reshape ([' abc' , ' abc' , ' abc' , ' abc' ], [2 , 2 ]), reshape ([' abc' , ' abd' , ' abc' , ' abd' ], [2 , 2 ]), __FILE__, __LINE__, test_suite_equal)
7575 call assert_equal(reshape ([' abc' , ' abc' , ' abc' , ' abc' ], [2 , 2 ]), reshape ([' abc' , ' abc' , ' abc' , ' abc' ], [2 , 2 ]), __FILE__, __LINE__, test_suite_equal)
76-
76+
7777 ! -> integer (int8->kind=1, int16->kind=2, int32->kind=4, int64->kind=8)
7878 call test_case_create(' integer' , test_suite_equal)
7979 call assert_equal(int (1 , 1 ), int (2 , 1 ), __FILE__, __LINE__, test_suite_equal)
@@ -84,7 +84,7 @@ program test_assert
8484 call assert_equal(int (3 , 4 ), int (3 , 4 ), __FILE__, __LINE__, test_suite_equal)
8585 call assert_equal(int (1 , 8 ), int (2 , 8 ), __FILE__, __LINE__, test_suite_equal)
8686 call assert_equal(int (3 , 8 ), int (3 , 8 ), __FILE__, __LINE__, test_suite_equal)
87-
87+
8888 call assert_equal([int (1 , 1 ), int (1 , 1 ), int (1 , 1 ), int (1 , 1 )], [int (1 , 1 ), int (2 , 1 ), int (1 , 1 ), int (1 , 1 )], __FILE__, __LINE__, test_suite_equal)
8989 call assert_equal([int (1 , 1 ), int (1 , 1 ), int (1 , 1 ), int (1 , 1 )], [int (1 , 1 ), int (1 , 1 ), int (1 , 1 ), int (1 , 1 )], __FILE__, __LINE__, test_suite_equal)
9090 call assert_equal([int (1 , 2 ), int (1 , 2 ), int (1 , 2 ), int (1 , 2 )], [int (1 , 2 ), int (2 , 2 ), int (1 , 2 ), int (1 , 2 )], __FILE__, __LINE__, test_suite_equal)
@@ -93,7 +93,7 @@ program test_assert
9393 call assert_equal([int (1 , 4 ), int (1 , 4 ), int (1 , 4 ), int (1 , 4 )], [int (1 , 4 ), int (1 , 4 ), int (1 , 4 ), int (1 , 4 )], __FILE__, __LINE__, test_suite_equal)
9494 call assert_equal([int (1 , 8 ), int (1 , 8 ), int (1 , 8 ), int (1 , 8 )], [int (1 , 8 ), int (2 , 8 ), int (1 , 8 ), int (1 , 8 )], __FILE__, __LINE__, test_suite_equal)
9595 call assert_equal([int (1 , 8 ), int (1 , 8 ), int (1 , 8 ), int (1 , 8 )], [int (1 , 8 ), int (1 , 8 ), int (1 , 8 ), int (1 , 8 )], __FILE__, __LINE__, test_suite_equal)
96-
96+
9797 call assert_equal(reshape ([int (1 , 1 ), int (1 , 1 ), int (1 , 1 ), int (1 , 1 )], [2 , 2 ]), &
9898 & reshape ([int (1 , 1 ), int (2 , 1 ), int (1 , 1 ), int (1 , 1 )], [2 , 2 ]), __FILE__, __LINE__, test_suite_equal)
9999 call assert_equal(reshape ([int (1 , 1 ), int (1 , 1 ), int (1 , 1 ), int (1 , 1 )], [2 , 2 ]), &
@@ -110,30 +110,30 @@ program test_assert
110110 & reshape ([int (1 , 8 ), int (2 , 8 ), int (1 , 8 ), int (1 , 8 )], [2 , 2 ]), __FILE__, __LINE__, test_suite_equal)
111111 call assert_equal(reshape ([int (1 , 8 ), int (1 , 8 ), int (1 , 8 ), int (1 , 8 )], [2 , 2 ]), &
112112 & reshape ([int (1 , 8 ), int (1 , 8 ), int (1 , 8 ), int (1 , 8 )], [2 , 2 ]), __FILE__, __LINE__, test_suite_equal)
113-
113+
114114 ! -> real (real4, real8)
115115 call test_case_create(' real' , test_suite_equal)
116116 call assert_equal(1.0 , 2.0 , __FILE__, __LINE__, test_suite_equal)
117117 call assert_equal(3.0 , 3.0 , __FILE__, __LINE__, test_suite_equal)
118118 call assert_equal(1.0D0 , 2.0D0 , __FILE__, __LINE__, test_suite_equal)
119119 call assert_equal(3.0D0 , 3.0D0 , __FILE__, __LINE__, test_suite_equal)
120-
120+
121121 call assert_equal([1.0 , 1.0 ], [1.0 , 2.0 ], __FILE__, __LINE__, test_suite_equal)
122122 call assert_equal([1.0 , 1.0 ], [1.0 , 1.0 ], __FILE__, __LINE__, test_suite_equal)
123123 call assert_equal([1.0D0 , 1.0D0 ], [1.0D0 , 2.0D0 ], __FILE__, __LINE__, test_suite_equal)
124124 call assert_equal([1.0D0 , 1.0D0 ], [1.0D0 , 1.0D0 ], __FILE__, __LINE__, test_suite_equal)
125-
125+
126126 call assert_equal(reshape ([1.0 , 1.0 , 1.0 , 1.0 ], [2 , 2 ]), reshape ([1.0 , 2.0 , 1.0 , 1.0 ], [2 , 2 ]), __FILE__, __LINE__, test_suite_equal)
127127 call assert_equal(reshape ([1.0 , 1.0 , 1.0 , 1.0 ], [2 , 2 ]), reshape ([1.0 , 1.0 , 1.0 , 1.0 ], [2 , 2 ]), __FILE__, __LINE__, test_suite_equal)
128128 call assert_equal(reshape ([1.0D0 , 1.0D0 , 1.0D0 , 1.0D0 ], [2 , 2 ]), reshape ([1.0D0 , 2.0D0 , 1.0D0 , 1.0D0 ], [2 , 2 ]), __FILE__, __LINE__, test_suite_equal)
129129 call assert_equal(reshape ([1.0D0 , 1.0D0 , 1.0D0 , 1.0D0 ], [2 , 2 ]), reshape ([1.0D0 , 1.0D0 , 1.0D0 , 1.0D0 ], [2 , 2 ]), __FILE__, __LINE__, test_suite_equal)
130-
130+
131131 call test_suite_report(test_suite_equal)
132132 call test_suite_final(test_suite_equal)
133133
134134 ! test assert_great_than routines
135- test_suite_great_than % name = ' great_then'
136-
135+ call test_suite_init( ' great_then' , test_suite_great_than)
136+
137137 ! -> integer (int8->kind=1, int16->kind=2, int32->kind=4, int64->kind=8)
138138 call test_case_create(' integer' , test_suite_great_than)
139139 call assert_great_than(int (1 , 1 ), int (1 , 1 ), __FILE__, __LINE__, test_suite_great_than)
@@ -144,7 +144,7 @@ program test_assert
144144 call assert_great_than(int (2 , 4 ), int (1 , 4 ), __FILE__, __LINE__, test_suite_great_than)
145145 call assert_great_than(int (1 , 8 ), int (1 , 8 ), __FILE__, __LINE__, test_suite_great_than)
146146 call assert_great_than(int (2 , 8 ), int (1 , 8 ), __FILE__, __LINE__, test_suite_great_than)
147-
147+
148148 call assert_great_than([int (1 , 1 ), int (1 , 1 ), int (1 , 1 ), int (1 , 1 )], [int (0 , 1 ), int (2 , 1 ), int (0 , 1 ), int (0 , 1 )], __FILE__, __LINE__, test_suite_great_than)
149149 call assert_great_than([int (1 , 1 ), int (1 , 1 ), int (1 , 1 ), int (1 , 1 )], [int (0 , 1 ), int (0 , 1 ), int (0 , 1 ), int (0 , 1 )], __FILE__, __LINE__, test_suite_great_than)
150150 call assert_great_than([int (1 , 2 ), int (1 , 2 ), int (1 , 2 ), int (1 , 2 )], [int (0 , 2 ), int (2 , 2 ), int (0 , 2 ), int (0 , 2 )], __FILE__, __LINE__, test_suite_great_than)
@@ -153,39 +153,39 @@ program test_assert
153153 call assert_great_than([int (1 , 4 ), int (1 , 4 ), int (1 , 4 ), int (1 , 4 )], [int (0 , 4 ), int (0 , 4 ), int (0 , 4 ), int (0 , 4 )], __FILE__, __LINE__, test_suite_great_than)
154154 call assert_great_than([int (1 , 8 ), int (1 , 8 ), int (1 , 8 ), int (1 , 8 )], [int (0 , 8 ), int (2 , 8 ), int (0 , 8 ), int (0 , 8 )], __FILE__, __LINE__, test_suite_great_than)
155155 call assert_great_than([int (1 , 8 ), int (1 , 8 ), int (1 , 8 ), int (1 , 8 )], [int (0 , 8 ), int (0 , 8 ), int (0 , 8 ), int (0 , 8 )], __FILE__, __LINE__, test_suite_great_than)
156-
156+
157157 call assert_great_than(reshape ([int (1 , 1 ), int (1 , 1 ), int (1 , 1 ), int (1 , 1 )], [2 , 2 ]), &
158158 & reshape ([int (0 , 1 ), int (2 , 1 ), int (0 , 1 ), int (0 , 1 )], [2 , 2 ]), __FILE__, __LINE__, test_suite_great_than)
159159 call assert_great_than(reshape ([int (1 , 1 ), int (1 , 1 ), int (1 , 1 ), int (1 , 1 )], [2 , 2 ]), &
160160 & reshape ([int (0 , 1 ), int (0 , 1 ), int (0 , 1 ), int (0 , 1 )], [2 , 2 ]), __FILE__, __LINE__, test_suite_great_than)
161-
161+
162162 call assert_great_than(reshape ([int (1 , 2 ), int (1 , 2 ), int (1 , 2 ), int (1 , 2 )], [2 , 2 ]), &
163163 & reshape ([int (0 , 2 ), int (2 , 2 ), int (0 , 2 ), int (0 , 2 )], [2 , 2 ]), __FILE__, __LINE__, test_suite_great_than)
164164 call assert_great_than(reshape ([int (1 , 2 ), int (1 , 2 ), int (1 , 2 ), int (1 , 2 )], [2 , 2 ]), &
165165 & reshape ([int (0 , 2 ), int (0 , 2 ), int (0 , 2 ), int (0 , 2 )], [2 , 2 ]), __FILE__, __LINE__, test_suite_great_than)
166-
166+
167167 call assert_great_than(reshape ([int (1 , 4 ), int (1 , 4 ), int (1 , 4 ), int (1 , 4 )], [2 , 2 ]), &
168168 & reshape ([int (0 , 4 ), int (2 , 4 ), int (0 , 4 ), int (0 , 4 )], [2 , 2 ]), __FILE__, __LINE__, test_suite_great_than)
169169 call assert_great_than(reshape ([int (1 , 4 ), int (1 , 4 ), int (1 , 4 ), int (1 , 4 )], [2 , 2 ]), &
170170 & reshape ([int (0 , 4 ), int (0 , 4 ), int (0 , 4 ), int (0 , 4 )], [2 , 2 ]), __FILE__, __LINE__, test_suite_great_than)
171-
171+
172172 call assert_great_than(reshape ([int (1 , 8 ), int (1 , 8 ), int (1 , 8 ), int (1 , 8 )], [2 , 2 ]), &
173173 & reshape ([int (0 , 8 ), int (2 , 8 ), int (0 , 8 ), int (0 , 8 )], [2 , 2 ]), __FILE__, __LINE__, test_suite_great_than)
174174 call assert_great_than(reshape ([int (1 , 8 ), int (1 , 8 ), int (1 , 8 ), int (1 , 8 )], [2 , 2 ]), &
175175 & reshape ([int (0 , 8 ), int (0 , 8 ), int (0 , 8 ), int (0 , 8 )], [2 , 2 ]), __FILE__, __LINE__, test_suite_great_than)
176-
176+
177177 ! -> real (real4, real8)
178178 call test_case_create(' real' , test_suite_great_than)
179179 call assert_great_than(1.0 , 1.0 , __FILE__, __LINE__, test_suite_great_than)
180180 call assert_great_than(2.0 , 1.0 , __FILE__, __LINE__, test_suite_great_than)
181181 call assert_great_than(1.0D0 , 1.0D0 , __FILE__, __LINE__, test_suite_great_than)
182182 call assert_great_than(2.0D0 , 1.0D0 , __FILE__, __LINE__, test_suite_great_than)
183-
183+
184184 call assert_great_than([1.0 , 1.0 ], [0.0 , 2.0 ], __FILE__, __LINE__, test_suite_great_than)
185185 call assert_great_than([1.0 , 1.0 ], [0.0 , 0.0 ], __FILE__, __LINE__, test_suite_great_than)
186186 call assert_great_than([1.0D0 , 1.0D0 ], [0.0D0 , 2.0D0 ], __FILE__, __LINE__, test_suite_great_than)
187187 call assert_great_than([1.0D0 , 1.0D0 ], [0.0D0 , 0.0D0 ], __FILE__, __LINE__, test_suite_great_than)
188-
188+
189189 call assert_great_than(reshape ([1.0 , 1.0 , 1.0 , 1.0 ], [2 , 2 ]), reshape ([0.0 , 2.0 , 0.0 , 0.0 ], [2 , 2 ]), __FILE__, __LINE__, test_suite_great_than)
190190 call assert_great_than(reshape ([1.0 , 1.0 , 1.0 , 1.0 ], [2 , 2 ]), reshape ([0.0 , 0.0 , 0.0 , 0.0 ], [2 , 2 ]), __FILE__, __LINE__, test_suite_great_than)
191191 call assert_great_than(reshape ([1.0D0 , 1.0D0 , 1.0D0 , 1.0D0 ], [2 , 2 ]), reshape ([0.0D0 , 2.0D0 , 0.0D0 , 0.0D0 ], [2 , 2 ]), __FILE__, __LINE__, test_suite_great_than)
0 commit comments