rufus-decision 0.9 → 1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,15 +13,15 @@ require 'dmixin'
13
13
 
14
14
 
15
15
  class DecisionTest < Test::Unit::TestCase
16
- include DecisionTestMixin
16
+ include DecisionTestMixin
17
17
 
18
- #def setup
19
- #end
18
+ #def setup
19
+ #end
20
20
 
21
- #def teardown
22
- #end
21
+ #def teardown
22
+ #end
23
23
 
24
- CSV1 = \
24
+ CSV1 = \
25
25
  """
26
26
  ,,
27
27
  in:fx,in:fy,out:fz
@@ -32,38 +32,38 @@ e,f,${r:3+4}
32
32
  g,h,${r:'${fx}' + '${fy}'}
33
33
  """
34
34
 
35
- def test_1
36
-
37
- wi = {
38
- "fx" => "c",
39
- "fy" => "d"
40
- }
41
- do_test(CSV1, wi, {}, { "fz" => "c" }, false)
42
-
43
- wi = {
44
- "fx" => "a",
45
- "fy" => "a"
46
- }
47
- do_test(CSV1, wi, {}, { "fz" => "0" }, false)
48
- end
49
-
50
- def test_1b
51
-
52
- h = {
53
- "fx" => "e",
54
- "fy" => "f"
55
- }
56
- do_test(CSV1, h, { :ruby_eval => true }, { "fz" => "7" }, false)
57
- end
58
-
59
- def test_1c
60
-
61
- h = {
62
- "fx" => "g",
63
- "fy" => "h"
64
- }
65
- do_test(CSV1, h, { :ruby_eval => true }, { "fz" => "gh" }, false)
66
- end
35
+ def test_1
36
+
37
+ wi = {
38
+ "fx" => "c",
39
+ "fy" => "d"
40
+ }
41
+ do_test(CSV1, wi, {}, { "fz" => "c" }, false)
42
+
43
+ wi = {
44
+ "fx" => "a",
45
+ "fy" => "a"
46
+ }
47
+ do_test(CSV1, wi, {}, { "fz" => "0" }, false)
48
+ end
49
+
50
+ def test_1b
51
+
52
+ h = {
53
+ "fx" => "e",
54
+ "fy" => "f"
55
+ }
56
+ do_test(CSV1, h, { :ruby_eval => true }, { "fz" => "7" }, false)
57
+ end
58
+
59
+ def test_1c
60
+
61
+ h = {
62
+ "fx" => "g",
63
+ "fy" => "h"
64
+ }
65
+ do_test(CSV1, h, { :ruby_eval => true }, { "fz" => "gh" }, false)
66
+ end
67
67
 
68
68
  end
69
69
 
data/test/dmixin.rb CHANGED
@@ -12,44 +12,44 @@ require 'rufus/decision'
12
12
 
13
13
  module DecisionTestMixin
14
14
 
15
- protected
15
+ protected
16
16
 
17
- def do_test (table_data, h, options, expected_result, verbose=false)
17
+ def do_test (table_data, h, options, expected_result, verbose=false)
18
18
 
19
- table = Rufus::DecisionTable.new table_data
19
+ table = Rufus::DecisionTable.new table_data
20
20
 
21
- if verbose
22
- puts
23
- puts "table :"
24
- puts table.to_csv
25
- puts
26
- puts "before :"
27
- puts wi
28
- end
21
+ if verbose
22
+ puts
23
+ puts "table :"
24
+ puts table.to_csv
25
+ puts
26
+ puts "before :"
27
+ puts wi
28
+ end
29
29
 
30
- h = table.transform! h, options
30
+ h = table.transform! h, options
31
31
 
32
- if verbose
33
- puts
34
- puts "after :"
35
- puts h
36
- end
32
+ if verbose
33
+ puts
34
+ puts "after :"
35
+ puts h
36
+ end
37
37
 
38
- expected_result.each do |k, v|
38
+ expected_result.each do |k, v|
39
39
 
40
- #if wi.attributes[k] != v
41
- #end
40
+ #if wi.attributes[k] != v
41
+ #end
42
42
 
43
- value = h[k]
43
+ value = h[k]
44
44
 
45
- value = value.join(';') if value.is_a?(Array)
45
+ value = value.join(';') if value.is_a?(Array)
46
46
 
47
- assert \
48
- value == v,
49
- "attribute '#{k}' should be set to '#{v}' "+
50
- "but is set to '#{value}'"
51
- end
52
- end
47
+ assert \
48
+ value == v,
49
+ "attribute '#{k}' should be set to '#{v}' "+
50
+ "but is set to '#{value}'"
51
+ end
52
+ end
53
53
 
54
54
  end
55
55
 
data/test/eval_test.rb CHANGED
@@ -16,21 +16,21 @@ require 'rufus/hashes'
16
16
 
17
17
  class EvalTest < Test::Unit::TestCase
18
18
 
19
- #def setup
20
- #end
19
+ #def setup
20
+ #end
21
21
 
22
- #def teardown
23
- #end
22
+ #def teardown
23
+ #end
24
24
 
25
- def test_0
25
+ def test_0
26
26
 
27
- eh = Rufus::EvalHashFilter.new({}, 0)
27
+ eh = Rufus::EvalHashFilter.new({})
28
28
 
29
- eh['a'] = :a
30
- eh['b'] = "r:5 * 5"
29
+ eh['a'] = :a
30
+ eh['b'] = "r:5 * 5"
31
31
 
32
- assert_equal :a, eh['a']
33
- assert_equal 25, eh['b']
34
- assert_equal 72, eh['r:36+36']
35
- end
32
+ assert_equal :a, eh['a']
33
+ assert_equal 25, eh['b']
34
+ assert_equal 72, eh['r:36+36']
35
+ end
36
36
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rufus-decision
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.9"
4
+ version: "1.0"
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Mettraux
@@ -9,11 +9,12 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-01-28 00:00:00 +09:00
12
+ date: 2008-09-03 00:00:00 +09:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rufus-dollar
17
+ type: :runtime
17
18
  version_requirement:
18
19
  version_requirements: !ruby/object:Gem::Requirement
19
20
  requirements:
@@ -22,7 +23,8 @@ dependencies:
22
23
  version: "0"
23
24
  version:
24
25
  - !ruby/object:Gem::Dependency
25
- name: rufus-eval
26
+ name: rufus-treechecker
27
+ type: :runtime
26
28
  version_requirement:
27
29
  version_requirements: !ruby/object:Gem::Requirement
28
30
  requirements:
@@ -38,16 +40,21 @@ extensions: []
38
40
 
39
41
  extra_rdoc_files:
40
42
  - README.txt
43
+ - CHANGELOG.txt
44
+ - CREDITS.txt
41
45
  files:
42
46
  - lib/rufus
43
47
  - lib/rufus/decision.rb
44
48
  - lib/rufus/hashes.rb
49
+ - lib/rufus-decision.rb
45
50
  - test/decision_0_test.rb
46
51
  - test/decision_1_test.rb
47
52
  - test/dmixin.rb
48
53
  - test/eval_test.rb
49
54
  - test/test.rb
50
55
  - README.txt
56
+ - CHANGELOG.txt
57
+ - CREDITS.txt
51
58
  has_rdoc: true
52
59
  homepage: http://rufus.rubyforge.org/rufus-decision
53
60
  post_install_message:
@@ -69,9 +76,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
69
76
  version:
70
77
  requirements:
71
78
  - rufus-dollar
72
- - rufus-eval
73
- rubyforge_project:
74
- rubygems_version: 0.9.5
79
+ - rufus-treechecker
80
+ rubyforge_project: rufus
81
+ rubygems_version: 1.2.0
75
82
  signing_key:
76
83
  specification_version: 2
77
84
  summary: CSV based Ruby decision tables