funit 0.10.3 → 0.11.0
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/History.txt +30 -19
- data/Rakefile +1 -1
- data/lib/funit.rb +7 -2
- data/lib/funit/functions.rb +4 -4
- data/lib/funit/testsuite.rb +22 -5
- data/test/test_testsuite.rb +10 -10
- metadata +7 -23
data/History.txt
CHANGED
@@ -1,15 +1,26 @@
|
|
1
|
+
=== 0.11.0 / 2009-11-01
|
2
|
+
|
3
|
+
* 1 minor enhancement
|
4
|
+
* Allow testing of routines not contained in modules
|
5
|
+
|
6
|
+
=== 0.10.4 / 2009-10-15
|
7
|
+
|
8
|
+
* 2 minor enhancements
|
9
|
+
* Pass LDFLAGS environment variable to linker (Steve Turley)
|
10
|
+
* Formatted test summary line with i0 instead of *
|
11
|
+
|
1
12
|
=== 0.10.3 / 2009-10-05
|
2
13
|
|
3
14
|
* 1 minor enhancement
|
4
|
-
* Allow
|
15
|
+
* Allow <tt>--source</tt> to accept multiple directories
|
5
16
|
* 1 bug fix
|
6
|
-
* Make
|
17
|
+
* Make Funit's setup and teardown subroutine names unique to avoid
|
7
18
|
collision with same routine names in module under test.
|
8
19
|
|
9
20
|
=== 0.10.2 / 2008-03-30
|
10
21
|
|
11
22
|
* 2 bug fixes
|
12
|
-
* Updated README with proper syntax
|
23
|
+
* Updated <tt>README.txt</tt> with proper syntax
|
13
24
|
* Corrected prior release history copy and version number
|
14
25
|
|
15
26
|
=== 0.10.1 / 2008-03-30
|
@@ -18,40 +29,41 @@
|
|
18
29
|
* Non-passing tests exit with non-zero exit code
|
19
30
|
|
20
31
|
* 1 minor enhancement
|
21
|
-
*
|
32
|
+
* Added <tt>--version</tt> / <tt>-V</tt> options
|
22
33
|
|
23
34
|
=== 0.10.0 / 2008-03-30 (all courtesy of Diego Virasoro)
|
24
35
|
|
25
36
|
* 4 major enhancements
|
26
|
-
* User can now use
|
37
|
+
* User can now use <tt>funit --clean</tt> to remove the generated files
|
27
38
|
* Source directory and test directory can be different: specify
|
28
|
-
source dir with
|
39
|
+
source dir with <tt>-s</tt>(or <tt>--source</tt> flag
|
29
40
|
* Only the minimum number of files that need recompilation are compiled
|
30
41
|
via makefile
|
31
|
-
* The
|
32
|
-
must be surrounded by
|
33
|
-
is the name of the module to be tested
|
42
|
+
* The <tt>.fun</tt> file name is not constrained anymore, but now each test suite
|
43
|
+
must be surrounded by <tt>test_suite name</tt> and <tt>end test_suite</tt>,
|
44
|
+
where <tt>name</tt> is the name of the module to be tested
|
34
45
|
* Multiple test suites can exist inside the same file
|
35
46
|
|
36
47
|
* 5 minor enhancements
|
37
|
-
* Change blocks nomenclature: beginTest -> test and
|
48
|
+
* Change blocks nomenclature: <tt>beginTest</tt> -> <tt>test</tt> and
|
49
|
+
<tt>endTest</tt> -> <tt>end test</tt>
|
38
50
|
(and similarly for setup and teardown)
|
39
|
-
* Change assertions nomenclature (eg. IsEqual -> assert_equal)
|
40
|
-
* Added one new assertion: assert_array_equal
|
51
|
+
* Change assertions nomenclature (eg. <tt>IsEqual</tt> -> <tt>assert_equal</tt>)
|
52
|
+
* Added one new assertion: <tt>assert_array_equal</tt>
|
41
53
|
* Added a summary of all the test suites results, printed at the end
|
42
54
|
* Minor code clean-up
|
43
55
|
|
44
56
|
=== 0.9.4 / 2008-01-08
|
45
57
|
|
46
58
|
* 2 minor enhancements
|
47
|
-
*
|
59
|
+
* Broke up more long conditionals with continuation
|
48
60
|
characters to avoid truncated lines
|
49
|
-
*
|
61
|
+
* Added shebang to main for rubygems 1.0
|
50
62
|
|
51
63
|
=== 0.9.3 / 2007-12-23
|
52
64
|
|
53
65
|
* 2 bug fixes
|
54
|
-
* README.txt
|
66
|
+
* Project URLs in <tt>README.txt</tt>
|
55
67
|
* Repaired a test broken by 0.9.2
|
56
68
|
|
57
69
|
=== 0.9.2 / 2007-09-21
|
@@ -63,19 +75,18 @@
|
|
63
75
|
=== 0.9.1 / 2007-08-20
|
64
76
|
|
65
77
|
* 1 minor enhancement
|
66
|
-
* Stripped
|
78
|
+
* Stripped <tt>./</tt> path prefixes and <tt>\</tt> continuations to
|
67
79
|
appease windoze
|
68
80
|
|
69
81
|
=== 0.9.0 / 2007-07-26
|
70
82
|
|
71
83
|
* 1 minor enhancement
|
72
|
-
* Extracted fortran dependency engine -- see fortran gem.
|
84
|
+
* Extracted fortran dependency engine -- see <tt>fortran</tt> gem.
|
73
85
|
|
74
86
|
=== 0.1.3 / 2006-06-21
|
75
87
|
|
76
88
|
* 1 bug fix
|
77
|
-
* Do not remove unit tests! (Thanks to Sebastian Hanigk
|
78
|
-
and James Quirk.)
|
89
|
+
* Do not remove unit tests! (Thanks to Sebastian Hanigk and James Quirk.)
|
79
90
|
|
80
91
|
=== 0.1.2 / 2006-05-16
|
81
92
|
|
data/Rakefile
CHANGED
@@ -10,7 +10,7 @@ require 'funit.rb'
|
|
10
10
|
Hoe.new('funit', Funit::VERSION) do |funit|
|
11
11
|
funit.rubyforge_name = 'nasarb'
|
12
12
|
funit.remote_rdoc_dir = 'funit'
|
13
|
-
funit.extra_deps << [ 'fortran', '>= 1.0
|
13
|
+
funit.extra_deps << [ 'fortran', '>= 1.1.0' ]
|
14
14
|
funit.spec_extras[:requirements] = "A Fortran compiler."
|
15
15
|
funit.author =
|
16
16
|
[ 'Karen Bibb', 'Bil Kleb', 'Beth Lee-Rausch', 'Mike Park', 'Bill Wood' ]
|
data/lib/funit.rb
CHANGED
@@ -14,7 +14,7 @@ require 'fileutils'
|
|
14
14
|
|
15
15
|
module Funit
|
16
16
|
|
17
|
-
VERSION = '0.
|
17
|
+
VERSION = '0.11.0'
|
18
18
|
|
19
19
|
##
|
20
20
|
# run all tests
|
@@ -27,8 +27,13 @@ module Funit
|
|
27
27
|
tf_content = IO.read(test_file+'.fun')
|
28
28
|
tf_content.scan(/test_suite\s+(\w+)(.*?)end\s+test_suite/m).each{|ts|
|
29
29
|
ts_name = $1
|
30
|
+
ts_content = $2
|
30
31
|
if((!File.exist?(ts_name+"_fun.f90")) || File.mtime(ts_name+"_fun.f90") < File.mtime(test_file+".fun")) then
|
31
|
-
|
32
|
+
if ( File.read(ts_name+'.f90').match(/\s*module\s+#{ts_name}/i) ) then
|
33
|
+
TestSuite.new(ts_name, ts_content, false)
|
34
|
+
else
|
35
|
+
TestSuite.new(ts_name, ts_content, true)
|
36
|
+
end
|
32
37
|
end
|
33
38
|
test_suites.push(ts_name)
|
34
39
|
}
|
data/lib/funit/functions.rb
CHANGED
@@ -22,9 +22,9 @@ module Funit
|
|
22
22
|
write(*,*) "<%= test_suite %> test suite:"
|
23
23
|
call test_<%= test_suite %> &
|
24
24
|
( numTests(<%= i+1 %>), numAsserts(<%= i+1 %>), numAssertsTested(<%= i+1 %>), numFailures(<%= i+1 %>) )
|
25
|
-
write(
|
26
|
-
|
27
|
-
|
25
|
+
write(*,1) numAssertsTested(<%= i+1 %>), numAsserts(<%= i+1 %>), &
|
26
|
+
numTests(<%= i+1 %>)-numFailures(<%= i+1 %>), numTests(<%= i+1 %>)
|
27
|
+
1 format('Passed ',i0,' of ',i0,' possible asserts comprising ',i0,' of ',i0,' tests.')
|
28
28
|
<% end -%>
|
29
29
|
|
30
30
|
write(*,*)
|
@@ -55,7 +55,7 @@ module Funit
|
|
55
55
|
all:testrunner
|
56
56
|
|
57
57
|
testrunner: $(OBJ)
|
58
|
-
<%= "\t#{ENV['FC']} #{ENV['FCFLAGS']}" %> -o TestRunner $(OBJ)
|
58
|
+
<%= "\t#{ENV['FC']} #{ENV['FCFLAGS']} #{ENV['LDFLAGS']}" %> -o TestRunner $(OBJ)
|
59
59
|
|
60
60
|
<% file_dependencies.each do |source,dep| -%>
|
61
61
|
<%= "#{source.sub(/\.f90/i,'.o')}: #{source} #{dep.map{ |d| d.sub(/\.f90/i,'.o') }.join(' ')}" %>
|
data/lib/funit/testsuite.rb
CHANGED
@@ -15,7 +15,7 @@ module Funit
|
|
15
15
|
|
16
16
|
include Funit #FIXME
|
17
17
|
|
18
|
-
def initialize suite_name, suite_content
|
18
|
+
def initialize( suite_name, suite_content, wrap_with_module )
|
19
19
|
@line_number = 'blank'
|
20
20
|
@suite_name = suite_name
|
21
21
|
@suite_content = suite_content
|
@@ -23,21 +23,38 @@ module Funit
|
|
23
23
|
File.delete(suite_name+"_fun.f90") if File.exists?(suite_name+"_fun.f90")
|
24
24
|
super(suite_name+"_fun.f90","w")
|
25
25
|
@tests, @setup, @teardown = [], [], []
|
26
|
+
header
|
27
|
+
@wrap_with_module = wrap_with_module
|
28
|
+
module_wrapper if @wrap_with_module
|
26
29
|
top_wrapper
|
27
30
|
expand
|
28
31
|
close
|
29
32
|
end
|
30
33
|
|
31
|
-
def
|
32
|
-
puts <<-
|
34
|
+
def header
|
35
|
+
puts <<-HEADER
|
33
36
|
! #{@suite_name}_fun.f90 - a unit test suite for #{@suite_name}.f90
|
34
37
|
!
|
35
38
|
! #{File.basename $0} generated this file from #{@suite_name}.fun
|
36
|
-
! at #{Time.now}
|
37
39
|
|
40
|
+
HEADER
|
41
|
+
end
|
42
|
+
|
43
|
+
def module_wrapper
|
44
|
+
puts <<-MODULE_WRAPPER
|
45
|
+
module #{@suite_name}_mod
|
46
|
+
contains
|
47
|
+
include '#@suite_name.f90'
|
48
|
+
end module #{@suite_name}_mod
|
49
|
+
|
50
|
+
MODULE_WRAPPER
|
51
|
+
end
|
52
|
+
|
53
|
+
def top_wrapper
|
54
|
+
puts <<-TOP
|
38
55
|
module #{@suite_name}_fun
|
39
56
|
|
40
|
-
use #{@suite_name}
|
57
|
+
use #{ @wrap_with_module ? @suite_name+'_mod' : @suite_name }
|
41
58
|
|
42
59
|
implicit none
|
43
60
|
|
data/test/test_testsuite.rb
CHANGED
@@ -17,7 +17,7 @@ class TestTestSuite < Test::Unit::TestCase
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def test_nonexistent_funit_file_is_not_created
|
20
|
-
Funit::TestSuite.new 'dummyf90test'
|
20
|
+
Funit::TestSuite.new 'dummyf90test', '', false
|
21
21
|
assert !File.exists?("dummyf90test.fun")
|
22
22
|
assert !File.exists?("dummyf90test_fun.f90")
|
23
23
|
end
|
@@ -35,31 +35,31 @@ class TestTestSuite < Test::Unit::TestCase
|
|
35
35
|
|
36
36
|
def test_bare_minimum_funit_file_compiles
|
37
37
|
create_funit_file ""
|
38
|
-
Funit::TestSuite.new 'dummyf90test'
|
38
|
+
Funit::TestSuite.new 'dummyf90test', '', false
|
39
39
|
assert system(@@compileCommand)
|
40
40
|
end
|
41
41
|
|
42
42
|
def test_module_variables_allowed
|
43
43
|
create_funit_file "integer :: a"
|
44
|
-
Funit::TestSuite.new 'dummyf90test'
|
44
|
+
Funit::TestSuite.new 'dummyf90test', '', false
|
45
45
|
assert system(@@compileCommand)
|
46
46
|
end
|
47
47
|
|
48
48
|
def test_blank_setup_compiles
|
49
49
|
create_funit_file "beginSetup\nendSetup"
|
50
|
-
Funit::TestSuite.new 'dummyf90test'
|
50
|
+
Funit::TestSuite.new 'dummyf90test', '', false
|
51
51
|
assert system(@@compileCommand)
|
52
52
|
end
|
53
53
|
|
54
54
|
def test_blank_test_gives_warning
|
55
55
|
create_funit_file "beginTest bob\nendTest"
|
56
|
-
Funit::TestSuite.new 'dummyf90test'
|
56
|
+
Funit::TestSuite.new 'dummyf90test', '', false
|
57
57
|
assert system(@@compileCommand)
|
58
58
|
end
|
59
59
|
|
60
60
|
def test_single_assert_test_compiles
|
61
61
|
create_funit_file "beginTest assertTrue\nAssertTrue(.true.)\nendTest"
|
62
|
-
Funit::TestSuite.new 'dummyf90test'
|
62
|
+
Funit::TestSuite.new 'dummyf90test', '', false
|
63
63
|
assert system(@@compileCommand)
|
64
64
|
end
|
65
65
|
|
@@ -71,7 +71,7 @@ class TestTestSuite < Test::Unit::TestCase
|
|
71
71
|
AssertEqual(1,a(1,1))
|
72
72
|
endTest
|
73
73
|
MATRIX
|
74
|
-
Funit::TestSuite.new 'dummyf90test'
|
74
|
+
Funit::TestSuite.new 'dummyf90test', '', false
|
75
75
|
assert system(@@compileCommand)
|
76
76
|
end
|
77
77
|
|
@@ -83,7 +83,7 @@ class TestTestSuite < Test::Unit::TestCase
|
|
83
83
|
AssertRealEqual(1.0,real_var)
|
84
84
|
endTest
|
85
85
|
REALEQUALS
|
86
|
-
Funit::TestSuite.new 'dummyf90test'
|
86
|
+
Funit::TestSuite.new 'dummyf90test', '', false
|
87
87
|
assert system(@@compileCommand)
|
88
88
|
end
|
89
89
|
|
@@ -98,13 +98,13 @@ class TestTestSuite < Test::Unit::TestCase
|
|
98
98
|
balance = 0.5*(left+right)
|
99
99
|
end function balance
|
100
100
|
REQUALSFUNC
|
101
|
-
Funit::TestSuite.new 'dummyf90test'
|
101
|
+
Funit::TestSuite.new 'dummyf90test', '', false
|
102
102
|
assert system(@@compileCommand)
|
103
103
|
end
|
104
104
|
|
105
105
|
def test_ignore_commented_test
|
106
106
|
create_funit_file "XbeginTest bob\nendTest"
|
107
|
-
Funit::TestSuite.new 'dummyf90test'
|
107
|
+
Funit::TestSuite.new 'dummyf90test', '', false
|
108
108
|
assert_no_match( /Testbob/i, IO.readlines('dummyf90test_fun.f90').join )
|
109
109
|
end
|
110
110
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: funit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karen Bibb
|
@@ -13,7 +13,7 @@ autorequire:
|
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
15
|
|
16
|
-
date: 2009-
|
16
|
+
date: 2009-11-01 01:00:00 -04:00
|
17
17
|
default_executable:
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
@@ -24,7 +24,7 @@ dependencies:
|
|
24
24
|
requirements:
|
25
25
|
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 1.0
|
27
|
+
version: 1.1.0
|
28
28
|
version:
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: hoe
|
@@ -34,23 +34,9 @@ dependencies:
|
|
34
34
|
requirements:
|
35
35
|
- - ">="
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version:
|
37
|
+
version: 2.3.3
|
38
38
|
version:
|
39
|
-
description:
|
40
|
-
FUnit is a unit testing framework for Fortran.
|
41
|
-
|
42
|
-
Unit tests are written as Fortran fragments that use a small
|
43
|
-
set of testing-specific keywords and functions. FUnit transforms
|
44
|
-
these fragments into valid Fortran code, compiles, links, and
|
45
|
-
runs them against the code under test.
|
46
|
-
|
47
|
-
FUnit is {opinionated software}[http://www.oreillynet.com/pub/a/network/2005/08/30/ruby-rails-david-heinemeier-hansson.html], which values convention over
|
48
|
-
configuration. Specifically, FUnit,
|
49
|
-
|
50
|
-
* requires a Fortran 95 compiler,
|
51
|
-
* only supports testing routines contained in modules,
|
52
|
-
* requires tests to be stored along side the code under test, and
|
53
|
-
* requires test files to be named appropriately.
|
39
|
+
description: FUnit is a unit testing framework for Fortran. Unit tests are written as Fortran fragments that use a small set of testing-specific keywords and functions. FUnit transforms these fragments into valid Fortran code, compiles, links, and runs them against the code under test. FUnit is {opinionated software}[http://www.oreillynet.com/pub/a/network/2005/08/30/ruby-rails-david-heinemeier-hansson.html], which values convention over configuration. Specifically, FUnit, * requires a Fortran 95 compiler, * only supports testing routines contained in modules, * requires tests to be stored along side the code under test, and * requires test files to be named appropriately.
|
54
40
|
email: nasarb-developers@rubyforge.org
|
55
41
|
executables:
|
56
42
|
- funit
|
@@ -92,8 +78,6 @@ files:
|
|
92
78
|
- utils/funit-mode.el
|
93
79
|
has_rdoc: true
|
94
80
|
homepage: http://rubyforge.org/projects/nasarb
|
95
|
-
licenses: []
|
96
|
-
|
97
81
|
post_install_message:
|
98
82
|
rdoc_options:
|
99
83
|
- --main
|
@@ -115,9 +99,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
99
|
requirements:
|
116
100
|
- A Fortran compiler.
|
117
101
|
rubyforge_project: nasarb
|
118
|
-
rubygems_version: 1.3.
|
102
|
+
rubygems_version: 1.3.1
|
119
103
|
signing_key:
|
120
|
-
specification_version:
|
104
|
+
specification_version: 2
|
121
105
|
summary: FUnit is a unit testing framework for Fortran
|
122
106
|
test_files:
|
123
107
|
- test/test_compiler.rb
|