fUnit 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. data/README +16 -15
  2. data/Rakefile +1 -1
  3. data/bin/funit +1 -1
  4. data/docs/html/classes/Funit.html +20 -22
  5. data/docs/html/classes/Funit/Assertions.html +1 -1
  6. data/docs/html/classes/Funit/Compiler.html +3 -3
  7. data/docs/html/classes/Funit/TestSuite.html +43 -43
  8. data/docs/html/created.rid +1 -1
  9. data/docs/html/files/README.html +22 -25
  10. data/docs/html/files/lib/funit/assertions_rb.html +1 -1
  11. data/docs/html/files/lib/funit/functions_rb.html +1 -1
  12. data/docs/html/files/lib/funit/test_suite_rb.html +10 -1
  13. data/docs/html/files/lib/funit_rb.html +1 -1
  14. data/docs/html/fr_method_index.html +2 -2
  15. data/examples/CFD/{FluxFunctionsMT.ftk → FluxFunctions.fun} +1 -1
  16. data/examples/CFD/{GasModelMT.ftk → GasModel.fun} +1 -1
  17. data/examples/StopWatch/{StopWatchMT.ftk → StopWatch.fun} +0 -0
  18. data/lib/funit.rb +4 -6
  19. data/lib/funit/assertions.rb +1 -1
  20. data/lib/funit/functions.rb +20 -20
  21. data/lib/funit/test_suite.rb +43 -38
  22. data/tests/tc_compile.rb +7 -4
  23. data/tests/tc_fortran_deps.rb +3 -0
  24. data/tests/tc_funit.rb +30 -16
  25. data/tests/tc_test_suite.rb +29 -31
  26. metadata +4 -17
  27. data/examples/CFD/FluxFunctionsMT.f90 +0 -336
  28. data/examples/CFD/GasModelMT.f90 +0 -173
  29. data/examples/CFD/TestRunner +0 -0
  30. data/examples/CFD/TestRunner.f90 +0 -23
  31. data/examples/CFD/fluxfunctions.mod +0 -45
  32. data/examples/CFD/gammas.mod +0 -20
  33. data/examples/CFD/gasmodel.mod +0 -30
  34. data/examples/CFD/gasmodelmt.mod +0 -27
  35. data/examples/StopWatch/StopWatchMT.f90 +0 -343
  36. data/examples/StopWatch/TestRunner +0 -0
  37. data/examples/StopWatch/TestRunner.f90 +0 -23
  38. data/examples/StopWatch/stopwatch.mod +0 -34
  39. data/examples/StopWatch/stopwatchmt.mod +0 -27
@@ -1,173 +0,0 @@
1
- ! GasModelMT.f90 - a Fortran mobility test suite for GasModel.f90
2
- !
3
- ! [dynamically generated from GasModelMT.ftk
4
- ! by funit Ruby script Sun Apr 09 01:10:35 EDT 2006]
5
-
6
- module GasModelMT
7
-
8
- use GasModel
9
-
10
- implicit none
11
-
12
- private
13
-
14
- public :: MTGasModel
15
-
16
- logical :: noAssertFailed
17
-
18
- integer :: numTests = 0
19
- integer :: numAsserts = 0
20
- integer :: numAssertsTested = 0
21
- integer :: numFailures = 0
22
-
23
- ! $Id: GasModelTS.ftk 91 2001-11-13 20:46:28Z cvs4bk $
24
-
25
- real :: Pressure, Density, Energy
26
-
27
- contains
28
-
29
- subroutine TestPerfectPZeroed
30
-
31
- real, parameter :: zero = 0
32
- call PerfectP (zero, zero, Pressure)
33
-
34
- ! IsRealEqual assertion
35
- numAsserts = numAsserts + 1
36
- if (noAssertFailed) then
37
- if (.not.(Pressure+2*spacing(real(Pressure)).ge. 0 &
38
- .and.Pressure-2*spacing(real(Pressure)).le. 0 )) then
39
- print *, " *IsRealEqual failed* in test PerfectPZeroed &
40
- &[GasModelMT.ftk:8]"
41
- print *, " ", " 0 (", 0 ,") is not",Pressure,"within",2*spacing(real(Pressure))
42
- print *, ""
43
- noAssertFailed = .false.
44
- numFailures = numFailures + 1
45
- else
46
- numAssertsTested = numAssertsTested + 1
47
- endif
48
- endif
49
-
50
- ! IsEqualWithin assertion
51
- numAsserts = numAsserts + 1
52
- if (noAssertFailed) then
53
- if (.not.( 0+ 0.0000000001 .ge. Pressure &
54
- .and. 0- 0.0000000001 .le. Pressure)) then
55
- print *, " *IsEqualWithin failed* in test PerfectPZeroed &
56
- &[GasModelMT.ftk:9]"
57
- print *, " ", " Pressure (", Pressure,") is not", 0,"within", 0.0000000001
58
- print *, ""
59
- noAssertFailed = .false.
60
- numFailures = numFailures + 1
61
- else
62
- numAssertsTested = numAssertsTested + 1
63
- endif
64
- endif
65
-
66
- numTests = numTests + 1
67
-
68
- end subroutine TestPerfectPZeroed
69
-
70
-
71
- subroutine TestWarbler
72
-
73
-
74
- numTests = numTests + 1
75
-
76
- end subroutine TestWarbler
77
-
78
-
79
- subroutine TestPerfectPKnown
80
-
81
- real :: Density = 1
82
- Energy = 1
83
- call PerfectP( Density, Energy, Pressure )
84
-
85
- ! IsRealEqual assertion
86
- numAsserts = numAsserts + 1
87
- if (noAssertFailed) then
88
- if (.not.( Pressure+2*spacing(real( Pressure)).ge. 0.4 &
89
- .and. Pressure-2*spacing(real( Pressure)).le. 0.4 )) then
90
- print *, " *IsRealEqual failed* in test PerfectPKnown &
91
- &[GasModelMT.ftk:19]"
92
- print *, " ", " 0.4 (", 0.4 ,") is not", Pressure,"within",2*spacing(real( Pressure))
93
- print *, ""
94
- noAssertFailed = .false.
95
- numFailures = numFailures + 1
96
- else
97
- numAssertsTested = numAssertsTested + 1
98
- endif
99
- endif
100
-
101
- ! IsTrue assertion
102
- numAsserts = numAsserts + 1
103
- if (noAssertFailed) then
104
- if (.not.( Pressure .gt. 0 )) then
105
- print *, " *IsTrue failed* in test PerfectPKnown &
106
- &[GasModelMT.ftk:20]"
107
- print *, " ", " Pressure .gt. 0 is not true"
108
- print *, ""
109
- noAssertFailed = .false.
110
- numFailures = numFailures + 1
111
- else
112
- numAssertsTested = numAssertsTested + 1
113
- endif
114
- endif
115
-
116
- ! IsFalse assertion
117
- numAsserts = numAsserts + 1
118
- if (noAssertFailed) then
119
- if ( Pressure .lt. 0 ) then
120
- print *, " *IsFalse failed* in test PerfectPKnown &
121
- &[GasModelMT.ftk:21]"
122
- print *, " ", " Pressure .lt. 0 is not false"
123
- print *, ""
124
- noAssertFailed = .false.
125
- numFailures = numFailures + 1
126
- else
127
- numAssertsTested = numAssertsTested + 1
128
- endif
129
- endif
130
-
131
- numTests = numTests + 1
132
-
133
- end subroutine TestPerfectPKnown
134
-
135
-
136
- subroutine Setup
137
- noAssertFailed = .true.
138
- end subroutine Setup
139
-
140
-
141
- subroutine Teardown
142
- end subroutine Teardown
143
-
144
-
145
- subroutine MTGasModel( nTests, nAsserts, nAssertsTested, nFailures )
146
-
147
- integer :: nTests
148
- integer :: nAsserts
149
- integer :: nAssertsTested
150
- integer :: nFailures
151
-
152
- continue
153
-
154
- call Setup
155
- call TestPerfectPZeroed
156
- call Teardown
157
-
158
- call Setup
159
- call TestWarbler
160
- call Teardown
161
-
162
- call Setup
163
- call TestPerfectPKnown
164
- call Teardown
165
-
166
- nTests = numTests
167
- nAsserts = numAsserts
168
- nAssertsTested = numAssertsTested
169
- nFailures = numFailures
170
-
171
- end subroutine MTGasModel
172
-
173
- end module GasModelMT
Binary file
@@ -1,23 +0,0 @@
1
- ! TestRunner.f90 - runs Fortran mobility test suites
2
- !
3
- ! [Dynamically generated by funit Ruby script Sun Apr 09 01:22:59 EDT 2006.]
4
-
5
- program TestRunner
6
-
7
- use FluxFunctionsMT
8
-
9
- implicit none
10
-
11
- integer :: numTests, numAsserts, numAssertsTested, numFailures
12
-
13
- print *, ""
14
- print *, "FluxFunctions test suite:"
15
- call MTFluxFunctions( numTests, &
16
- numAsserts, numAssertsTested, numFailures )
17
- print *, "Passed", numAssertsTested, "of", numAsserts, &
18
- "possible asserts comprising", &
19
- numTests-numFailures, "of", numTests, "tests."
20
-
21
- print *, ""
22
-
23
- end program TestRunner
@@ -1,45 +0,0 @@
1
- G95 module created on Sun Apr 9 01:07:49 2006 from ./FluxFunctions.f90
2
- If you edit this, you'll get what you deserve.
3
-
4
- (() () () () () () () () () () () () () () () () () () () () ())
5
-
6
- ()
7
-
8
- ()
9
-
10
- ()
11
-
12
- ()
13
-
14
- (2 'centralflux' 'fluxfunctions' 1 ((PROCEDURE UNKNOWN MODULE-PROC DECL
15
- SUBROUTINE) (PROCEDURE 0 ()) 0 0 (3 NONE 4 NONE 5 NONE) () '' () ())
16
- 6 'roeavg' 'fluxfunctions' 1 ((PROCEDURE UNKNOWN MODULE-PROC DECL
17
- FUNCTION) (REAL 4 ()) 0 0 (7 NONE 8 NONE) () '' () ())
18
- 9 'fluxfunctions' 'fluxfunctions' 1 ((MODULE UNKNOWN UNKNOWN UNKNOWN) (
19
- UNKNOWN 0 ()) 0 0 () () '' () ())
20
- 10 'roeflux' 'fluxfunctions' 1 ((PROCEDURE UNKNOWN MODULE-PROC DECL
21
- SUBROUTINE) (PROCEDURE 0 ()) 0 0 (11 NONE 12 NONE 13 NONE) () '' () ())
22
- 14 'flux' 'fluxfunctions' 1 ((PROCEDURE UNKNOWN MODULE-PROC DECL
23
- FUNCTION) (REAL 4 ()) 0 0 (15 NONE) () '' () ())
24
- 4 'rightstate' '' 16 ((VARIABLE IN UNKNOWN UNKNOWN DUMMY) (REAL 4 ()) 0
25
- 0 () () '' () ())
26
- 11 'leftstate' '' 17 ((VARIABLE IN UNKNOWN UNKNOWN DUMMY) (REAL 4 ()) 0
27
- 0 () () '' () ())
28
- 12 'rightstate' '' 17 ((VARIABLE IN UNKNOWN UNKNOWN DUMMY) (REAL 4 ()) 0
29
- 0 () () '' () ())
30
- 5 'interfaceflux' '' 16 ((VARIABLE OUT UNKNOWN UNKNOWN DUMMY) (REAL 4 ())
31
- 0 0 () () '' () ())
32
- 13 'interfaceflux' '' 17 ((VARIABLE OUT UNKNOWN UNKNOWN DUMMY) (REAL 4 ())
33
- 0 0 () () '' () ())
34
- 15 'state' '' 18 ((VARIABLE IN UNKNOWN UNKNOWN DUMMY) (REAL 4 ()) 0 0 ()
35
- () '' () ())
36
- 7 'leftstate' '' 19 ((VARIABLE IN UNKNOWN UNKNOWN DUMMY) (REAL 4 ()) 0 0
37
- () () '' () ())
38
- 8 'rightstate' '' 19 ((VARIABLE IN UNKNOWN UNKNOWN DUMMY) (REAL 4 ()) 0
39
- 0 () () '' () ())
40
- 3 'leftstate' '' 16 ((VARIABLE IN UNKNOWN UNKNOWN DUMMY) (REAL 4 ()) 0 0
41
- () () '' () ())
42
- )
43
-
44
- ('flux' 0 14 'centralflux' 0 2 'roeflux' 0 10 'fluxfunctions' 0 9 'roeavg'
45
- 0 6)
@@ -1,20 +0,0 @@
1
- G95 module created on Sun Apr 9 01:07:49 2006 from ./Gammas.f90
2
- If you edit this, you'll get what you deserve.
3
-
4
- (() () () () () () () () () () () () () () () () () () () () ())
5
-
6
- ()
7
-
8
- ()
9
-
10
- ()
11
-
12
- ()
13
-
14
- (2 'gamma' 'gammas' 1 ((PARAMETER UNKNOWN UNKNOWN UNKNOWN) (REAL 4 ()) 0
15
- 0 () (CONSTANT (REAL 4 ()) 0 '11744051' 0 127) () '' () ())
16
- 3 'gammas' 'gammas' 1 ((MODULE UNKNOWN UNKNOWN UNKNOWN) (UNKNOWN 0 ()) 0
17
- 0 () () '' () ())
18
- )
19
-
20
- ('gammas' 0 3 'gamma' 0 2)
@@ -1,30 +0,0 @@
1
- G95 module created on Sun Apr 9 01:07:49 2006 from ./GasModel.f90
2
- If you edit this, you'll get what you deserve.
3
-
4
- (() () () () () () () () () () () () () () () () () () () () ())
5
-
6
- ()
7
-
8
- ()
9
-
10
- ()
11
-
12
- ()
13
-
14
- (2 'gamma' 'gammas' 1 ((PARAMETER UNKNOWN UNKNOWN UNKNOWN) (REAL 4 ()) 0
15
- 0 () (CONSTANT (REAL 4 ()) 0 '11744051' 0 127) () '' () ())
16
- 3 'gammas' 'gammas' 1 ((MODULE UNKNOWN UNKNOWN UNKNOWN) (UNKNOWN 0 ()) 0
17
- 0 () () '' () ())
18
- 4 'perfectp' 'gasmodel' 1 ((PROCEDURE UNKNOWN MODULE-PROC DECL
19
- SUBROUTINE) (PROCEDURE 0 ()) 0 0 (5 NONE 6 NONE 7 NONE) () '' () ())
20
- 8 'gasmodel' 'gasmodel' 1 ((MODULE UNKNOWN UNKNOWN UNKNOWN) (UNKNOWN 0 ())
21
- 0 0 () () '' () ())
22
- 5 'density' '' 9 ((VARIABLE IN UNKNOWN UNKNOWN DUMMY) (REAL 4 ()) 0 0 ()
23
- () '' () ())
24
- 7 'pressure' '' 9 ((VARIABLE OUT UNKNOWN UNKNOWN DUMMY) (REAL 4 ()) 0 0
25
- () () '' () ())
26
- 6 'energy' '' 9 ((VARIABLE IN UNKNOWN UNKNOWN DUMMY) (REAL 4 ()) 0 0 ()
27
- () '' () ())
28
- )
29
-
30
- ('gasmodel' 0 8 'gammas' 0 3 'gamma' 0 2 'perfectp' 0 4)
@@ -1,27 +0,0 @@
1
- G95 module created on Sun Apr 9 01:07:49 2006 from ./GasModelMT.f90
2
- If you edit this, you'll get what you deserve.
3
-
4
- (() () () () () () () () () () () () () () () () () () () () ())
5
-
6
- ()
7
-
8
- ()
9
-
10
- ()
11
-
12
- ()
13
-
14
- (2 'mtgasmodel' 'gasmodelmt' 1 ((PROCEDURE UNKNOWN MODULE-PROC DECL
15
- SUBROUTINE) (PROCEDURE 0 ()) 0 0 (3 NONE 4 NONE 5 NONE 6 NONE) () '' ()
16
- ())
17
- 3 'ntests' '' 7 ((VARIABLE UNKNOWN UNKNOWN UNKNOWN DUMMY) (INTEGER 4 ())
18
- 0 0 () () '' () ())
19
- 4 'nasserts' '' 7 ((VARIABLE UNKNOWN UNKNOWN UNKNOWN DUMMY) (INTEGER 4 ())
20
- 0 0 () () '' () ())
21
- 6 'nfailures' '' 7 ((VARIABLE UNKNOWN UNKNOWN UNKNOWN DUMMY) (INTEGER 4
22
- ()) 0 0 () () '' () ())
23
- 5 'nassertstested' '' 7 ((VARIABLE UNKNOWN UNKNOWN UNKNOWN DUMMY) (
24
- INTEGER 4 ()) 0 0 () () '' () ())
25
- )
26
-
27
- ('mtgasmodel' 0 2)
@@ -1,343 +0,0 @@
1
- ! StopWatchMT.f90 - a Fortran mobility test suite for StopWatch.f90
2
- !
3
- ! [dynamically generated from StopWatchMT.ftk
4
- ! by funit Ruby script Thu Apr 13 17:37:19 EDT 2006]
5
-
6
- module StopWatchMT
7
-
8
- use StopWatch
9
-
10
- implicit none
11
-
12
- private
13
-
14
- public :: MTStopWatch
15
-
16
- logical :: noAssertFailed
17
-
18
- integer :: numTests = 0
19
- integer :: numAsserts = 0
20
- integer :: numAssertsTested = 0
21
- integer :: numFailures = 0
22
-
23
- integer, dimension(8) :: dateAndTime1, dateAndTime2
24
- real :: seconds
25
-
26
- contains
27
-
28
-
29
- subroutine TestSystemDateAndTimeWorks
30
-
31
- call date_and_time(values=dateAndTime1)
32
-
33
- ! IsTrue assertion
34
- numAsserts = numAsserts + 1
35
- if (noAssertFailed) then
36
- if (.not.( dateAndTime1(1) /= -huge(0) )) then
37
- print *, " *IsTrue failed* in test SystemDateAndTimeWorks &
38
- &[StopWatchMT.ftk:12]"
39
- print *, " ", " dateAndTime1(1) /= -huge(0) is not true"
40
- print *, ""
41
- noAssertFailed = .false.
42
- numFailures = numFailures + 1
43
- else
44
- numAssertsTested = numAssertsTested + 1
45
- endif
46
- endif
47
-
48
- ! IsTrue assertion
49
- numAsserts = numAsserts + 1
50
- if (noAssertFailed) then
51
- if (.not.( size(dateAndTime1,1) == 8 )) then
52
- print *, " *IsTrue failed* in test SystemDateAndTimeWorks &
53
- &[StopWatchMT.ftk:13]"
54
- print *, " ", " size(dateAndTime1,1) == 8 is not true"
55
- print *, ""
56
- noAssertFailed = .false.
57
- numFailures = numFailures + 1
58
- else
59
- numAssertsTested = numAssertsTested + 1
60
- endif
61
- endif
62
-
63
- numTests = numTests + 1
64
-
65
- end subroutine TestSystemDateAndTimeWorks
66
-
67
-
68
- ! test secBetween
69
- subroutine TestOneMSecDifference
70
-
71
- dateAndTime1 = (/ 2000, 1, 1, 0, 0, 0, 0, 0 /)
72
- dateAndTime2 = (/ 2000, 1, 1, 0, 0, 0, 0, 1 /)
73
- seconds = SecBetween(dateAndTime1, dateAndTime2)
74
-
75
- ! IsRealEqual assertion
76
- numAsserts = numAsserts + 1
77
- if (noAssertFailed) then
78
- if (.not.(seconds+2*spacing(real(seconds)).ge. 0.001 &
79
- .and.seconds-2*spacing(real(seconds)).le. 0.001)) then
80
- print *, " *IsRealEqual failed* in test OneMSecDifference &
81
- &[StopWatchMT.ftk:21]"
82
- print *, " ", " 0.001 (", 0.001,") is not",seconds,"within",2*spacing(real(seconds))
83
- print *, ""
84
- noAssertFailed = .false.
85
- numFailures = numFailures + 1
86
- else
87
- numAssertsTested = numAssertsTested + 1
88
- endif
89
- endif
90
-
91
- numTests = numTests + 1
92
-
93
- end subroutine TestOneMSecDifference
94
-
95
-
96
- subroutine TestMinuteRollover
97
-
98
- dateAndTime1 = (/ 2000, 1, 1, 0, 0, 0,59, 0 /)
99
- dateAndTime2 = (/ 2000, 1, 1, 0, 0, 1, 0, 0 /)
100
- seconds = SecBetween(dateAndTime1, dateAndTime2)
101
-
102
- ! IsRealEqual assertion
103
- numAsserts = numAsserts + 1
104
- if (noAssertFailed) then
105
- if (.not.(seconds+2*spacing(real(seconds)).ge. 1.0 &
106
- .and.seconds-2*spacing(real(seconds)).le. 1.0)) then
107
- print *, " *IsRealEqual failed* in test MinuteRollover &
108
- &[StopWatchMT.ftk:28]"
109
- print *, " ", " 1.0 (", 1.0,") is not",seconds,"within",2*spacing(real(seconds))
110
- print *, ""
111
- noAssertFailed = .false.
112
- numFailures = numFailures + 1
113
- else
114
- numAssertsTested = numAssertsTested + 1
115
- endif
116
- endif
117
-
118
- numTests = numTests + 1
119
-
120
- end subroutine TestMinuteRollover
121
-
122
-
123
- ! test secSinceLast
124
- subroutine TestInitializationState
125
-
126
-
127
- ! IsTrue assertion
128
- numAsserts = numAsserts + 1
129
- if (noAssertFailed) then
130
- if (.not.(notInitialized)) then
131
- print *, " *IsTrue failed* in test InitializationState &
132
- &[StopWatchMT.ftk:33]"
133
- print *, " ", "notInitialized is not true"
134
- print *, ""
135
- noAssertFailed = .false.
136
- numFailures = numFailures + 1
137
- else
138
- numAssertsTested = numAssertsTested + 1
139
- endif
140
- endif
141
- seconds = secSinceLast()
142
-
143
- ! IsFalse assertion
144
- numAsserts = numAsserts + 1
145
- if (noAssertFailed) then
146
- if (notInitialized) then
147
- print *, " *IsFalse failed* in test InitializationState &
148
- &[StopWatchMT.ftk:35]"
149
- print *, " ", "notInitialized is not false"
150
- print *, ""
151
- noAssertFailed = .false.
152
- numFailures = numFailures + 1
153
- else
154
- numAssertsTested = numAssertsTested + 1
155
- endif
156
- endif
157
- seconds = secSinceLast()
158
-
159
- ! IsFalse assertion
160
- numAsserts = numAsserts + 1
161
- if (noAssertFailed) then
162
- if (notInitialized) then
163
- print *, " *IsFalse failed* in test InitializationState &
164
- &[StopWatchMT.ftk:37]"
165
- print *, " ", "notInitialized is not false"
166
- print *, ""
167
- noAssertFailed = .false.
168
- numFailures = numFailures + 1
169
- else
170
- numAssertsTested = numAssertsTested + 1
171
- endif
172
- endif
173
-
174
- numTests = numTests + 1
175
-
176
- end subroutine TestInitializationState
177
-
178
-
179
- subroutine TestInitiallyReturnsZero
180
-
181
- seconds = secSinceLast()
182
-
183
- ! IsRealEqual assertion
184
- numAsserts = numAsserts + 1
185
- if (noAssertFailed) then
186
- if (.not.(seconds+2*spacing(real(seconds)).ge. 0.0 &
187
- .and.seconds-2*spacing(real(seconds)).le. 0.0)) then
188
- print *, " *IsRealEqual failed* in test InitiallyReturnsZero &
189
- &[StopWatchMT.ftk:42]"
190
- print *, " ", " 0.0 (", 0.0,") is not",seconds,"within",2*spacing(real(seconds))
191
- print *, ""
192
- noAssertFailed = .false.
193
- numFailures = numFailures + 1
194
- else
195
- numAssertsTested = numAssertsTested + 1
196
- endif
197
- endif
198
- call timeDelay(seconds)
199
- seconds = secSinceLast()
200
-
201
- ! IsTrue assertion
202
- numAsserts = numAsserts + 1
203
- if (noAssertFailed) then
204
- if (.not.( seconds /= 0.0 )) then
205
- print *, " *IsTrue failed* in test InitiallyReturnsZero &
206
- &[StopWatchMT.ftk:45]"
207
- print *, " ", " seconds /= 0.0 is not true"
208
- print *, ""
209
- noAssertFailed = .false.
210
- numFailures = numFailures + 1
211
- else
212
- numAssertsTested = numAssertsTested + 1
213
- endif
214
- endif
215
-
216
- numTests = numTests + 1
217
-
218
- end subroutine TestInitiallyReturnsZero
219
-
220
-
221
- subroutine timeDelay (sum)
222
- integer :: i
223
- real :: sum
224
- do i = 1, 1000000
225
- sum = sum + i
226
- enddo
227
- end subroutine timeDelay
228
-
229
- subroutine TestComputesSeconds
230
-
231
- seconds = secSinceLast()
232
- call timeDelay (seconds)
233
- seconds = secSinceLast()
234
-
235
- ! IsTrue assertion
236
- numAsserts = numAsserts + 1
237
- if (noAssertFailed) then
238
- if (.not.( seconds > 0.0 )) then
239
- print *, " *IsTrue failed* in test ComputesSeconds &
240
- &[StopWatchMT.ftk:60]"
241
- print *, " ", " seconds > 0.0 is not true"
242
- print *, ""
243
- noAssertFailed = .false.
244
- numFailures = numFailures + 1
245
- else
246
- numAssertsTested = numAssertsTested + 1
247
- endif
248
- endif
249
-
250
- numTests = numTests + 1
251
-
252
- end subroutine TestComputesSeconds
253
-
254
-
255
- subroutine TestComputesSecondsSpecial
256
-
257
- real :: expectedSeconds
258
-
259
- seconds = secSinceLast()
260
- dateAndTime1 = last
261
- call timeDelay (seconds)
262
- seconds = secSinceLast()
263
- dateAndTime2 = last
264
- expectedSeconds = secBetween(dateAndTime1,dateAndTime2)
265
-
266
- ! IsRealEqual assertion
267
- numAsserts = numAsserts + 1
268
- if (noAssertFailed) then
269
- if (.not.(seconds+2*spacing(real(seconds)).ge. expectedSeconds &
270
- .and.seconds-2*spacing(real(seconds)).le. expectedSeconds)) then
271
- print *, " *IsRealEqual failed* in test ComputesSecondsSpecial &
272
- &[StopWatchMT.ftk:72]"
273
- print *, " ", " expectedSeconds (", expectedSeconds,") is not",seconds,"within",2*spacing(real(seconds))
274
- print *, ""
275
- noAssertFailed = .false.
276
- numFailures = numFailures + 1
277
- else
278
- numAssertsTested = numAssertsTested + 1
279
- endif
280
- endif
281
-
282
- numTests = numTests + 1
283
-
284
- end subroutine TestComputesSecondsSpecial
285
-
286
-
287
- subroutine Setup
288
- NotInitialized = .TRUE.
289
- last = 0
290
- seconds = HUGE(0.0)
291
- noAssertFailed = .true.
292
- end subroutine Setup
293
-
294
-
295
- subroutine Teardown
296
- end subroutine Teardown
297
-
298
-
299
- subroutine MTStopWatch( nTests, nAsserts, nAssertsTested, nFailures )
300
-
301
- integer :: nTests
302
- integer :: nAsserts
303
- integer :: nAssertsTested
304
- integer :: nFailures
305
-
306
- continue
307
-
308
- call Setup
309
- call TestSystemDateAndTimeWorks
310
- call Teardown
311
-
312
- call Setup
313
- call TestOneMSecDifference
314
- call Teardown
315
-
316
- call Setup
317
- call TestMinuteRollover
318
- call Teardown
319
-
320
- call Setup
321
- call TestInitializationState
322
- call Teardown
323
-
324
- call Setup
325
- call TestInitiallyReturnsZero
326
- call Teardown
327
-
328
- call Setup
329
- call TestComputesSeconds
330
- call Teardown
331
-
332
- call Setup
333
- call TestComputesSecondsSpecial
334
- call Teardown
335
-
336
- nTests = numTests
337
- nAsserts = numAsserts
338
- nAssertsTested = numAssertsTested
339
- nFailures = numFailures
340
-
341
- end subroutine MTStopWatch
342
-
343
- end module StopWatchMT