fUnit 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +1 -4
- data/Rakefile +7 -2
- data/bin/funit +3 -0
- data/docs/html/classes/Funit.html +48 -48
- data/docs/html/classes/Funit/Assertions.html +56 -54
- data/docs/html/classes/Funit/Compiler.html +6 -6
- data/docs/html/classes/Funit/Depend.html +60 -60
- data/docs/html/classes/Funit/TestSuite.html +48 -48
- data/docs/html/classes/String.html +170 -0
- data/docs/html/created.rid +1 -1
- data/docs/html/files/README.html +2 -11
- data/docs/html/files/lib/funit/assertions_rb.html +8 -1
- data/docs/html/fr_class_index.html +1 -0
- data/docs/html/fr_method_index.html +34 -33
- data/lib/funit/assertions.rb +42 -13
- data/tests/tc_compile.rb +22 -22
- data/tests/tc_fortran_deps.rb +139 -132
- data/tests/tc_funit.rb +91 -92
- data/tests/tc_test_suite.rb +83 -83
- data/utils/funit-mode.el +115 -0
- metadata +4 -2
@@ -0,0 +1,170 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: String</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">String</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../files/lib/funit/assertions_rb.html">
|
59
|
+
lib/funit/assertions.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
Object
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
<div id="description">
|
82
|
+
<p>
|
83
|
+
Thanks to James Edward Gray II by way of ruby-talk mailing list
|
84
|
+
</p>
|
85
|
+
|
86
|
+
</div>
|
87
|
+
|
88
|
+
|
89
|
+
</div>
|
90
|
+
|
91
|
+
<div id="method-list">
|
92
|
+
<h3 class="section-bar">Methods</h3>
|
93
|
+
|
94
|
+
<div class="name-list">
|
95
|
+
<a href="#M000001">get_args</a>
|
96
|
+
</div>
|
97
|
+
</div>
|
98
|
+
|
99
|
+
</div>
|
100
|
+
|
101
|
+
|
102
|
+
<!-- if includes -->
|
103
|
+
|
104
|
+
<div id="section">
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
<!-- if method_list -->
|
114
|
+
<div id="methods">
|
115
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
116
|
+
|
117
|
+
<div id="method-M000001" class="method-detail">
|
118
|
+
<a name="M000001"></a>
|
119
|
+
|
120
|
+
<div class="method-heading">
|
121
|
+
<a href="#M000001" class="method-signature">
|
122
|
+
<span class="method-name">get_args</span><span class="method-args">()</span>
|
123
|
+
</a>
|
124
|
+
</div>
|
125
|
+
|
126
|
+
<div class="method-description">
|
127
|
+
<p><a class="source-toggle" href="#"
|
128
|
+
onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
|
129
|
+
<div class="method-source-code" id="M000001-source">
|
130
|
+
<pre>
|
131
|
+
<span class="ruby-comment cmt"># File lib/funit/assertions.rb, line 16</span>
|
132
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_args</span>
|
133
|
+
<span class="ruby-identifier">scanner</span> = <span class="ruby-constant">StringScanner</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>)
|
134
|
+
<span class="ruby-identifier">result</span> = <span class="ruby-identifier">scanner</span>.<span class="ruby-identifier">eos?</span> <span class="ruby-value">? </span><span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span> <span class="ruby-operator">:</span> [<span class="ruby-value str">""</span>]
|
135
|
+
<span class="ruby-identifier">paren_depth</span> = <span class="ruby-value">0</span>
|
136
|
+
<span class="ruby-keyword kw">until</span> <span class="ruby-identifier">scanner</span>.<span class="ruby-identifier">eos?</span>
|
137
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">scanner</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/[^(),]+/</span>)
|
138
|
+
<span class="ruby-comment cmt"># do nothing--we found the part of the argument we need to add</span>
|
139
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">scanner</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/\(/</span>)
|
140
|
+
<span class="ruby-identifier">paren_depth</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
141
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">scanner</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/\)/</span>)
|
142
|
+
<span class="ruby-identifier">paren_depth</span> <span class="ruby-operator">-=</span> <span class="ruby-value">1</span>
|
143
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">scanner</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/,\s*/</span>) <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">paren_depth</span>.<span class="ruby-identifier">zero?</span>
|
144
|
+
<span class="ruby-identifier">result</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">""</span>
|
145
|
+
<span class="ruby-keyword kw">next</span>
|
146
|
+
<span class="ruby-keyword kw">end</span>
|
147
|
+
|
148
|
+
<span class="ruby-identifier">result</span>.<span class="ruby-identifier">last</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">scanner</span>.<span class="ruby-identifier">matched</span>
|
149
|
+
<span class="ruby-keyword kw">end</span>
|
150
|
+
|
151
|
+
<span class="ruby-identifier">result</span>
|
152
|
+
<span class="ruby-keyword kw">end</span>
|
153
|
+
</pre>
|
154
|
+
</div>
|
155
|
+
</div>
|
156
|
+
</div>
|
157
|
+
|
158
|
+
|
159
|
+
</div>
|
160
|
+
|
161
|
+
|
162
|
+
</div>
|
163
|
+
|
164
|
+
|
165
|
+
<div id="validator-badges">
|
166
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
167
|
+
</div>
|
168
|
+
|
169
|
+
</body>
|
170
|
+
</html>
|
data/docs/html/created.rid
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Tue Apr 18 07:35:14 EDT 2006
|
data/docs/html/files/README.html
CHANGED
@@ -56,7 +56,7 @@
|
|
56
56
|
</tr>
|
57
57
|
<tr class="top-aligned-row">
|
58
58
|
<td><strong>Last Update:</strong></td>
|
59
|
-
<td>
|
59
|
+
<td>Sun Apr 16 07:29:30 EDT 2006</td>
|
60
60
|
</tr>
|
61
61
|
</table>
|
62
62
|
</div>
|
@@ -180,7 +180,7 @@ href="http://rubyforge.org/tracker/?group_id=1416">the tracking system</a>.
|
|
180
180
|
<p>
|
181
181
|
FUnit is released under the NASA Open Source Agreement, which requests
|
182
182
|
registration. If you would like to register, send an email to <a
|
183
|
-
href="mailto:funit-registration@rubyforge.org?subject=fUnit%20Registration">funit-registration@rubyforge.org</a>
|
183
|
+
href="mailto:funit-registration@rubyforge.org?subject=fUnit%20Registration&body=%20%20%20%20%20%20%20Name:%20%0AInstitution:%20%0A%20%20%20%20%20%20%20City:%20%0APostal%20Code:%20%0A%20%20%20%20Country:%20">funit-registration@rubyforge.org</a>
|
184
184
|
with your name, institution (if applicable), city, postal code, and
|
185
185
|
country. See <a
|
186
186
|
href="http://funit.rubyforge.org/files/COPYING.html">COPYING</a> for
|
@@ -213,9 +213,6 @@ framework in <a href="http:www.ruby-lang.org">Ruby</a>.
|
|
213
213
|
</li>
|
214
214
|
<li>Complete migration from CamelCase to snake_case for methods and variables.
|
215
215
|
|
216
|
-
</li>
|
217
|
-
<li>Use 2-space indentation everywhere.
|
218
|
-
|
219
216
|
</li>
|
220
217
|
<li>Use ‘test’ keyword instead of ‘beginTest’ business.
|
221
218
|
|
@@ -229,9 +226,6 @@ framework in <a href="http:www.ruby-lang.org">Ruby</a>.
|
|
229
226
|
</li>
|
230
227
|
<li>Add assertions to capture stops and warning messages.
|
231
228
|
|
232
|
-
</li>
|
233
|
-
<li>Clean up documentation.
|
234
|
-
|
235
229
|
</li>
|
236
230
|
<li>To increase portability, create a single, stand-alone executable with Erik
|
237
231
|
Veenstra’s <a
|
@@ -240,9 +234,6 @@ href="http://www.erikveen.dds.nl/rubyscript2exe/">RubyScript2Exe</a>.
|
|
240
234
|
</li>
|
241
235
|
<li>Use a makefile instead of a single, ordered command line for compilation.
|
242
236
|
|
243
|
-
</li>
|
244
|
-
<li>Add a clean option to remove all generated artifacts.
|
245
|
-
|
246
237
|
</li>
|
247
238
|
</ul>
|
248
239
|
|
@@ -56,7 +56,7 @@
|
|
56
56
|
</tr>
|
57
57
|
<tr class="top-aligned-row">
|
58
58
|
<td><strong>Last Update:</strong></td>
|
59
|
-
<td>
|
59
|
+
<td>Mon Apr 17 19:41:43 EDT 2006</td>
|
60
60
|
</tr>
|
61
61
|
</table>
|
62
62
|
</div>
|
@@ -75,6 +75,13 @@ Define Fortran assertion macros
|
|
75
75
|
|
76
76
|
</div>
|
77
77
|
|
78
|
+
<div id="requires-list">
|
79
|
+
<h3 class="section-bar">Required files</h3>
|
80
|
+
|
81
|
+
<div class="name-list">
|
82
|
+
strscan
|
83
|
+
</div>
|
84
|
+
</div>
|
78
85
|
|
79
86
|
</div>
|
80
87
|
|
@@ -25,6 +25,7 @@
|
|
25
25
|
<a href="classes/Funit/Compiler.html">Funit::Compiler</a><br />
|
26
26
|
<a href="classes/Funit/Depend.html">Funit::Depend</a><br />
|
27
27
|
<a href="classes/Funit/TestSuite.html">Funit::TestSuite</a><br />
|
28
|
+
<a href="classes/String.html">String</a><br />
|
28
29
|
</div>
|
29
30
|
</div>
|
30
31
|
</body>
|
@@ -20,39 +20,40 @@
|
|
20
20
|
<div id="index">
|
21
21
|
<h1 class="section-bar">Methods</h1>
|
22
22
|
<div id="index-entries">
|
23
|
-
<a href="classes/Funit/TestSuite.html#
|
24
|
-
<a href="classes/Funit/TestSuite.html#
|
25
|
-
<a href="classes/Funit/TestSuite.html#
|
26
|
-
<a href="classes/Funit/Depend.html#
|
27
|
-
<a href="classes/Funit/Depend.html#
|
28
|
-
<a href="classes/Funit/TestSuite.html#
|
29
|
-
<a href="classes/Funit.html#
|
30
|
-
<a href="classes/Funit/Depend.html#
|
31
|
-
<a href="classes/Funit/TestSuite.html#
|
32
|
-
<a href="classes/Funit/Depend.html#
|
33
|
-
<a href="classes/Funit.html#
|
34
|
-
<a href="classes/
|
35
|
-
<a href="classes/Funit/
|
36
|
-
<a href="classes/Funit/Assertions.html#
|
37
|
-
<a href="classes/Funit/Assertions.html#
|
38
|
-
<a href="classes/Funit/Assertions.html#M000011">
|
39
|
-
<a href="classes/Funit/Assertions.html#
|
40
|
-
<a href="classes/Funit/
|
41
|
-
<a href="classes/Funit/Depend.html#
|
42
|
-
<a href="classes/Funit/Depend.html#
|
43
|
-
<a href="classes/Funit/Depend.html#
|
44
|
-
<a href="classes/Funit/
|
45
|
-
<a href="classes/Funit/
|
46
|
-
<a href="classes/Funit.html#
|
47
|
-
<a href="classes/Funit.html#
|
48
|
-
<a href="classes/Funit
|
49
|
-
<a href="classes/Funit.html#
|
50
|
-
<a href="classes/Funit
|
51
|
-
<a href="classes/Funit.html#
|
52
|
-
<a href="classes/Funit
|
53
|
-
<a href="classes/Funit.html#
|
54
|
-
<a href="classes/Funit
|
55
|
-
<a href="classes/Funit.html#
|
23
|
+
<a href="classes/Funit/TestSuite.html#M000033">aTest (Funit::TestSuite)</a><br />
|
24
|
+
<a href="classes/Funit/TestSuite.html#M000030">addtoSetup (Funit::TestSuite)</a><br />
|
25
|
+
<a href="classes/Funit/TestSuite.html#M000031">addtoTeardown (Funit::TestSuite)</a><br />
|
26
|
+
<a href="classes/Funit/Depend.html#M000019">build_dictionary_of_modules_in (Funit::Depend)</a><br />
|
27
|
+
<a href="classes/Funit/Depend.html#M000021">build_hash_of_modules_in_files_within (Funit::Depend)</a><br />
|
28
|
+
<a href="classes/Funit/TestSuite.html#M000034">close (Funit::TestSuite)</a><br />
|
29
|
+
<a href="classes/Funit.html#M000009">compileTests (Funit)</a><br />
|
30
|
+
<a href="classes/Funit/Depend.html#M000023">dependencies (Funit::Depend)</a><br />
|
31
|
+
<a href="classes/Funit/TestSuite.html#M000029">expand (Funit::TestSuite)</a><br />
|
32
|
+
<a href="classes/Funit/Depend.html#M000020">fortran_files_within (Funit::Depend)</a><br />
|
33
|
+
<a href="classes/Funit.html#M000004">funit_exists? (Funit)</a><br />
|
34
|
+
<a href="classes/String.html#M000001">get_args (String)</a><br />
|
35
|
+
<a href="classes/Funit/TestSuite.html#M000032">ignoreTest (Funit::TestSuite)</a><br />
|
36
|
+
<a href="classes/Funit/Assertions.html#M000014">isequal (Funit::Assertions)</a><br />
|
37
|
+
<a href="classes/Funit/Assertions.html#M000013">isequalwithin (Funit::Assertions)</a><br />
|
38
|
+
<a href="classes/Funit/Assertions.html#M000011">isfalse (Funit::Assertions)</a><br />
|
39
|
+
<a href="classes/Funit/Assertions.html#M000012">isrealequal (Funit::Assertions)</a><br />
|
40
|
+
<a href="classes/Funit/Assertions.html#M000010">istrue (Funit::Assertions)</a><br />
|
41
|
+
<a href="classes/Funit/Depend.html#M000022">makefile_dependency_line (Funit::Depend)</a><br />
|
42
|
+
<a href="classes/Funit/Depend.html#M000018">modules_defined_in (Funit::Depend)</a><br />
|
43
|
+
<a href="classes/Funit/Depend.html#M000017">modules_used_in (Funit::Depend)</a><br />
|
44
|
+
<a href="classes/Funit/TestSuite.html#M000027">new (Funit::TestSuite)</a><br />
|
45
|
+
<a href="classes/Funit/Compiler.html#M000026">new (Funit::Compiler)</a><br />
|
46
|
+
<a href="classes/Funit/Depend.html#M000016">new (Funit::Depend)</a><br />
|
47
|
+
<a href="classes/Funit.html#M000005">parseCommandLine (Funit)</a><br />
|
48
|
+
<a href="classes/Funit.html#M000003">requestedModules (Funit)</a><br />
|
49
|
+
<a href="classes/Funit/Depend.html#M000025">required_source_files (Funit::Depend)</a><br />
|
50
|
+
<a href="classes/Funit.html#M000002">run_tests (Funit)</a><br />
|
51
|
+
<a href="classes/Funit/Depend.html#M000024">source_file_dependencies (Funit::Depend)</a><br />
|
52
|
+
<a href="classes/Funit.html#M000007">syntaxError (Funit)</a><br />
|
53
|
+
<a href="classes/Funit/TestSuite.html#M000028">topWrapper (Funit::TestSuite)</a><br />
|
54
|
+
<a href="classes/Funit.html#M000008">warning (Funit)</a><br />
|
55
|
+
<a href="classes/Funit/Assertions.html#M000015">writeAssert (Funit::Assertions)</a><br />
|
56
|
+
<a href="classes/Funit.html#M000006">writeTestRunner (Funit)</a><br />
|
56
57
|
</div>
|
57
58
|
</div>
|
58
59
|
</body>
|
data/lib/funit/assertions.rb
CHANGED
@@ -8,49 +8,79 @@
|
|
8
8
|
# This file is governed by the NASA Open Source Agreement.
|
9
9
|
# See COPYING for details.
|
10
10
|
#++
|
11
|
+
require 'strscan'
|
12
|
+
|
13
|
+
# Thanks to James Edward Gray II by way of ruby-talk mailing list
|
14
|
+
|
15
|
+
class String
|
16
|
+
def get_args
|
17
|
+
scanner = StringScanner.new(self)
|
18
|
+
result = scanner.eos? ? Array.new : [""]
|
19
|
+
paren_depth = 0
|
20
|
+
until scanner.eos?
|
21
|
+
if scanner.scan(/[^(),]+/)
|
22
|
+
# do nothing--we found the part of the argument we need to add
|
23
|
+
elsif scanner.scan(/\(/)
|
24
|
+
paren_depth += 1
|
25
|
+
elsif scanner.scan(/\)/)
|
26
|
+
paren_depth -= 1
|
27
|
+
elsif scanner.scan(/,\s*/) and paren_depth.zero?
|
28
|
+
result << ""
|
29
|
+
next
|
30
|
+
end
|
31
|
+
|
32
|
+
result.last << scanner.matched
|
33
|
+
end
|
34
|
+
|
35
|
+
result
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
11
39
|
module Funit
|
12
40
|
module Assertions
|
13
41
|
|
14
42
|
$assertRegEx = /Is(RealEqual|False|True|EqualWithin|Equal)\(.*\)/i
|
15
43
|
|
16
44
|
def istrue(line)
|
17
|
-
line
|
45
|
+
line.match(/\((.+)\)/)
|
18
46
|
@type = 'IsTrue'
|
19
47
|
@condition = ".not.(#$1)"
|
20
48
|
@message = "\"#$1 is not true\""
|
21
49
|
syntaxError("invalid body for #@type",@suiteName) unless $1=~/\S+/
|
22
|
-
|
50
|
+
writeAssert
|
23
51
|
end
|
24
52
|
|
25
53
|
def isfalse(line)
|
26
|
-
line
|
54
|
+
line.match(/\((.+)\)/)
|
27
55
|
@type = 'IsFalse'
|
28
56
|
@condition = "#$1"
|
29
57
|
@message = "\"#$1 is not false\""
|
30
58
|
syntaxError("invalid body for #@type",@suiteName) unless $1=~/\S+/
|
31
|
-
|
59
|
+
writeAssert
|
32
60
|
end
|
33
61
|
|
34
62
|
def isrealequal(line)
|
35
|
-
line
|
63
|
+
line.match(/\((.*)\)/)
|
64
|
+
expected, actual = *($1.get_args)
|
36
65
|
@type = 'IsRealEqual'
|
37
|
-
@condition = ".not.(
|
38
|
-
@message = "\"
|
66
|
+
@condition = ".not.(#{expected}+2*spacing(real(#{expected})).ge.#{actual} &\n .and.#{expected}-2*spacing(real(#{expected})).le.#{actual})"
|
67
|
+
@message = "\"#{actual} (\",#{actual},\") is not\",#{expected},\"within\",2*spacing(real(#{expected}))"
|
39
68
|
syntaxError("invalid body for #@type",@suiteName) unless $&
|
40
69
|
writeAssert
|
41
70
|
end
|
42
71
|
|
43
72
|
def isequalwithin(line)
|
44
|
-
line
|
73
|
+
line.match(/\((.*)\)/)
|
74
|
+
expected, actual, tolerance = *($1.get_args)
|
45
75
|
@type = 'IsEqualWithin'
|
46
|
-
@condition = ".not.(
|
47
|
-
@message = "\"
|
76
|
+
@condition = ".not.(#{actual}+#{tolerance}.ge.#{expected} &\n .and.#{actual}-#{tolerance}.le.#{expected})"
|
77
|
+
@message = "\"#{expected} (\",#{expected},\") is not\",#{actual},\"within\",#{tolerance}"
|
48
78
|
syntaxError("invalid body for #@type",@suiteName) unless $&
|
49
79
|
writeAssert
|
50
80
|
end
|
51
81
|
|
52
82
|
def isequal(line)
|
53
|
-
line
|
83
|
+
line.match(/\((\w+\(.*\)|[^,]+),(.+)\)/)
|
54
84
|
@type = 'IsEqual'
|
55
85
|
@condition = ".not.(#$1==#$2)"
|
56
86
|
@message = "\"#$1 (\",#$1,\") is not\", #$2"
|
@@ -60,13 +90,12 @@ module Funit
|
|
60
90
|
|
61
91
|
def writeAssert
|
62
92
|
<<-OUTPUT
|
63
|
-
|
64
93
|
! #@type assertion
|
65
94
|
numAsserts = numAsserts + 1
|
66
95
|
if (noAssertFailed) then
|
67
96
|
if (#@condition) then
|
68
97
|
print *, " *#@type failed* in test #@testName &
|
69
|
-
|
98
|
+
&[#{@suiteName}.fun:#{@lineNumber.to_s}]"
|
70
99
|
print *, " ", #@message
|
71
100
|
print *, ""
|
72
101
|
noAssertFailed = .false.
|
data/tests/tc_compile.rb
CHANGED
@@ -7,27 +7,27 @@ require 'funit/functions'
|
|
7
7
|
|
8
8
|
class TestCompiler < Test::Unit::TestCase
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
10
|
+
def setup
|
11
|
+
@compilerStub = 'dummyCompiler'
|
12
|
+
@oldCompilerName = ENV['FC']
|
13
|
+
end
|
14
|
+
|
15
|
+
def teardown
|
16
|
+
ENV['FC'] = @oldCompilerName
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_explicit_compiler_name
|
20
|
+
assert_equal @compilerStub, Funit::Compiler.new(@compilerStub).name
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_compiler_name_from_environment
|
24
|
+
ENV['FC'] = @compilerStub
|
25
|
+
assert_equal @compilerStub, Funit::Compiler.new.name
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_no_environment_compiler_name
|
29
|
+
ENV['FC'] = nil
|
30
|
+
assert_raises(RuntimeError) {Funit::Compiler.new}
|
31
|
+
end
|
32
32
|
|
33
33
|
end
|