logic 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.rdoc +6 -8
  2. data/bin/logic +8 -5
  3. data/lib/truth_table.rb +1 -1
  4. metadata +2 -2
@@ -1,10 +1,14 @@
1
1
  = logic
2
2
 
3
+ == Installation
4
+
5
+ gem install logic
6
+
3
7
  == Usage
4
8
 
5
- Truth tables are easy:
9
+ By default, you get a truth table and a list of MC/DC pairs:
6
10
 
7
- logic truth_table '(a or b) and (c or d)'
11
+ logic '(a or b) and (c or d)'
8
12
 
9
13
  Gives you:
10
14
 
@@ -26,12 +30,6 @@ Gives you:
26
30
  15) 1 1 1 0 | 1
27
31
  16) 1 1 1 1 | 1
28
32
 
29
- MC/DC test case pairs can also be found:
30
-
31
- logic mcdc_pairs '(a or b) and (c or d)'
32
-
33
- Gives you:
34
-
35
33
  a => [[2, 10], [3, 11], [4, 12]]
36
34
  b => [[2, 6], [3, 7], [4, 8]]
37
35
  c => [[5, 7], [9, 11], [13, 15]]
data/bin/logic CHANGED
@@ -7,18 +7,21 @@ require 'treetop'
7
7
  require 'logic_parser'
8
8
  require 'logic_operations'
9
9
 
10
- options = {}
10
+ options = {
11
+ :truth_table => true,
12
+ :mcdc_pairs => true
13
+ }
11
14
 
12
15
  option_parser = OptionParser.new
13
16
 
14
17
  option_parser.banner = "Usage: logic [options] <decision>"
15
18
 
16
- option_parser.on( '-l', '--truth_table', 'Show the truth table for the decision' ) do
17
- options[:truth_table] = true
19
+ option_parser.on( '-l', '--[no-]truth_table', 'Show the truth table for the decision' ) do |option|
20
+ options[:truth_table] = option
18
21
  end
19
22
 
20
- option_parser.on( '-m', '--mcdc_pairs', 'Show MC/DC test case pairs' ) do
21
- options[:mcdc_pairs] = true
23
+ option_parser.on( '-m', '--[no-]mcdc_pairs', 'Show MC/DC test case pairs' ) do |option|
24
+ options[:mcdc_pairs] = option
22
25
  end
23
26
 
24
27
  option_parser.on( '-h', '--help', 'You\'re looking at it' ) do
@@ -5,7 +5,7 @@ class TruthTable
5
5
  end
6
6
 
7
7
  def to_s
8
- header + formatted_cases
8
+ header + formatted_cases + "\n"
9
9
  end
10
10
 
11
11
  def header
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 8
9
- version: 0.0.8
8
+ - 9
9
+ version: 0.0.9
10
10
  platform: ruby
11
11
  authors:
12
12
  - Bryan Ash