fUnit 0.0.3 → 0.1.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/README +16 -15
- data/Rakefile +1 -1
- data/bin/funit +1 -1
- data/docs/html/classes/Funit.html +20 -22
- data/docs/html/classes/Funit/Assertions.html +1 -1
- data/docs/html/classes/Funit/Compiler.html +3 -3
- data/docs/html/classes/Funit/TestSuite.html +43 -43
- data/docs/html/created.rid +1 -1
- data/docs/html/files/README.html +22 -25
- data/docs/html/files/lib/funit/assertions_rb.html +1 -1
- data/docs/html/files/lib/funit/functions_rb.html +1 -1
- data/docs/html/files/lib/funit/test_suite_rb.html +10 -1
- data/docs/html/files/lib/funit_rb.html +1 -1
- data/docs/html/fr_method_index.html +2 -2
- data/examples/CFD/{FluxFunctionsMT.ftk → FluxFunctions.fun} +1 -1
- data/examples/CFD/{GasModelMT.ftk → GasModel.fun} +1 -1
- data/examples/StopWatch/{StopWatchMT.ftk → StopWatch.fun} +0 -0
- data/lib/funit.rb +4 -6
- data/lib/funit/assertions.rb +1 -1
- data/lib/funit/functions.rb +20 -20
- data/lib/funit/test_suite.rb +43 -38
- data/tests/tc_compile.rb +7 -4
- data/tests/tc_fortran_deps.rb +3 -0
- data/tests/tc_funit.rb +30 -16
- data/tests/tc_test_suite.rb +29 -31
- metadata +4 -17
- data/examples/CFD/FluxFunctionsMT.f90 +0 -336
- data/examples/CFD/GasModelMT.f90 +0 -173
- data/examples/CFD/TestRunner +0 -0
- data/examples/CFD/TestRunner.f90 +0 -23
- data/examples/CFD/fluxfunctions.mod +0 -45
- data/examples/CFD/gammas.mod +0 -20
- data/examples/CFD/gasmodel.mod +0 -30
- data/examples/CFD/gasmodelmt.mod +0 -27
- data/examples/StopWatch/StopWatchMT.f90 +0 -343
- data/examples/StopWatch/TestRunner +0 -0
- data/examples/StopWatch/TestRunner.f90 +0 -23
- data/examples/StopWatch/stopwatch.mod +0 -34
- data/examples/StopWatch/stopwatchmt.mod +0 -27
data/tests/tc_compile.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
|
1
3
|
$:.unshift File.join( File.dirname(__FILE__), '..', 'lib' )
|
4
|
+
|
2
5
|
require 'test/unit'
|
3
6
|
require 'funit/functions'
|
4
7
|
|
@@ -6,7 +9,7 @@ class TestCompiler < Test::Unit::TestCase
|
|
6
9
|
|
7
10
|
def setup
|
8
11
|
@compilerStub = 'dummyCompiler'
|
9
|
-
@oldCompilerName = ENV['
|
12
|
+
@oldCompilerName = ENV['FC']
|
10
13
|
end
|
11
14
|
|
12
15
|
def test_explicit_compiler_name
|
@@ -14,17 +17,17 @@ class TestCompiler < Test::Unit::TestCase
|
|
14
17
|
end
|
15
18
|
|
16
19
|
def test_compiler_name_from_environment
|
17
|
-
ENV['
|
20
|
+
ENV['FC'] = @compilerStub
|
18
21
|
assert_equal @compilerStub, Funit::Compiler.new.name
|
19
22
|
end
|
20
23
|
|
21
24
|
def test_no_environment_compiler_name
|
22
|
-
ENV['
|
25
|
+
ENV['FC'] = nil
|
23
26
|
assert_raises(RuntimeError) {Funit::Compiler.new}
|
24
27
|
end
|
25
28
|
|
26
29
|
def teardown
|
27
|
-
ENV['
|
30
|
+
ENV['FC'] = @oldCompilerName
|
28
31
|
end
|
29
32
|
|
30
33
|
end
|
data/tests/tc_fortran_deps.rb
CHANGED
data/tests/tc_funit.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
|
1
3
|
$:.unshift File.join( File.dirname(__FILE__), '..', 'lib' )
|
4
|
+
|
2
5
|
require 'test/unit'
|
3
6
|
require 'funit'
|
4
7
|
require 'ftools'
|
@@ -8,14 +11,14 @@ class TestFunit < Test::Unit::TestCase
|
|
8
11
|
include Funit
|
9
12
|
include Funit::Assertions
|
10
13
|
|
11
|
-
def
|
14
|
+
def Xtest_main_driver_compiles
|
12
15
|
writeTestRunner []
|
13
16
|
assert File.exists?("TestRunner.f90")
|
14
17
|
assert system("#{Compiler.new.name} TestRunner.f90")
|
15
18
|
assert File.exists?("a.out")
|
16
19
|
end
|
17
20
|
|
18
|
-
def
|
21
|
+
def Xtest_is_equal
|
19
22
|
@suiteName = "dummy"
|
20
23
|
@testName = "dummy"
|
21
24
|
@lineNumber = "dummy"
|
@@ -23,7 +26,7 @@ class TestFunit < Test::Unit::TestCase
|
|
23
26
|
assert_equal '.not.(1.0==m(1,1))', @condition
|
24
27
|
end
|
25
28
|
|
26
|
-
def
|
29
|
+
def Xtest_is_real_equal
|
27
30
|
@suiteName = "dummy"
|
28
31
|
@testName = "dummy"
|
29
32
|
@lineNumber = "dummy"
|
@@ -50,10 +53,10 @@ EOF
|
|
50
53
|
File.open('unita.f90','w') do |f|
|
51
54
|
f.printf "module unita\n integer :: a = 5\nend module unita\n"
|
52
55
|
end
|
53
|
-
File.open('
|
54
|
-
f.printf "beginTest
|
56
|
+
File.open('unit.fun','w') do |f|
|
57
|
+
f.printf "beginTest a_gets_set\n IsEqual(5, a)\nendTest\n"
|
55
58
|
end
|
56
|
-
assert_nothing_raised{
|
59
|
+
assert_nothing_raised{run_tests}
|
57
60
|
end
|
58
61
|
|
59
62
|
def test_embedded_dependencies
|
@@ -66,10 +69,10 @@ EOF
|
|
66
69
|
File.open('unitb.f90','w') do |f|
|
67
70
|
f.printf "module unitb\n integer,parameter :: b = 5\nend module unitb\n"
|
68
71
|
end
|
69
|
-
File.open('
|
70
|
-
f.printf "beginTest
|
72
|
+
File.open('unit.fun','w') do |f|
|
73
|
+
f.printf "beginTest a_gets_set\n IsEqual(5, a)\nendTest\n"
|
71
74
|
end
|
72
|
-
assert_nothing_raised{
|
75
|
+
assert_nothing_raised{run_tests}
|
73
76
|
end
|
74
77
|
|
75
78
|
def test_requested_modules
|
@@ -77,17 +80,28 @@ EOF
|
|
77
80
|
assert_equal ["asd","fga"], requestedModules(["asd","fga"])
|
78
81
|
assert requestedModules([]).empty?
|
79
82
|
modules = %w[ldfdl lmzd]
|
80
|
-
|
81
|
-
system "touch "+
|
83
|
+
funits = modules.map{|f| f+'.fun'}.join(' ')
|
84
|
+
system "touch "+funits
|
82
85
|
assert_equal modules, requestedModules([])
|
83
86
|
end
|
84
87
|
|
85
|
-
def
|
88
|
+
def test_funit_exists_method
|
86
89
|
moduleName = "ydsbe"
|
87
|
-
File.rm_f(moduleName+"
|
88
|
-
assert_equal false,
|
89
|
-
system "touch "+moduleName+"
|
90
|
-
assert
|
90
|
+
File.rm_f(moduleName+".fun")
|
91
|
+
assert_equal false, funit_exists?(moduleName)
|
92
|
+
system "touch "+moduleName+".fun"
|
93
|
+
assert funit_exists?(moduleName)
|
94
|
+
end
|
95
|
+
|
96
|
+
def setup
|
97
|
+
File.rm_f(*Dir["dummyunit*"])
|
98
|
+
File.rm_f(*Dir["unit*"])
|
99
|
+
File.rm_f(*Dir["ydsbe*"])
|
100
|
+
File.rm_f(*Dir["lmzd*"])
|
101
|
+
File.rm_f(*Dir["ldfdl*"])
|
102
|
+
File.rm_f(*Dir["ydsbe*"])
|
103
|
+
File.rm_f(*Dir["TestRunner*"])
|
104
|
+
File.rm_f(*Dir["a.out"])
|
91
105
|
end
|
92
106
|
|
93
107
|
def teardown
|
data/tests/tc_test_suite.rb
CHANGED
@@ -1,6 +1,10 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
|
1
3
|
$:.unshift File.join( File.dirname(__FILE__), '..', 'lib' )
|
4
|
+
|
2
5
|
require 'test/unit'
|
3
6
|
require 'funit/test_suite'
|
7
|
+
require 'funit/assertions'
|
4
8
|
|
5
9
|
class TestTestSuite < Test::Unit::TestCase
|
6
10
|
|
@@ -8,83 +12,83 @@ class TestTestSuite < Test::Unit::TestCase
|
|
8
12
|
File.rm_f(*Dir["dummyf90test*"])
|
9
13
|
end
|
10
14
|
|
11
|
-
def
|
15
|
+
def teardown
|
16
|
+
File.rm_f(*Dir["dummyf90test*"])
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_nonexistent_funit_file_is_not_created
|
12
20
|
Funit::TestSuite.new 'dummyf90test'
|
13
|
-
assert !File.exists?("
|
14
|
-
assert !File.exists?("
|
21
|
+
assert !File.exists?("dummyf90test.fun")
|
22
|
+
assert !File.exists?("dummyf90test_fun.f90")
|
15
23
|
end
|
16
24
|
|
17
|
-
def
|
25
|
+
def create_funit_file funit_contents
|
18
26
|
File.open('dummyf90test.f90','w') do |f|
|
19
27
|
f.puts "module dummyf90test\nend module dummyf90test"
|
20
28
|
end
|
21
|
-
File.open('
|
22
|
-
f.puts
|
29
|
+
File.open('dummyf90test.fun','w') do |f|
|
30
|
+
f.puts funit_contents
|
23
31
|
end
|
24
32
|
end
|
25
33
|
|
26
|
-
@@compileCommand = "#{Funit::Compiler.new.name} -c dummyf90test.f90
|
34
|
+
@@compileCommand = "#{Funit::Compiler.new.name} -c dummyf90test.f90 dummyf90test_fun.f90"
|
27
35
|
|
28
|
-
def
|
29
|
-
|
36
|
+
def test_bare_minimum_funit_file_compiles
|
37
|
+
create_funit_file ""
|
30
38
|
Funit::TestSuite.new 'dummyf90test'
|
31
39
|
assert system(@@compileCommand)
|
32
40
|
end
|
33
41
|
|
34
42
|
def test_module_variables_allowed
|
35
|
-
|
43
|
+
create_funit_file "integer :: a"
|
36
44
|
Funit::TestSuite.new 'dummyf90test'
|
37
45
|
assert system(@@compileCommand)
|
38
46
|
end
|
39
47
|
|
40
48
|
def test_blank_setup_compiles
|
41
|
-
|
49
|
+
create_funit_file "beginSetup\nendSetup"
|
42
50
|
Funit::TestSuite.new 'dummyf90test'
|
43
51
|
assert system(@@compileCommand)
|
44
52
|
end
|
45
53
|
|
46
54
|
def test_blank_test_gives_warning
|
47
|
-
|
55
|
+
create_funit_file "beginTest bob\nendTest"
|
48
56
|
Funit::TestSuite.new 'dummyf90test'
|
49
57
|
assert system(@@compileCommand)
|
50
58
|
end
|
51
59
|
|
52
60
|
def test_single_assert_test_compiles
|
53
|
-
|
61
|
+
create_funit_file "beginTest assertTrue\nIsTrue(.true.)\nendTest"
|
54
62
|
Funit::TestSuite.new 'dummyf90test'
|
55
63
|
assert system(@@compileCommand)
|
56
64
|
end
|
57
65
|
|
58
66
|
def test_matrix_assert_compiles
|
59
|
-
|
67
|
+
create_funit_file <<-MATRIX
|
60
68
|
beginTest assertTrue
|
61
69
|
integer :: a(2,2)
|
62
70
|
a = 1
|
63
71
|
IsEqual(a(1,1),1)
|
64
72
|
endTest
|
65
|
-
|
73
|
+
MATRIX
|
66
74
|
Funit::TestSuite.new 'dummyf90test'
|
67
|
-
puts `cat dummyf90testMT.ftk`
|
68
|
-
puts `cat dummyf90testMT.f90`
|
69
75
|
assert system(@@compileCommand)
|
70
76
|
end
|
71
77
|
|
72
78
|
def test_simple_real_equals_assert_works
|
73
|
-
|
79
|
+
create_funit_file <<-REALEQUALS
|
74
80
|
beginTest assert_equals
|
75
81
|
real :: real_var
|
76
82
|
real_var = 1.0
|
77
83
|
IsRealEqual(real_var,1.0)
|
78
84
|
endTest
|
79
|
-
|
85
|
+
REALEQUALS
|
80
86
|
Funit::TestSuite.new 'dummyf90test'
|
81
|
-
puts `cat dummyf90testMT.ftk`
|
82
|
-
puts `cat dummyf90testMT.f90`
|
83
87
|
assert system(@@compileCommand)
|
84
88
|
end
|
85
89
|
|
86
90
|
def test_real_equals_assert_works_with_function
|
87
|
-
|
91
|
+
create_funit_file <<-REQUALSFUNC
|
88
92
|
function balance( left, right)
|
89
93
|
real :: balance
|
90
94
|
real, intent(in) :: left, right
|
@@ -93,21 +97,15 @@ class TestTestSuite < Test::Unit::TestCase
|
|
93
97
|
beginTest assert_equals_for_function
|
94
98
|
IsRealEqual(balance(0.0,0.0),0.0)
|
95
99
|
endTest
|
96
|
-
|
100
|
+
REQUALSFUNC
|
97
101
|
Funit::TestSuite.new 'dummyf90test'
|
98
|
-
puts `cat dummyf90testMT.ftk`
|
99
|
-
puts `cat dummyf90testMT.f90`
|
100
102
|
assert system(@@compileCommand)
|
101
103
|
end
|
102
104
|
|
103
105
|
def test_ignore_commented_test
|
104
|
-
|
106
|
+
create_funit_file "XbeginTest bob\nendTest"
|
105
107
|
Funit::TestSuite.new 'dummyf90test'
|
106
|
-
assert_no_match( /Testbob/i, IO.readlines('
|
108
|
+
assert_no_match( /Testbob/i, IO.readlines('dummyf90test_fun.f90').join )
|
107
109
|
end
|
108
110
|
|
109
|
-
def teardown
|
110
|
-
File.rm_f(*Dir["dummyf90test*"])
|
111
|
-
end
|
112
|
-
|
113
111
|
end
|
metadata
CHANGED
@@ -3,7 +3,7 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: fUnit
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0
|
6
|
+
version: 0.1.0
|
7
7
|
date: 2006-04-15 00:00:00 -04:00
|
8
8
|
summary: A Fortran Unit Testing Framework
|
9
9
|
require_paths:
|
@@ -87,25 +87,12 @@ files:
|
|
87
87
|
- examples/CFD
|
88
88
|
- examples/StopWatch
|
89
89
|
- examples/CFD/FluxFunctions.f90
|
90
|
-
- examples/CFD/
|
91
|
-
- examples/CFD/FluxFunctionsMT.f90
|
92
|
-
- examples/CFD/FluxFunctionsMT.ftk
|
90
|
+
- examples/CFD/FluxFunctions.fun
|
93
91
|
- examples/CFD/Gammas.f90
|
94
|
-
- examples/CFD/gammas.mod
|
95
92
|
- examples/CFD/GasModel.f90
|
96
|
-
- examples/CFD/
|
97
|
-
- examples/CFD/GasModelMT.f90
|
98
|
-
- examples/CFD/GasModelMT.ftk
|
99
|
-
- examples/CFD/gasmodelmt.mod
|
100
|
-
- examples/CFD/TestRunner
|
101
|
-
- examples/CFD/TestRunner.f90
|
93
|
+
- examples/CFD/GasModel.fun
|
102
94
|
- examples/StopWatch/StopWatch.f90
|
103
|
-
- examples/StopWatch/
|
104
|
-
- examples/StopWatch/StopWatchMT.f90
|
105
|
-
- examples/StopWatch/StopWatchMT.ftk
|
106
|
-
- examples/StopWatch/stopwatchmt.mod
|
107
|
-
- examples/StopWatch/TestRunner
|
108
|
-
- examples/StopWatch/TestRunner.f90
|
95
|
+
- examples/StopWatch/StopWatch.fun
|
109
96
|
- lib/funit
|
110
97
|
- lib/funit.rb
|
111
98
|
- lib/funit/assertions.rb
|
@@ -1,336 +0,0 @@
|
|
1
|
-
! FluxFunctionsMT.f90 - a Fortran mobility test suite for FluxFunctions.f90
|
2
|
-
!
|
3
|
-
! [dynamically generated from FluxFunctionsMT.ftk
|
4
|
-
! by funit Ruby script Sun Apr 09 01:22:59 EDT 2006]
|
5
|
-
|
6
|
-
module FluxFunctionsMT
|
7
|
-
|
8
|
-
use FluxFunctions
|
9
|
-
|
10
|
-
implicit none
|
11
|
-
|
12
|
-
private
|
13
|
-
|
14
|
-
public :: MTFluxFunctions
|
15
|
-
|
16
|
-
logical :: noAssertFailed
|
17
|
-
|
18
|
-
integer :: numTests = 0
|
19
|
-
integer :: numAsserts = 0
|
20
|
-
integer :: numAssertsTested = 0
|
21
|
-
integer :: numFailures = 0
|
22
|
-
|
23
|
-
! $Id: FluxFunctionsMT.ftk 139 2006-04-09 05:17:47Z kleb $
|
24
|
-
|
25
|
-
real :: leftState, rightState, interfaceFlux
|
26
|
-
|
27
|
-
contains
|
28
|
-
|
29
|
-
|
30
|
-
subroutine TestFluxZero
|
31
|
-
|
32
|
-
real :: state
|
33
|
-
state = 0
|
34
|
-
|
35
|
-
! IsEqualWithin assertion
|
36
|
-
numAsserts = numAsserts + 1
|
37
|
-
if (noAssertFailed) then
|
38
|
-
if (.not.( 0+ 0.00001 .ge. Flux(state) &
|
39
|
-
.and. 0- 0.00001 .le. Flux(state))) then
|
40
|
-
print *, " *IsEqualWithin failed* in test FluxZero &
|
41
|
-
&[FluxFunctionsMT.ftk:13]"
|
42
|
-
print *, " ", " Flux(state) (", Flux(state),") is not", 0,"within", 0.00001
|
43
|
-
print *, ""
|
44
|
-
noAssertFailed = .false.
|
45
|
-
numFailures = numFailures + 1
|
46
|
-
else
|
47
|
-
numAssertsTested = numAssertsTested + 1
|
48
|
-
endif
|
49
|
-
endif
|
50
|
-
|
51
|
-
numTests = numTests + 1
|
52
|
-
|
53
|
-
end subroutine TestFluxZero
|
54
|
-
|
55
|
-
|
56
|
-
subroutine TestFluxOne
|
57
|
-
|
58
|
-
real :: state = 1
|
59
|
-
|
60
|
-
! IsEqualWithin assertion
|
61
|
-
numAsserts = numAsserts + 1
|
62
|
-
if (noAssertFailed) then
|
63
|
-
if (.not.( 0.5+ 0.00001 .ge. Flux(state) &
|
64
|
-
.and. 0.5- 0.00001 .le. Flux(state))) then
|
65
|
-
print *, " *IsEqualWithin failed* in test FluxOne &
|
66
|
-
&[FluxFunctionsMT.ftk:18]"
|
67
|
-
print *, " ", " Flux(state) (", Flux(state),") is not", 0.5,"within", 0.00001
|
68
|
-
print *, ""
|
69
|
-
noAssertFailed = .false.
|
70
|
-
numFailures = numFailures + 1
|
71
|
-
else
|
72
|
-
numAssertsTested = numAssertsTested + 1
|
73
|
-
endif
|
74
|
-
endif
|
75
|
-
|
76
|
-
numTests = numTests + 1
|
77
|
-
|
78
|
-
end subroutine TestFluxOne
|
79
|
-
|
80
|
-
|
81
|
-
subroutine TestRoeAvgZero
|
82
|
-
|
83
|
-
|
84
|
-
! IsRealEqual assertion
|
85
|
-
numAsserts = numAsserts + 1
|
86
|
-
if (noAssertFailed) then
|
87
|
-
if (.not.( RoeAvg(0.0+2*spacing(real( RoeAvg(0.0)).ge.0.0), 0 &
|
88
|
-
.and. RoeAvg(0.0-2*spacing(real( RoeAvg(0.0)).le.0.0), 0 )) then
|
89
|
-
print *, " *IsRealEqual failed* in test RoeAvgZero &
|
90
|
-
&[FluxFunctionsMT.ftk:22]"
|
91
|
-
print *, " ", "0.0), 0 (",0.0), 0 ,") is not", RoeAvg(0.0,"within",2*spacing(real( RoeAvg(0.0))
|
92
|
-
print *, ""
|
93
|
-
noAssertFailed = .false.
|
94
|
-
numFailures = numFailures + 1
|
95
|
-
else
|
96
|
-
numAssertsTested = numAssertsTested + 1
|
97
|
-
endif
|
98
|
-
endif
|
99
|
-
|
100
|
-
! IsFalse assertion
|
101
|
-
numAsserts = numAsserts + 1
|
102
|
-
if (noAssertFailed) then
|
103
|
-
if ( RoeAvg(0.0,0.0).ne.1 ) then
|
104
|
-
print *, " *IsFalse failed* in test RoeAvgZero &
|
105
|
-
&[FluxFunctionsMT.ftk:23]"
|
106
|
-
print *, " ", " RoeAvg(0.0,0.0).ne.1 is not false"
|
107
|
-
print *, ""
|
108
|
-
noAssertFailed = .false.
|
109
|
-
numFailures = numFailures + 1
|
110
|
-
else
|
111
|
-
numAssertsTested = numAssertsTested + 1
|
112
|
-
endif
|
113
|
-
endif
|
114
|
-
|
115
|
-
numTests = numTests + 1
|
116
|
-
|
117
|
-
end subroutine TestRoeAvgZero
|
118
|
-
|
119
|
-
|
120
|
-
subroutine TestRoeAvgKnown
|
121
|
-
|
122
|
-
|
123
|
-
! IsRealEqual assertion
|
124
|
-
numAsserts = numAsserts + 1
|
125
|
-
if (noAssertFailed) then
|
126
|
-
if (.not.( RoeAvg(leftState+2*spacing(real( RoeAvg(leftState)).ge.rightState), 0.5 &
|
127
|
-
.and. RoeAvg(leftState-2*spacing(real( RoeAvg(leftState)).le.rightState), 0.5 )) then
|
128
|
-
print *, " *IsRealEqual failed* in test RoeAvgKnown &
|
129
|
-
&[FluxFunctionsMT.ftk:27]"
|
130
|
-
print *, " ", "rightState), 0.5 (",rightState), 0.5 ,") is not", RoeAvg(leftState,"within",2*spacing(real( RoeAvg(leftState))
|
131
|
-
print *, ""
|
132
|
-
noAssertFailed = .false.
|
133
|
-
numFailures = numFailures + 1
|
134
|
-
else
|
135
|
-
numAssertsTested = numAssertsTested + 1
|
136
|
-
endif
|
137
|
-
endif
|
138
|
-
|
139
|
-
! IsTrue assertion
|
140
|
-
numAsserts = numAsserts + 1
|
141
|
-
if (noAssertFailed) then
|
142
|
-
if (.not.( RoeAvg(leftState,rightState).lt.0 )) then
|
143
|
-
print *, " *IsTrue failed* in test RoeAvgKnown &
|
144
|
-
&[FluxFunctionsMT.ftk:28]"
|
145
|
-
print *, " ", " RoeAvg(leftState,rightState).lt.0 is not true"
|
146
|
-
print *, ""
|
147
|
-
noAssertFailed = .false.
|
148
|
-
numFailures = numFailures + 1
|
149
|
-
else
|
150
|
-
numAssertsTested = numAssertsTested + 1
|
151
|
-
endif
|
152
|
-
endif
|
153
|
-
|
154
|
-
numTests = numTests + 1
|
155
|
-
|
156
|
-
end subroutine TestRoeAvgKnown
|
157
|
-
|
158
|
-
|
159
|
-
subroutine TestCentralFluxKnown
|
160
|
-
|
161
|
-
call CentralFlux( leftState, rightState, interfaceFlux )
|
162
|
-
|
163
|
-
! IsEqualWithin assertion
|
164
|
-
numAsserts = numAsserts + 1
|
165
|
-
if (noAssertFailed) then
|
166
|
-
if (.not.( 0.5+ 0.001 .ge. interfaceFlux &
|
167
|
-
.and. 0.5- 0.001 .le. interfaceFlux)) then
|
168
|
-
print *, " *IsEqualWithin failed* in test CentralFluxKnown &
|
169
|
-
&[FluxFunctionsMT.ftk:33]"
|
170
|
-
print *, " ", " interfaceFlux (", interfaceFlux,") is not", 0.5,"within", 0.001
|
171
|
-
print *, ""
|
172
|
-
noAssertFailed = .false.
|
173
|
-
numFailures = numFailures + 1
|
174
|
-
else
|
175
|
-
numAssertsTested = numAssertsTested + 1
|
176
|
-
endif
|
177
|
-
endif
|
178
|
-
|
179
|
-
! IsEqualWithin assertion
|
180
|
-
numAsserts = numAsserts + 1
|
181
|
-
if (noAssertFailed) then
|
182
|
-
if (.not.( 0.5+ 0.00000001 .ge. interfaceFlux &
|
183
|
-
.and. 0.5- 0.00000001 .le. interfaceFlux)) then
|
184
|
-
print *, " *IsEqualWithin failed* in test CentralFluxKnown &
|
185
|
-
&[FluxFunctionsMT.ftk:34]"
|
186
|
-
print *, " ", " interfaceFlux (", interfaceFlux,") is not", 0.5,"within", 0.00000001
|
187
|
-
print *, ""
|
188
|
-
noAssertFailed = .false.
|
189
|
-
numFailures = numFailures + 1
|
190
|
-
else
|
191
|
-
numAssertsTested = numAssertsTested + 1
|
192
|
-
endif
|
193
|
-
endif
|
194
|
-
|
195
|
-
! IsEqual assertion
|
196
|
-
numAsserts = numAsserts + 1
|
197
|
-
if (noAssertFailed) then
|
198
|
-
if (.not.( interfaceFlux== 0.5 )) then
|
199
|
-
print *, " *IsEqual failed* in test CentralFluxKnown &
|
200
|
-
&[FluxFunctionsMT.ftk:35]"
|
201
|
-
print *, " ", " interfaceFlux (", interfaceFlux,") is not", 0.5
|
202
|
-
print *, ""
|
203
|
-
noAssertFailed = .false.
|
204
|
-
numFailures = numFailures + 1
|
205
|
-
else
|
206
|
-
numAssertsTested = numAssertsTested + 1
|
207
|
-
endif
|
208
|
-
endif
|
209
|
-
|
210
|
-
numTests = numTests + 1
|
211
|
-
|
212
|
-
end subroutine TestCentralFluxKnown
|
213
|
-
|
214
|
-
|
215
|
-
subroutine TestRoeFluxExpansionShock
|
216
|
-
|
217
|
-
leftState = -1
|
218
|
-
call RoeFlux( leftState, rightState, interfaceFlux )
|
219
|
-
|
220
|
-
! IsEqual assertion
|
221
|
-
numAsserts = numAsserts + 1
|
222
|
-
if (noAssertFailed) then
|
223
|
-
if (.not.( interfaceFlux== 0 )) then
|
224
|
-
print *, " *IsEqual failed* in test RoeFluxExpansionShock &
|
225
|
-
&[FluxFunctionsMT.ftk:41]"
|
226
|
-
print *, " ", " interfaceFlux (", interfaceFlux,") is not", 0
|
227
|
-
print *, ""
|
228
|
-
noAssertFailed = .false.
|
229
|
-
numFailures = numFailures + 1
|
230
|
-
else
|
231
|
-
numAssertsTested = numAssertsTested + 1
|
232
|
-
endif
|
233
|
-
endif
|
234
|
-
|
235
|
-
numTests = numTests + 1
|
236
|
-
|
237
|
-
end subroutine TestRoeFluxExpansionShock
|
238
|
-
|
239
|
-
|
240
|
-
subroutine TestRoeFluxZero
|
241
|
-
|
242
|
-
rightState = 0
|
243
|
-
call RoeFlux( leftState, rightState, interfaceFlux )
|
244
|
-
|
245
|
-
! IsRealEqual assertion
|
246
|
-
numAsserts = numAsserts + 1
|
247
|
-
if (noAssertFailed) then
|
248
|
-
if (.not.( interfaceFlux+2*spacing(real( interfaceFlux)).ge. 0 &
|
249
|
-
.and. interfaceFlux-2*spacing(real( interfaceFlux)).le. 0 )) then
|
250
|
-
print *, " *IsRealEqual failed* in test RoeFluxZero &
|
251
|
-
&[FluxFunctionsMT.ftk:47]"
|
252
|
-
print *, " ", " 0 (", 0 ,") is not", interfaceFlux,"within",2*spacing(real( interfaceFlux))
|
253
|
-
print *, ""
|
254
|
-
noAssertFailed = .false.
|
255
|
-
numFailures = numFailures + 1
|
256
|
-
else
|
257
|
-
numAssertsTested = numAssertsTested + 1
|
258
|
-
endif
|
259
|
-
endif
|
260
|
-
|
261
|
-
! IsEqual assertion
|
262
|
-
numAsserts = numAsserts + 1
|
263
|
-
if (noAssertFailed) then
|
264
|
-
if (.not.( interfaceFlux== 0 )) then
|
265
|
-
print *, " *IsEqual failed* in test RoeFluxZero &
|
266
|
-
&[FluxFunctionsMT.ftk:48]"
|
267
|
-
print *, " ", " interfaceFlux (", interfaceFlux,") is not", 0
|
268
|
-
print *, ""
|
269
|
-
noAssertFailed = .false.
|
270
|
-
numFailures = numFailures + 1
|
271
|
-
else
|
272
|
-
numAssertsTested = numAssertsTested + 1
|
273
|
-
endif
|
274
|
-
endif
|
275
|
-
|
276
|
-
numTests = numTests + 1
|
277
|
-
|
278
|
-
end subroutine TestRoeFluxZero
|
279
|
-
|
280
|
-
|
281
|
-
subroutine Setup
|
282
|
-
leftState = 0
|
283
|
-
rightState = 1
|
284
|
-
noAssertFailed = .true.
|
285
|
-
end subroutine Setup
|
286
|
-
|
287
|
-
|
288
|
-
subroutine Teardown
|
289
|
-
end subroutine Teardown
|
290
|
-
|
291
|
-
|
292
|
-
subroutine MTFluxFunctions( nTests, nAsserts, nAssertsTested, nFailures )
|
293
|
-
|
294
|
-
integer :: nTests
|
295
|
-
integer :: nAsserts
|
296
|
-
integer :: nAssertsTested
|
297
|
-
integer :: nFailures
|
298
|
-
|
299
|
-
continue
|
300
|
-
|
301
|
-
call Setup
|
302
|
-
call TestFluxZero
|
303
|
-
call Teardown
|
304
|
-
|
305
|
-
call Setup
|
306
|
-
call TestFluxOne
|
307
|
-
call Teardown
|
308
|
-
|
309
|
-
call Setup
|
310
|
-
call TestRoeAvgZero
|
311
|
-
call Teardown
|
312
|
-
|
313
|
-
call Setup
|
314
|
-
call TestRoeAvgKnown
|
315
|
-
call Teardown
|
316
|
-
|
317
|
-
call Setup
|
318
|
-
call TestCentralFluxKnown
|
319
|
-
call Teardown
|
320
|
-
|
321
|
-
call Setup
|
322
|
-
call TestRoeFluxExpansionShock
|
323
|
-
call Teardown
|
324
|
-
|
325
|
-
call Setup
|
326
|
-
call TestRoeFluxZero
|
327
|
-
call Teardown
|
328
|
-
|
329
|
-
nTests = numTests
|
330
|
-
nAsserts = numAsserts
|
331
|
-
nAssertsTested = numAssertsTested
|
332
|
-
nFailures = numFailures
|
333
|
-
|
334
|
-
end subroutine MTFluxFunctions
|
335
|
-
|
336
|
-
end module FluxFunctionsMT
|