@@ -6,11 +6,12 @@ program tester
66 use stdlib_kinds, only: int8, int16, int32, int64, sp, dp, qp
77 implicit none
88
9- ! test case format: (x, xmin, xmax, correct answer)
10- ! valid case: xmin is not greater than xmax
11- ! invalid case: xmin is greater than xmax
9+ ! clip function
10+ ! testing format: check(clip(x, xmin, xmax) == correct answer)
11+ ! valid case: xmin is not greater than xmax
12+ ! invalid case: xmin is greater than xmax
1213
13- ! type: integer(int8), kind: int8
14+ ! type: integer(int8), kind: int8
1415 ! valid test case
1516 call check(clip(2_int8 , - 2_int8 , 5_int8 ) == 2_int8 , &
1617 ' clip_int8 failed for valid case' , warn= .true. )
@@ -22,7 +23,7 @@ program tester
2223 call check(clip(127_int8 , 0_int8 , - 127_int8 ) == 0_int8 , &
2324 ' clip_int8 failed for invalid case' , warn= .true. )
2425
25- ! type: integer(int16), kind: int16
26+ ! type: integer(int16), kind: int16
2627 ! valid test case
2728 call check(clip(2_int16 , - 2_int16 , 5_int16 ) == 2_int16 , &
2829 ' clip_int16 failed for valid case' , warn= .true. )
@@ -34,7 +35,7 @@ program tester
3435 call check(clip(32767_int16 , 0_int16 , - 32767_int16 ) == 0_int16 , &
3536 ' clip_int16 failed for invalid case' , warn= .true. )
3637
37- ! type: integer(int32), kind: int32
38+ ! type: integer(int32), kind: int32
3839 ! valid test case
3940 call check(clip(2_int32 , - 2_int32 , 5_int32 ) == 2_int32 , &
4041 ' clip_int32 failed for valid case' , warn= .true. )
@@ -46,7 +47,7 @@ program tester
4647 call check(clip(- 2147483647_int32 , 2147483647_int32 , 0_int32 ) == 2147483647_int32 , &
4748 ' clip_int32 failed for invalid case' , warn= .true. )
4849
49- ! type: integer(int64), kind: int64
50+ ! type: integer(int64), kind: int64
5051 ! valid test case
5152 call check(clip(2_int64 , - 2_int64 , 5_int64 ) == 2_int64 , &
5253 ' clip_int64 failed for valid case' , warn= .true. )
@@ -58,7 +59,7 @@ program tester
5859 call check(clip(- 922337203_int64 , 25_int64 , - 10_int64 ) == 25_int64 , &
5960 ' clip_int64 failed for invalid case' , warn= .true. )
6061
61- ! type: real(sp), kind: sp
62+ ! type: real(sp), kind: sp
6263 ! valid test case
6364 call check(clip(3.025_sp , - 5.77_sp , 3.025_sp ) == 3.025_sp , &
6465 ' clip_sp failed for valid case' , warn= .true. )
@@ -70,7 +71,7 @@ program tester
7071 call check(clip(0.0_sp , - 59.68_sp , - 1578.025_sp ) == - 59.68_sp , &
7172 ' clip_sp failed for invalid case' , warn= .true. )
7273
73- ! type: real(dp), kind: dp
74+ ! type: real(dp), kind: dp
7475 ! valid test case
7576 call check(clip(3.025_dp , - 5.77_dp , 3.025_dp ) == 3.025_dp , &
7677 ' clip_dp failed for valid case' , warn= .true. )
@@ -82,7 +83,7 @@ program tester
8283 call check(clip(- 7.0_dp , 1.00268_dp , 0.059668_dp ) == 1.00268_dp , &
8384 ' clip_dp failed for invalid case' , warn= .true. )
8485
85- ! type: real(qp), kind: qp
86+ ! type: real(qp), kind: qp
8687 ! valid test case
8788 call check(clip(3.025_qp , - 5.77_qp , 3.025_qp ) == 3.025_qp , &
8889 ' clip_qp failed for valid case' , warn= .true. )
0 commit comments