funit 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,10 @@
1
+ === 0.1.3 / 2006-06-21
2
+
3
+ * 1 bug fix
4
+ * Do not remove unit tests! (Thanks to Sebastian Hanigk and James Quirk.)
5
+
6
+ === 0.1.2 / 2006-05-16
7
+
8
+ * 1 major enhancement
9
+ * 1st public release!
10
+
@@ -0,0 +1,263 @@
1
+ == License
2
+
3
+ NASA OPEN SOURCE AGREEMENT VERSION 1.3
4
+
5
+ THIS OPEN SOURCE AGREEMENT ("AGREEMENT") DEFINES THE RIGHTS OF USE,
6
+ REPRODUCTION, DISTRIBUTION, MODIFICATION AND REDISTRIBUTION OF CERTAIN
7
+ COMPUTER SOFTWARE ORIGINALLY RELEASED BY THE UNITED STATES GOVERNMENT
8
+ AS REPRESENTED BY THE GOVERNMENT AGENCY LISTED BELOW ("GOVERNMENT
9
+ AGENCY"). THE UNITED STATES GOVERNMENT, AS REPRESENTED BY GOVERNMENT
10
+ AGENCY, IS AN INTENDED THIRD-PARTY BENEFICIARY OF ALL SUBSEQUENT
11
+ DISTRIBUTIONS OR REDISTRIBUTIONS OF THE SUBJECT SOFTWARE. ANYONE WHO
12
+ USES, REPRODUCES, DISTRIBUTES, MODIFIES OR REDISTRIBUTES THE SUBJECT
13
+ SOFTWARE, AS DEFINED HEREIN, OR ANY PART THEREOF, IS, BY THAT ACTION,
14
+ ACCEPTING IN FULL THE RESPONSIBILITIES AND OBLIGATIONS CONTAINED IN
15
+ THIS AGREEMENT.
16
+
17
+ Government Agency: NASA Langley Research Center
18
+ Government Agency Original Software Designation: LAR-17081-1
19
+ Government Agency Original Software Title: fUnit
20
+ User Registration Requested: please see clause 3.F.
21
+ Government Agency Point of Contact: funit-support@rubyforge.org
22
+
23
+ 1. DEFINITIONS
24
+
25
+ A. "Contributor" means Government Agency, as the developer of the
26
+ Original Software, and any entity that makes a Modification.
27
+
28
+ B. "Covered Patents" mean patent claims licensable by a Contributor
29
+ that are necessarily infringed by the use or sale of its Modification
30
+ alone or when combined with the Subject Software.
31
+
32
+ C. "Display" means the showing of a copy of the Subject Software,
33
+ either directly or by means of an image, or any other device.
34
+
35
+ D. "Distribution" means conveyance or transfer of the Subject
36
+ Software, regardless of means, to another.
37
+
38
+ E. "Larger Work" means computer software that combines Subject
39
+ Software, or portions thereof, with software separate from the Subject
40
+ Software that is not governed by the terms of this Agreement.
41
+
42
+ F. "Modification" means any alteration of, including addition to or
43
+ deletion from, the substance or structure of either the Original
44
+ Software or Subject Software, and includes derivative works, as that
45
+ term is defined in the Copyright Statute, 17 USC 101. However, the
46
+ act of including Subject Software as part of a Larger Work does not in
47
+ and of itself constitute a Modification.
48
+
49
+ G. "Original Software" means the computer software first released
50
+ under this Agreement by Government Agency with Government Agency
51
+ designation NASA and entitled fUnit, including source code,
52
+ object code and accompanying documentation, if any.
53
+
54
+ H. "Recipient" means anyone who acquires the Subject Software under
55
+ this Agreement, including all Contributors.
56
+
57
+ I. "Redistribution" means Distribution of the Subject Software after a
58
+ Modification has been made.
59
+
60
+ J. "Reproduction" means the making of a counterpart, image or copy of
61
+ the Subject Software.
62
+
63
+ K. "Sale" means the exchange of the Subject Software for money or
64
+ equivalent value.
65
+
66
+ L. "Subject Software" means the Original Software, Modifications, or
67
+ any respective parts thereof.
68
+
69
+ M. "Use" means the application or employment of the Subject Software
70
+ for any purpose.
71
+
72
+ 2. GRANT OF RIGHTS
73
+
74
+ A. Under Non-Patent Rights: Subject to the terms and conditions of
75
+ this Agreement, each Contributor, with respect to its own contribution
76
+ to the Subject Software, hereby grants to each Recipient a
77
+ non-exclusive, world-wide, royalty-free license to engage in the
78
+ following activities pertaining to the Subject Software:
79
+
80
+ 1. Use
81
+ 2. Distribution
82
+ 3. Reproduction
83
+ 4. Modification
84
+ 5. Redistribution
85
+ 6. Display
86
+
87
+ B. Under Patent Rights: Subject to the terms and conditions of this
88
+ Agreement, each Contributor, with respect to its own contribution to
89
+ the Subject Software, hereby grants to each Recipient under Covered
90
+ Patents a non-exclusive, world-wide, royalty-free license to engage in
91
+ the following activities pertaining to the Subject Software:
92
+
93
+ 1. Use
94
+ 2. Distribution
95
+ 3. Reproduction
96
+ 4. Sale
97
+ 5. Offer for Sale
98
+
99
+ C. The rights granted under Paragraph B. also apply to the combination
100
+ of a Contributor's Modification and the Subject Software if, at the
101
+ time the Modification is added by the Contributor, the addition of
102
+ such Modification causes the combination to be covered by the Covered
103
+ Patents. It does not apply to any other combinations that include a
104
+ Modification.
105
+
106
+ D. The rights granted in Paragraphs A. and B. allow the Recipient to
107
+ sublicense those same rights. Such sublicense must be under the same
108
+ terms and conditions of this Agreement.
109
+
110
+ 3. OBLIGATIONS OF RECIPIENT
111
+
112
+ A. Distribution or Redistribution of the Subject Software must be made
113
+ under this Agreement except for additions covered under paragraph 3H.
114
+
115
+ 1. Whenever a Recipient distributes or redistributes the Subject
116
+ Software, a copy of this Agreement must be included with each copy
117
+ of the Subject Software; and
118
+
119
+ 2. If Recipient distributes or redistributes the Subject Software in
120
+ any form other than source code, Recipient must also make the
121
+ source code freely available, and must provide with each copy of
122
+ the Subject Software information on how to obtain the source code
123
+ in a reasonable manner on or through a medium customarily used for
124
+ software exchange.
125
+
126
+ B. Each Recipient must ensure that the following copyright notice
127
+ appears prominently in the Subject Software:
128
+
129
+ Copyright 2006-2007 United States Government as represented by
130
+ NASA Langley Research Center. No copyright is claimed in
131
+ the United States under Title 17, U.S. Code. All Other Rights
132
+ Reserved.
133
+
134
+ C. Each Contributor must characterize its alteration of the Subject
135
+ Software as a Modification and must identify itself as the originator
136
+ of its Modification in a manner that reasonably allows subsequent
137
+ Recipients to identify the originator of the Modification. In
138
+ fulfillment of these requirements, Contributor must include a file
139
+ (e.g., a change log file) that describes the alterations made and the
140
+ date of the alterations, identifies Contributor as originator of the
141
+ alterations, and consents to characterization of the alterations as a
142
+ Modification, for example, by including a statement that the
143
+ Modification is derived, directly or indirectly, from Original
144
+ Software provided by Government Agency. Once consent is granted, it
145
+ may not thereafter be revoked.
146
+
147
+ D. A Contributor may add its own copyright notice to the Subject
148
+ Software. Once a copyright notice has been added to the Subject
149
+ Software, a Recipient may not remove it without the express permission
150
+ of the Contributor who added the notice.
151
+
152
+ E. A Recipient may not make any representation in the Subject Software
153
+ or in any promotional, advertising or other material that may be
154
+ construed as an endorsement by Government Agency or by any prior
155
+ Recipient of any product or service provided by Recipient, or that may
156
+ seek to obtain commercial advantage by the fact of Government Agency's
157
+ or a prior Recipient's participation in this Agreement.
158
+
159
+ F. In an effort to track usage and maintain accurate records of the
160
+ Subject Software, each Recipient, upon receipt of the Subject Software,
161
+ is requested to provide Government Agency, by e-mail to the Government
162
+ Agency Point of Contact listed in clause 5.F., the following information:
163
+ name, institution (if applicable), postal code, and country.
164
+ Recipient's name and personal information shall be used for statistical
165
+ purposes only. Once a Recipient makes a Modification available, it is
166
+ requested that the Recipient inform Government Agency, by e-mail to the
167
+ Government Agency Point of Contact listed in clause 5.F., how to
168
+ access the Modification.
169
+
170
+ G. Each Contributor represents that that its Modification is believed
171
+ to be Contributor's original creation and does not violate any
172
+ existing agreements, regulations, statutes or rules, and further that
173
+ Contributor has sufficient rights to grant the rights conveyed by this
174
+ Agreement.
175
+
176
+ H. A Recipient may choose to offer, and to charge a fee for, warranty,
177
+ support, indemnity and/or liability obligations to one or more other
178
+ Recipients of the Subject Software. A Recipient may do so, however,
179
+ only on its own behalf and not on behalf of Government Agency or any
180
+ other Recipient. Such a Recipient must make it absolutely clear that
181
+ any such warranty, support, indemnity and/or liability obligation is
182
+ offered by that Recipient alone. Further, such Recipient agrees to
183
+ indemnify Government Agency and every other Recipient for any
184
+ liability incurred by them as a result of warranty, support, indemnity
185
+ and/or liability offered by such Recipient.
186
+
187
+ I. A Recipient may create a Larger Work by combining Subject Software
188
+ with separate software not governed by the terms of this agreement and
189
+ distribute the Larger Work as a single product. In such case, the
190
+ Recipient must make sure Subject Software, or portions thereof,
191
+ included in the Larger Work is subject to this Agreement.
192
+
193
+ J. Notwithstanding any provisions contained herein, Recipient is
194
+ hereby put on notice that export of any goods or technical data from
195
+ the United States may require some form of export license from the
196
+ U.S. Government. Failure to obtain necessary export licenses may
197
+ result in criminal liability under U.S. laws. Government Agency
198
+ neither represents that a license shall not be required nor that, if
199
+ required, it shall be issued. Nothing granted herein provides any
200
+ such export license.
201
+
202
+ 4. DISCLAIMER OF WARRANTIES AND LIABILITIES; WAIVER AND INDEMNIFICATION
203
+
204
+ A. No Warranty: THE SUBJECT SOFTWARE IS PROVIDED "AS IS" WITHOUT ANY
205
+ WARRANTY OF ANY KIND, EITHER EXPRESSED, IMPLIED, OR STATUTORY,
206
+ INCLUDING, BUT NOT LIMITED TO, ANY WARRANTY THAT THE SUBJECT SOFTWARE
207
+ WILL CONFORM TO SPECIFICATIONS, ANY IMPLIED WARRANTIES OF
208
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR FREEDOM FROM
209
+ INFRINGEMENT, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL BE ERROR
210
+ FREE, OR ANY WARRANTY THAT DOCUMENTATION, IF PROVIDED, WILL CONFORM TO
211
+ THE SUBJECT SOFTWARE. THIS AGREEMENT DOES NOT, IN ANY MANNER,
212
+ CONSTITUTE AN ENDORSEMENT BY GOVERNMENT AGENCY OR ANY PRIOR RECIPIENT
213
+ OF ANY RESULTS, RESULTING DESIGNS, HARDWARE, SOFTWARE PRODUCTS OR ANY
214
+ OTHER APPLICATIONS RESULTING FROM USE OF THE SUBJECT SOFTWARE.
215
+ FURTHER, GOVERNMENT AGENCY DISCLAIMS ALL WARRANTIES AND LIABILITIES
216
+ REGARDING THIRD-PARTY SOFTWARE, IF PRESENT IN THE ORIGINAL SOFTWARE,
217
+ AND DISTRIBUTES IT "AS IS."
218
+
219
+ B. Waiver and Indemnity: RECIPIENT AGREES TO WAIVE ANY AND ALL CLAIMS
220
+ AGAINST THE UNITED STATES GOVERNMENT, ITS CONTRACTORS AND
221
+ SUBCONTRACTORS, AS WELL AS ANY PRIOR RECIPIENT. IF RECIPIENT'S USE OF
222
+ THE SUBJECT SOFTWARE RESULTS IN ANY LIABILITIES, DEMANDS, DAMAGES,
223
+ EXPENSES OR LOSSES ARISING FROM SUCH USE, INCLUDING ANY DAMAGES FROM
224
+ PRODUCTS BASED ON, OR RESULTING FROM, RECIPIENT'S USE OF THE SUBJECT
225
+ SOFTWARE, RECIPIENT SHALL INDEMNIFY AND HOLD HARMLESS THE UNITED
226
+ STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY
227
+ PRIOR RECIPIENT, TO THE EXTENT PERMITTED BY LAW. RECIPIENT'S SOLE
228
+ REMEDY FOR ANY SUCH MATTER SHALL BE THE IMMEDIATE, UNILATERAL
229
+ TERMINATION OF THIS AGREEMENT.
230
+
231
+ 5. GENERAL TERMS
232
+
233
+ A. Termination: This Agreement and the rights granted hereunder will
234
+ terminate automatically if a Recipient fails to comply with these
235
+ terms and conditions, and fails to cure such noncompliance within
236
+ thirty (30) days of becoming aware of such noncompliance. Upon
237
+ termination, a Recipient agrees to immediately cease use and
238
+ distribution of the Subject Software. All sublicenses to the Subject
239
+ Software properly granted by the breaching Recipient shall survive any
240
+ such termination of this Agreement.
241
+
242
+ B. Severability: If any provision of this Agreement is invalid or
243
+ unenforceable under applicable law, it shall not affect the validity
244
+ or enforceability of the remainder of the terms of this Agreement.
245
+
246
+ C. Applicable Law: This Agreement shall be subject to United States
247
+ federal law only for all purposes, including, but not limited to,
248
+ determining the validity of this Agreement, the meaning of its
249
+ provisions and the rights, obligations and remedies of the parties.
250
+
251
+ D. Entire Understanding: This Agreement constitutes the entire
252
+ understanding and agreement of the parties relating to release of the
253
+ Subject Software and may not be superseded, modified or amended except
254
+ by further written agreement duly executed by the parties.
255
+
256
+ E. Binding Authority: By accepting and using the Subject Software
257
+ under this Agreement, a Recipient affirms its authority to bind the
258
+ Recipient to all terms and conditions of this Agreement and that that
259
+ Recipient hereby agrees to all terms and conditions herein.
260
+
261
+ F. Point of Contact: Any Recipient contact with Government Agency is
262
+ to be directed to the designated representative as follows:
263
+ funit-support@rubyforge.org.
@@ -0,0 +1,25 @@
1
+ History.txt
2
+ License.txt
3
+ Manifest.txt
4
+ README.txt
5
+ Rakefile
6
+ bin/funit
7
+ examples/CFD/FluxFunctions.f90
8
+ examples/CFD/FluxFunctions.fun
9
+ examples/CFD/Gammas.f90
10
+ examples/CFD/GasModel.f90
11
+ examples/CFD/GasModel.fun
12
+ examples/ReadData/time_series_data.f90
13
+ examples/ReadData/time_series_data.fun
14
+ examples/StopWatch/StopWatch.f90
15
+ examples/StopWatch/StopWatch.fun
16
+ lib/funit.rb
17
+ lib/funit/assertions.rb
18
+ lib/funit/compiler.rb
19
+ lib/funit/functions.rb
20
+ lib/funit/testsuite.rb
21
+ test/test_compiler.rb
22
+ test/test_functions.rb
23
+ test/test_funit.rb
24
+ test/test_testsuite.rb
25
+ utils/funit-mode.el
@@ -0,0 +1,124 @@
1
+ FUnit
2
+
3
+ * http://rubyforge.org/projects/funit
4
+ * http://funit.rubyforge.org
5
+ * mailto:funit-support@rubyforge.org
6
+
7
+ == DESCRIPTION:
8
+
9
+ FUnit is a unit testing framework for Fortran modules.
10
+
11
+ Unit tests are written as Fortran fragments that use a small
12
+ set of testing-specific keywords and functions. FUnit transforms
13
+ these fragments into valid Fortran code, compiles, links, and
14
+ runs them against the module under test.
15
+
16
+ FUnit is {opinionated software}[http://www.oreillynet.com/pub/a/network/2005/08/30/ruby-rails-david-heinemeier-hansson.html], which values convention over
17
+ configuration. Specifically, FUnit,
18
+
19
+ * requires a Fortran 95 compiler,
20
+ * only supports testing routines contained in modules,
21
+ * requires tests to be stored along side the code under test, and
22
+ * requires test files to be named appropriately.
23
+
24
+ == FEATURES/PROBLEMS:
25
+
26
+ * Enables the Scientific Method for software by making unit testing
27
+ Fortran fun and easy.
28
+ * Encourages cohesive, yet decoupled code paired with
29
+ <em>executable</em> documentation.
30
+
31
+ == SYNOPSIS:
32
+
33
+ Suppose <tt>gas_physics.f90</tt> has a routine that returns
34
+ viscosity as a function of temperature, e.g.,
35
+
36
+ module gas_physics
37
+ contains
38
+ function viscosity(temperature)
39
+ real :: viscosity, temperature
40
+ viscosity = 2.0e-3 * temperature**1.5
41
+ end function
42
+ end module
43
+
44
+ Tests of this module would be contained in <tt>gas_physics.fun</tt>,
45
+ dkfand might contain a test like,
46
+
47
+ beginTest viscosity_varies_as_temperature
48
+ IsRealEqual( 0.0, viscosity(0.0) )
49
+ IsEqualWithin( 0.7071, viscosity(50.0), 1e-3 )
50
+ endTest
51
+
52
+ This brief fragment is all you need. The framework provides the rest
53
+ of the trappings to turn this into valid Fortran code.
54
+
55
+ You would run this unit test with the command,
56
+
57
+ funit gas_physics
58
+
59
+ which would transform your fragments contained in <tt>gas_physics.fun</tt>
60
+ into valid Fortran code, create a test runner program, compile everything,
61
+ and run the tests, viz,
62
+
63
+ parsing gas_physics.fun
64
+ computing dependencies
65
+ locating associated source files and sorting for compilation
66
+ g95 -o TestRunner
67
+ gas_physics.f90 \
68
+ gas_physics_fun.f90 \
69
+ TestRunner.f90
70
+
71
+ gas_physics test suite:
72
+ Passed 2 of 2 possible asserts comprising 1 of 1 tests.
73
+
74
+ This and other examples come with the FUnit distribution in the
75
+ <tt>examples</tt> directory. There is also an emacs mode in
76
+ the <tt>utils</tt> directory. If you installed the FUnit via Rubygems,
77
+ these directories can be found in your Rubygems library directory, e.g., <tt>/usr/local/lib/ruby/gems</tt>.
78
+
79
+ == REQUIREMENTS:
80
+
81
+ * Fortran 90/95/2003 compiler
82
+ * Ruby with Rubygems
83
+ * fortran Ruby Gem
84
+
85
+ == INSTALL:
86
+
87
+ * <tt>sudo gem install funit</tt>
88
+ * Set FC environment variable to point to a Fortran compiler:
89
+ * <tt>export FC=/path/of/Fortran/compiler</tt> (sh)
90
+ * <tt>setenv FC /path/of/Fortran/compiler</tt> (csh)
91
+
92
+ == LICENSE:
93
+
94
+ FUnit is released under the NASA Open Source Agreement -- see License.txt[link:files/License_txt.html] for details.
95
+
96
+ == ORIGIN:
97
+
98
+ On October 4, 2001, Mike Hill (then of {Object Mentor}[http://www.objectmentor.com/],
99
+ now of {Industrial Logic}[http://www.industriallogic.com]) visited {NASA Langley Research Center}[http://www.larc.nasa.gov]
100
+ in Hampton, Virginia and gave a test-first design talk at
101
+ the {Institute for Computer and Applied Sciences and Engineering (ICASE)}[http://www.icase.edu].
102
+ Copies of his slides are available at {icase.edu/series/MPP}[http://www.icase.edu/series/MPP/].
103
+
104
+ Mike spent the afternoon with Bil Kleb, Bill Wood, Karen Bibb, and
105
+ Mike Park reasoning out how we might create a testing framework
106
+ for Fortran 90 to use during FUN3D[http://fun3d.larc.nasa.gov] code development.
107
+ By the end of the afternoon we had a working prototype based
108
+ on the macro expansion techniques employed in Mike Hill's cpptestkit[http://sourceforge.net/projects/cpptestkit].
109
+ We quickly found C-preprocessor macros to be too restrictive and
110
+ rewrote the framework in Ruby[http://www.ruby-lang.org].
111
+
112
+ == TODO:
113
+
114
+ * Rename assertions to more consistent with other xUnits.
115
+ * Use <tt>test</tt> keyword instead of <tt>beginTest</tt> business.
116
+ * To avoid Fortran's 32-character limit, don't add test name during translation.
117
+ * Add some command line options (especially <tt>clean</tt>), possibly
118
+ using CmdParse[http://cmdparse.rubyforge.org].
119
+ * Add assertions that capture stops, warning messages, and other exits.
120
+ * For compilation, use internal rake task instead of a single, ordered command line.
121
+ * Allow users to specify dependency search paths (currently hardwired).
122
+ * To increase portability, create stand-alone executables with Erik Veenstra's
123
+ RubyScript2Exe[http://www.erikveen.dds.nl/rubyscript2exe/].
124
+ * Make FUnit self-tests fail gracefully if Fortran compiler is not found.
@@ -0,0 +1,21 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'rubygems'
4
+ require 'hoe'
5
+
6
+ $:.unshift File.join( File.dirname(__FILE__), 'lib' )
7
+ require 'funit'
8
+
9
+ Hoe.new('funit', Funit::VERSION) do |p|
10
+ p.rubyforge_name = 'nasarb'
11
+ p.extra_deps << [ 'fortran', '>= 1.0.0' ]
12
+ p.author = ['Karen Bibb','Bil Kleb','Beth Lee-Rausch','Mike Park','Bill Wood']
13
+ p.email = 'funit-support@rubyforge.org'
14
+ p.summary = 'A Fortran unit testing framework.'
15
+ p.description = p.paragraphs_of('README.txt', 2..3).join("\n\n")
16
+ p.url = p.paragraphs_of('README.txt', 1).first.gsub(/^\* /, '').split(/\n/)
17
+ p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
18
+ p.remote_rdoc_dir = '' # release webpages to root (otherwise dropped in rubyforge_name subdir)
19
+ p.clean_globs.concat %w( **/*_fun.f90 examples/**/TestRunner* **/*.o **/*.mod **/*.MOD )
20
+ p.rsync_args << ' --exclude=statsvn/'
21
+ end
@@ -0,0 +1,22 @@
1
+ # Main fUnit routine
2
+
3
+ begin
4
+ require 'funit'
5
+ rescue LoadError
6
+ require 'rubygems'
7
+ require 'funit'
8
+ end
9
+
10
+ include Funit
11
+
12
+ Funit::run_tests
13
+
14
+ #--
15
+ # Copyright 2006-2007 United States Government as represented by
16
+ # NASA Langley Research Center. No copyright is claimed in
17
+ # the United States under Title 17, U.S. Code. All Other Rights
18
+ # Reserved.
19
+ #
20
+ # This file is governed by the NASA Open Source Agreement.
21
+ # See License.txt for details.
22
+ #++