logic 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/lib/array.rb ADDED
@@ -0,0 +1,7 @@
1
+ class Array
2
+
3
+ def count
4
+ length
5
+ end
6
+
7
+ end
data/lib/range.rb ADDED
@@ -0,0 +1,7 @@
1
+ class Range
2
+
3
+ def take(n)
4
+ to_a[0,n]
5
+ end
6
+
7
+ end
data/lib/symbol.rb ADDED
@@ -0,0 +1,7 @@
1
+ class Symbol
2
+
3
+ def to_proc
4
+ Proc.new { |obj, *args| obj.send(self, *args) }
5
+ end
6
+
7
+ end
data/lib/truth_table.rb CHANGED
@@ -23,7 +23,7 @@ class TruthTable
23
23
 
24
24
  def mcdc_pairs
25
25
  condition_identifiers.map do |condition_identifier|
26
- "#{condition_identifier} => #{mcdc_pairs_for(condition_identifier)}"
26
+ "#{condition_identifier} => #{mcdc_pairs_for(condition_identifier).inspect}"
27
27
  end
28
28
  end
29
29
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 3
9
- version: 0.0.3
8
+ - 4
9
+ version: 0.0.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Bryan Ash
@@ -55,21 +55,20 @@ extra_rdoc_files:
55
55
  - LICENSE
56
56
  - README.rdoc
57
57
  files:
58
- - bin/logic
59
- - features/mcdc_pairs.feature
60
- - features/step_definitions/logic_testing_steps.rb
61
- - features/support/env.rb
62
- - features/truth_table.feature
58
+ - lib/array.rb
63
59
  - lib/integer.rb
64
60
  - lib/logic_operations.rb
65
- - lib/logic_parser.treetop
61
+ - lib/range.rb
62
+ - lib/symbol.rb
66
63
  - lib/test_case.rb
67
64
  - lib/truth_table.rb
68
- - LICENSE
69
- - README.rdoc
65
+ - lib/logic_parser.treetop
66
+ - bin/logic
70
67
  - spec/logic_parser_spec.rb
71
68
  - spec/spec.opts
72
69
  - spec/truth_table_spec.rb
70
+ - LICENSE
71
+ - README.rdoc
73
72
  has_rdoc: true
74
73
  homepage: http://github.com/bryan-ash/logic
75
74
  licenses: []
@@ -1,37 +0,0 @@
1
- Feature: MC/DC Pairs
2
-
3
- In order to reduce the number of tests required for a logic statment
4
- as an engineer
5
- I want to see the MC/DC test pairs
6
-
7
- Scenario: a single condition
8
- When I run logic mcdc_pairs 'a'
9
- Then I should see:
10
- """
11
- a => [[1, 2]]
12
- """
13
-
14
- Scenario: 'a and b' decision
15
- When I run logic mcdc_pairs 'a and b'
16
- Then I should see:
17
- """
18
- a => [[2, 4]]
19
- b => [[3, 4]]
20
- """
21
-
22
- Scenario: 'a or b' decision
23
- When I run logic mcdc_pairs 'a or b'
24
- Then I should see:
25
- """
26
- a => [[1, 3]]
27
- b => [[1, 2]]
28
- """
29
-
30
- Scenario: 'a and (b or c)' decision
31
- When I run logic mcdc_pairs 'a and (b or c)'
32
- Then I should see:
33
- """
34
- a => [[2, 6], [3, 7], [4, 8]]
35
- b => [[5, 7]]
36
- c => [[5, 6]]
37
- """
@@ -1,3 +0,0 @@
1
- When /^I run (.+) (.+) '(.+)'$/ do |ruby_file, command, decision|
2
- When "I run \"#{APP_PATH}/#{ruby_file} #{command} '#{decision}'\""
3
- end
@@ -1,5 +0,0 @@
1
- APP_PATH = File.expand_path(File.dirname(__FILE__) + '/../../bin/')
2
-
3
- require 'aruba'
4
- require 'fileutils'
5
- require 'spec/expectations'
@@ -1,70 +0,0 @@
1
- Feature: Truth Table
2
-
3
- In order to appreciate the complexity of a logic statement
4
- as an engineer
5
- I want to see the truth table
6
-
7
- Scenario: a single condition
8
- When I run logic truth_table 'a'
9
- Then I should see:
10
- """
11
- a | output
12
- 1) 0 | 0
13
- 2) 1 | 1
14
- """
15
-
16
- Scenario: 'a or b' decision
17
- When I run logic truth_table 'a or b'
18
- Then I should see:
19
- """
20
- a b | output
21
- 1) 0 0 | 0
22
- 2) 0 1 | 1
23
- 3) 1 0 | 1
24
- 4) 1 1 | 1
25
- """
26
-
27
- Scenario: 'a or b or c' decision
28
- When I run logic truth_table 'a or b or c'
29
- Then I should see:
30
- """
31
- a b c | output
32
- 1) 0 0 0 | 0
33
- 2) 0 0 1 | 1
34
- 3) 0 1 0 | 1
35
- 4) 0 1 1 | 1
36
- 5) 1 0 0 | 1
37
- 6) 1 0 1 | 1
38
- 7) 1 1 0 | 1
39
- 8) 1 1 1 | 1
40
- """
41
-
42
- Scenario: 'a and b and c' decision
43
- When I run logic truth_table 'a and b and c'
44
- Then I should see:
45
- """
46
- a b c | output
47
- 1) 0 0 0 | 0
48
- 2) 0 0 1 | 0
49
- 3) 0 1 0 | 0
50
- 4) 0 1 1 | 0
51
- 5) 1 0 0 | 0
52
- 6) 1 0 1 | 0
53
- 7) 1 1 0 | 0
54
- 8) 1 1 1 | 1
55
- """
56
-
57
- Scenario: '(a and b) or c' decision
58
- When I run logic truth_table '(a and b) or c'
59
- Then I should see:
60
- """
61
- a b c | output
62
- 1) 0 0 0 | 0
63
- 2) 0 0 1 | 1
64
- 3) 0 1 0 | 0
65
- 4) 0 1 1 | 1
66
- 5) 1 0 0 | 0
67
- 6) 1 0 1 | 1
68
- 7) 1 1 0 | 1
69
- 8) 1 1 1 | 1
70
- """