funit 0.9.3 → 0.9.4

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 CHANGED
@@ -1,3 +1,10 @@
1
+ === 0.9.4 / 2007-01-08
2
+
3
+ * 2 minor enhancements
4
+ * broke up more long conditionals with continuation
5
+ characters to avoid truncated lines
6
+ * added shebang to main for rubygems 1.0
7
+
1
8
  === 0.9.3 / 2007-12-23
2
9
 
3
10
  * 2 bug fixes
@@ -7,12 +14,14 @@
7
14
  === 0.9.2 / 2007-09-21
8
15
 
9
16
  * 1 minor enhancement
10
- * broke up long generated assert lines with continuations to compile via g95
17
+ * broke up long generated assert lines with continuations
18
+ to compile via g95
11
19
 
12
20
  === 0.9.1 / 2007-08-20
13
21
 
14
22
  * 1 minor enhancement
15
- * Stripped './' path prefixes and '\' continuations to appease windoze
23
+ * Stripped './' path prefixes and '\' continuations to
24
+ appease windoze
16
25
 
17
26
  === 0.9.0 / 2007-07-26
18
27
 
@@ -22,7 +31,8 @@
22
31
  === 0.1.3 / 2006-06-21
23
32
 
24
33
  * 1 bug fix
25
- * Do not remove unit tests! (Thanks to Sebastian Hanigk and James Quirk.)
34
+ * Do not remove unit tests! (Thanks to Sebastian Hanigk
35
+ and James Quirk.)
26
36
 
27
37
  === 0.1.2 / 2006-05-16
28
38
 
data/Manifest.txt CHANGED
@@ -18,8 +18,11 @@ lib/funit/assertions.rb
18
18
  lib/funit/compiler.rb
19
19
  lib/funit/functions.rb
20
20
  lib/funit/testsuite.rb
21
+ pitch/slides.tex
21
22
  test/test_compiler.rb
22
23
  test/test_functions.rb
23
24
  test/test_funit.rb
24
25
  test/test_testsuite.rb
26
+ utils/errorFinder.el
27
+ utils/funit-generic-mode.el
25
28
  utils/funit-mode.el
data/README.txt CHANGED
@@ -1,20 +1,19 @@
1
1
  FUnit
2
2
 
3
3
  * http://rubyforge.org/projects/nasarb
4
- * http://nasrb.rubyforge.org
4
+ * http://nasarb.rubyforge.org
5
5
 
6
6
  == DESCRIPTION:
7
7
 
8
- FUnit is a unit testing framework for Fortran modules.
8
+ FUnit is a unit testing framework for Fortran.
9
9
 
10
10
  Unit tests are written as Fortran fragments that use a small
11
11
  set of testing-specific keywords and functions. FUnit transforms
12
12
  these fragments into valid Fortran code, compiles, links, and
13
- runs them against the module under test.
13
+ runs them against the code under test.
14
14
 
15
15
  FUnit is {opinionated software}[http://www.oreillynet.com/pub/a/network/2005/08/30/ruby-rails-david-heinemeier-hansson.html], which values convention over
16
16
  configuration. Specifically, FUnit,
17
-
18
17
  * requires a Fortran 95 compiler,
19
18
  * only supports testing routines contained in modules,
20
19
  * requires tests to be stored along side the code under test, and
data/Rakefile CHANGED
@@ -3,21 +3,18 @@
3
3
  require 'rubygems'
4
4
  require 'hoe'
5
5
 
6
- $:.unshift File.join( File.dirname(__FILE__), 'lib' )
7
- require 'funit'
6
+ require './lib/funit.rb'
8
7
 
9
- Hoe.new('funit', Funit::VERSION) do |p|
10
- p.rubyforge_name = 'nasarb'
11
- p.remote_rdoc_dir = 'funit'
12
- p.extra_deps << [ 'fortran', '>= 1.0.1' ]
13
- p.author = ['Karen Bibb','Bil Kleb','Beth Lee-Rausch','Mike Park','Bill Wood']
14
- p.email = 'funit-support@rubyforge.org'
15
- p.summary = p.paragraphs_of('README.txt',3).to_s
16
- p.description = p.paragraphs_of('README.txt', 4..6).join("\n\n")
17
- p.url = p.paragraphs_of('README.txt', 1).first.gsub(/^\* /, '').split(/\n/)
18
- p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
19
- p.clean_globs.concat %w( **/*_fun.f90 examples/**/TestRunner* **/*.o **/*.mod **/*.MOD )
20
- p.rsync_args = '-rpv --delete' # to preserve group permissions
8
+ Hoe.new('funit', Funit::VERSION) do |funit|
9
+ funit.rubyforge_name = 'nasarb'
10
+ funit.remote_rdoc_dir = 'funit'
11
+ funit.extra_deps << [ 'fortran', '>= 1.0.1' ]
12
+ funit.spec_extras[:requirements] = "A Fortran compiler."
13
+ funit.author =
14
+ [ 'Karen Bibb','Bil Kleb','Beth Lee-Rausch','Mike Park','Bill Wood']
15
+ funit.email = 'nasarb-developers@rubyforge.org'
16
+ funit.clean_globs.concat %w( **/*_fun.f90 examples/**/TestRunner* **/*.o **/*.mod **/*.MOD )
17
+ funit.rsync_args = '-rpv --delete' # to preserve group permissions
21
18
  end
22
19
 
23
20
  # vim: syntax=Ruby
data/bin/funit CHANGED
@@ -1,3 +1,5 @@
1
+ #! /usr/bin/env ruby
2
+
1
3
  # Main fUnit routine
2
4
 
3
5
  begin require 'rubygems'; rescue LoadError; end
data/lib/funit.rb CHANGED
@@ -16,7 +16,7 @@ module Funit
16
16
  ##
17
17
  # the version of this fUnit
18
18
 
19
- VERSION = '0.9.3'
19
+ VERSION = '0.9.4'
20
20
 
21
21
  ##
22
22
  # run all tests
@@ -29,8 +29,8 @@ module Funit
29
29
  line.match(/\((.*)\)/)
30
30
  expected, actual = *(get_args($1))
31
31
  @type = 'IsRealEqual'
32
- @condition = ".not.(#{expected}+2*spacing(real(#{expected})).ge.#{actual} &\n .and.#{expected}-2*spacing(real(#{expected})).le.#{actual})"
33
- @message = "\"#{actual} (\",#{actual},\") is not\", &\n #{expected},\"within\",2*spacing(real(#{expected}))"
32
+ @condition = ".not.( (#{expected} &\n +2*spacing(real(#{expected})) ) &\n .ge. &\n (#{actual}) &\n .and. &\n (#{expected} &\n -2*spacing(real(#{expected})) ) &\n .le. &\n (#{actual}) )"
33
+ @message = "\"#{actual} (\", &\n #{actual}, &\n \") is not\", &\n #{expected},\&\n \"within\", &\n 2*spacing(real(#{expected}))"
34
34
  syntax_error("invalid body for #@type",@suite_name) unless $&
35
35
  write_assert
36
36
  end
@@ -39,7 +39,7 @@ module Funit
39
39
  line.match(/\((.*)\)/)
40
40
  expected, actual, tolerance = *(get_args($1))
41
41
  @type = 'IsEqualWithin'
42
- @condition = ".not.(#{actual}+#{tolerance}.ge.#{expected} &\n .and.#{actual}-#{tolerance}.le.#{expected})"
42
+ @condition = ".not.((#{actual} &\n +#{tolerance}) &\n .ge. &\n (#{expected}) &\n .and. &\n (#{actual} &\n -#{tolerance}) &\n .le. &\n (#{expected}) )"
43
43
  @message = "\"#{expected} (\",#{expected},\") is not\", &\n #{actual},\"within\",#{tolerance}"
44
44
  syntax_error("invalid body for #@type",@suite_name) unless $&
45
45
  write_assert
data/pitch/slides.tex ADDED
@@ -0,0 +1,138 @@
1
+ % pdflatex slides
2
+
3
+ \documentclass[landscape]{slides}
4
+ \usepackage{url}
5
+ \pagestyle{empty}
6
+ \hoffset 1in
7
+ \begin{document}
8
+ \begin{slide}
9
+ \begin{center}
10
+ {\bf\Large F90 Testkit}\\
11
+ \vspace{0.5in}
12
+ \begin{minipage}{6.5in}
13
+ {\bf Goal:} to make Fortran~90 unit/\-mobility/\-developer testing
14
+ as painless as possible.
15
+ \end{minipage}
16
+ \end{center}
17
+ \end{slide}
18
+ \begin{slide}
19
+ \begin{center}
20
+ {\bf\Large Why write tests?}\\
21
+ \vspace{0.5in}
22
+ \begin{minipage}[t]{3in}
23
+ \begin{itemize}
24
+ \item Shame
25
+ \item Embarrassment
26
+ \item Speed
27
+ \item Confidence
28
+ \end{itemize}
29
+ \end{minipage}
30
+ \begin{minipage}[t]{3in}
31
+ \begin{itemize}
32
+ \item Trust
33
+ \item Change
34
+ \item Documentation
35
+ \end{itemize}
36
+ \end{minipage}
37
+ \end{center}
38
+ \end{slide}
39
+ \begin{slide}
40
+ \begin{center}
41
+ {\bf\Large Why write tests first?}\\
42
+ \vspace{0.5in}
43
+ \begin{minipage}{3in}
44
+ \begin{itemize}
45
+ \item Tests get written
46
+ \item Succinctness
47
+ \item Clarity
48
+ \item Closure
49
+ \end{itemize}
50
+ \end{minipage}\\
51
+ \vspace{1in}
52
+ \begin{minipage}{5.7in}\raggedright
53
+ ``No code should be written or changed unless there is a failing
54
+ test.''
55
+ \end{minipage}
56
+ \end{center}
57
+ \end{slide}
58
+ \begin{slide}
59
+ \begin{center}
60
+ {\bf\Large How do I add tests to legacy code?}\\
61
+ \vspace{0.5in}
62
+ \begin{minipage}{6in}
63
+ \begin{itemize}
64
+ \item Fixing Bugs
65
+ \begin{itemize}
66
+ \item write test for bug {\small (which fails)}
67
+ \item write code to satisfy failing test
68
+ \item write tests/code for similar cases
69
+ \end{itemize}
70
+ \vspace{8pt}
71
+ \item Adding Features
72
+ \begin{itemize}
73
+ \item write test for feature {\small (which better fail)}
74
+ \item write code to satisfy failing test
75
+ \end{itemize}
76
+ \vspace{8pt}
77
+ \item Refactoring ``Bad Smells''
78
+ \begin{itemize}
79
+ \item write tests to cover existing code
80
+ \item update/add tests for new structure
81
+ \item change code to satisfy failing tests
82
+ \end{itemize}
83
+ \end{itemize}
84
+ \end{minipage}
85
+ \end{center}
86
+ \end{slide}
87
+ \begin{slide}
88
+ \begin{center}
89
+ {\bf\Large Crazy enough to learn more?}\\
90
+ \vspace{0.5in}
91
+ \begin{minipage}{6in}
92
+ \begin{itemize}
93
+ \item \url{http://c2.com/cgi/wiki?UnitTests}\\[-10pt]
94
+ \item \url{http://xprogramming.com/software.htm}
95
+ \end{itemize}
96
+ \end{minipage}
97
+ \end{center}
98
+ \end{slide}
99
+ \begin{slide}
100
+ \begin{center}
101
+ {\bf\Large Want to try F90 testkit?}\\
102
+ \vspace{0.5in}
103
+ \begin{minipage}{9in}
104
+ \begin{itemize}
105
+ \item Have your SA install Ruby {\small(or install it yourself)}\\[5pt]
106
+ \hspace*{1em}\url{http://www.ruby-lang.org/}\\[5pt]
107
+ \item Check out the FTK repository\\[5pt]
108
+ \hspace*{1em}\verb+cvs -d :pserver:[username]@abnode3:/usr/local/cvsroot \+\\
109
+ \hspace*{1em}\verb+checkout -P FTK+\\[5pt]
110
+ where \verb+[username]+ is your CVS username on \verb+abnode3+
111
+ \end{itemize}
112
+ \end{minipage}
113
+ \end{center}
114
+ \end{slide}
115
+ \begin{slide}
116
+ \begin{center}
117
+ {\bf\Large Who does what?}\\
118
+ \vspace{0.5in}
119
+ {\bf You:}
120
+ \begin{minipage}[t]{6.5in}\raggedright
121
+ \begin{enumerate}
122
+ \item Create testsuite file, e.g., \verb+RoutineTS.ftk+
123
+ \item Write test in Fortran with embedded assert macros, .e.g,
124
+ \verb+IsTrue(x>2)+
125
+ \item Run testsuite {\small (it should fail)}
126
+ \item Write \verb+Routine.f90+ to satisfy test
127
+ \end{enumerate}
128
+ \vspace{10pt}
129
+ Repeat steps 2, 3, and 4 until your objective is met.
130
+ \end{minipage}\\
131
+ \vspace{0.8in}
132
+ {\bf It:}
133
+ \begin{minipage}[t]{6in}\raggedright
134
+ Translates, compiles, links, and runs tests.
135
+ \end{minipage}
136
+ \end{center}
137
+ \end{slide}
138
+ \end{document}
@@ -6,7 +6,7 @@ class TestCompiler < Test::Unit::TestCase
6
6
  def test_no_environment_compiler_name
7
7
  begin
8
8
  orig_FC = ENV['FC']
9
- ENV['FC'] = nil
9
+ ENV.delete 'FC'
10
10
  assert_raises(RuntimeError) {Funit::Compiler.new}
11
11
  ensure
12
12
  ENV['FC'] = orig_FC
data/test/test_funit.rb CHANGED
@@ -50,15 +50,13 @@ class TestFunit < Test::Unit::TestCase
50
50
  @line_number = "dummy"
51
51
  isrealequal("IsRealEqual(a,b)")
52
52
  ans = <<-EOF
53
- .not.(a+2*spacing(real(a)).ge.b &
54
- .and.a-2*spacing(real(a)).le.b)
53
+ .not.( (a &\n +2*spacing(real(a)) ) &\n .ge. &\n (b) &\n .and. &\n (a &\n -2*spacing(real(a)) ) &\n .le. &\n (b) )
55
54
  EOF
56
55
  assert_equal ans.chomp, @condition
57
- assert_equal %|"b (",b,") is not", &\n a,"within",2*spacing(real(a))|, @message
56
+ assert_equal %|"b (", &\n b, &\n ") is not", &\n a,&\n "within", &\n 2*spacing(real(a))|, @message
58
57
  isrealequal("IsRealEqual(1.0,m(1,1))")
59
58
  ans = <<-EOF
60
- .not.(1.0+2*spacing(real(1.0)).ge.m(1,1) &
61
- .and.1.0-2*spacing(real(1.0)).le.m(1,1))
59
+ .not.( (1.0 &\n +2*spacing(real(1.0)) ) &\n .ge. &\n (m(1,1)) &\n .and. &\n (1.0 &\n -2*spacing(real(1.0)) ) &\n .le. &\n (m(1,1)) )
62
60
  EOF
63
61
  assert_equal ans.chomp, @condition
64
62
  end
@@ -0,0 +1,88 @@
1
+ From - Mon Nov 12 23:36:17 2001
2
+ Path: reznor.larc.nasa.gov!kant.larc.nasa.gov!logbridge.uoregon.edu!news-peer.gip.net!news.gsl.net!gip.net!newsfeed.mathworks.com!cyclone.swbell.net!easynews!sjc-peer.news.verio.net!news.verio.net!sea-read.news.verio.net.POSTED!not-for-mail
3
+ Sender: mikesl@thneed.na.wrq.com
4
+ Newsgroups: comp.emacs
5
+ Subject: Re: Re-centering buffer based on error line indicted in another buffer
6
+ References: <3BF03829.826F39CB@LaRC.NASA.Gov>
7
+ From: Michael Slass <mikesl@wrq.com>
8
+ Message-ID: <m3wv0vipqe.fsf@thneed.na.wrq.com>
9
+ Lines: 68
10
+ User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1
11
+ MIME-Version: 1.0
12
+ Content-Type: text/plain; charset=us-ascii
13
+ Date: Mon, 12 Nov 2001 22:33:35 GMT
14
+ NNTP-Posting-Host: 150.215.90.102
15
+ X-Complaints-To: abuse@verio.net
16
+ X-Trace: sea-read.news.verio.net 1005604415 150.215.90.102 (Mon, 12 Nov 2001 22:33:35 GMT)
17
+ NNTP-Posting-Date: Mon, 12 Nov 2001 22:33:35 GMT
18
+ Organization: Verio
19
+ Xref: reznor.larc.nasa.gov comp.emacs:70829
20
+
21
+ Bil Kleb <W.L.Kleb@LaRC.NASA.Gov> writes:
22
+
23
+ >So, I have a mode that executes a command on the
24
+ >current buffer, and displays the resulting output
25
+ >in another buffer (with possibly some error messages
26
+ >which include line numbers in the original buffer).
27
+ >
28
+ >What I would like to have now is a function which
29
+ >scans the output buffer for errors (doing a regex
30
+ >pattern match?), and recenters the original buffer
31
+ >on the first error line indicated by the output buffer.
32
+ >(Auctex mode has a similar feature, but the code
33
+ >is much too involved for this newbie lisp brain to
34
+ >effectively decipher.)
35
+ >
36
+ >Any suggestions on references to search, keywords to
37
+ >use during a search, etc.?
38
+ >
39
+ >TIA,
40
+ >--
41
+ >bil <http://abweb.larc.nasa.gov/~kleb/>
42
+
43
+ Here's a quick kludge for this, if you don't want to try to adapt
44
+ compilation mode. It's kludgey, but if you're lucky, some of the gurus
45
+ will give you (and me) pointers on how to make it less so.
46
+
47
+
48
+ (defvar bk-error-buffer
49
+ "*error-buffer*"
50
+ "Buffer name for error messages used by `bk-next-error'")
51
+
52
+ (defvar bk-error-message-regexp
53
+ "error at line \\([0-9]+\\)"
54
+ "Regular expression used by `bk-next-error' to find error messages.
55
+ The sub-expression between the first capturing parens must be the line
56
+ number where the error occured")
57
+
58
+
59
+ (defun bk-next-error ()
60
+ "Goto line in current buffer indicated by next error message in `bk-error-buffer'
61
+
62
+ Assumes that the point is positioned before the first occurance of
63
+ `bk-error-message-regexp' in the `bk-error-buffer' before the first
64
+ call to this function.
65
+
66
+ See also `bk-error-message-regexp' `bk-error-buffer'"
67
+
68
+ (interactive)
69
+ (let ((error-line-number))
70
+ (save-current-buffer
71
+ (set-buffer (or (get-buffer bk-error-buffer)
72
+ (error
73
+ (concat
74
+ "Can't find the error buffer: "
75
+ bk-error-buffer))))
76
+ (if (re-search-forward bk-error-message-regexp nil t)
77
+ (progn
78
+ (setq error-line-number
79
+ (string-to-number
80
+ (buffer-substring (match-beginning 1)
81
+ (match-end 1))))
82
+ (goto-char (1+ (match-end 1))))))
83
+ (if error-line-number
84
+ (goto-line error-line-number)
85
+ (message "No more errors"))))
86
+
87
+ --
88
+ Mike
@@ -0,0 +1,20 @@
1
+ ;; Make a generic-mode for fUnit files:
2
+ (require 'generic)
3
+ (define-generic-mode 'funit-generic-mode
4
+ (list ?!)
5
+ (list
6
+ "beginTest"
7
+ "endTest"
8
+ "beginSetup"
9
+ "endSetup"
10
+ "beginTeardown"
11
+ "endTeardown"
12
+ )
13
+ '(("\\(IsFalse\\)" 1 'font-lock-function-name-face)
14
+ ("\\(IsTrue\\)" 1 'font-lock-function-name-face)
15
+ ("\\(IsEqualWithin\\)" 1 'font-lock-function-name-face)
16
+ ("\\(IsEqual\\)" 1 'font-lock-function-name-face)
17
+ ("\\(IsRealEqual\\)" 1 'font-lock-function-name-face))
18
+ (list "\\.fun\\'")
19
+ nil
20
+ "Generic mode for fUnit files.")
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.9.3
4
+ version: 0.9.4
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: 2007-12-23 00:00:00 -05:00
16
+ date: 2008-03-30 00:00:00 -04:00
17
17
  default_executable:
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
@@ -32,10 +32,10 @@ dependencies:
32
32
  requirements:
33
33
  - - ">="
34
34
  - !ruby/object:Gem::Version
35
- version: 1.4.0
35
+ version: 1.5.1
36
36
  version:
37
- description: 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 module 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.
38
- email: funit-support@rubyforge.org
37
+ 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.
38
+ email: nasarb-developers@rubyforge.org
39
39
  executables:
40
40
  - funit
41
41
  extensions: []
@@ -66,13 +66,16 @@ files:
66
66
  - lib/funit/compiler.rb
67
67
  - lib/funit/functions.rb
68
68
  - lib/funit/testsuite.rb
69
+ - pitch/slides.tex
69
70
  - test/test_compiler.rb
70
71
  - test/test_functions.rb
71
72
  - test/test_funit.rb
72
73
  - test/test_testsuite.rb
74
+ - utils/errorFinder.el
75
+ - utils/funit-generic-mode.el
73
76
  - utils/funit-mode.el
74
77
  has_rdoc: true
75
- homepage: http://rubyforge.org/projects/nasarb
78
+ homepage: FUnit is a unit testing framework for Fortran.
76
79
  post_install_message:
77
80
  rdoc_options:
78
81
  - --main
@@ -91,13 +94,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
94
  - !ruby/object:Gem::Version
92
95
  version: "0"
93
96
  version:
94
- requirements: []
95
-
97
+ requirements:
98
+ - A Fortran compiler.
96
99
  rubyforge_project: nasarb
97
- rubygems_version: 1.0.1
100
+ rubygems_version: 1.1.0
98
101
  signing_key:
99
102
  specification_version: 2
100
- summary: FUnit is a unit testing framework for Fortran modules.
103
+ summary: FUnit is a unit testing framework for Fortran
101
104
  test_files:
102
105
  - test/test_compiler.rb
103
106
  - test/test_functions.rb