logic 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/bin/logic +43 -0
  2. metadata +5 -5
data/bin/logic CHANGED
@@ -6,6 +6,49 @@ require 'treetop'
6
6
  require 'logic_parser'
7
7
  require 'logic_operations'
8
8
 
9
+ if ARGV.length == 0 || ARGV[0] == '--help' || ARGV[0] == '-h'
10
+ puts <<-HELP
11
+ Usage: logic [ truth_table | mcdc_pairs ] "<decision>"'
12
+
13
+ Truth tables are easy:
14
+
15
+ logic truth_table '(a or b) and (c or d)'
16
+
17
+ Gives you:
18
+
19
+ a b c d | output
20
+ 1) 0 0 0 0 | 0
21
+ 2) 0 0 0 1 | 0
22
+ 3) 0 0 1 0 | 0
23
+ 4) 0 0 1 1 | 0
24
+ 5) 0 1 0 0 | 0
25
+ 6) 0 1 0 1 | 1
26
+ 7) 0 1 1 0 | 1
27
+ 8) 0 1 1 1 | 1
28
+ 9) 1 0 0 0 | 0
29
+ 10) 1 0 0 1 | 1
30
+ 11) 1 0 1 0 | 1
31
+ 12) 1 0 1 1 | 1
32
+ 13) 1 1 0 0 | 0
33
+ 14) 1 1 0 1 | 1
34
+ 15) 1 1 1 0 | 1
35
+ 16) 1 1 1 1 | 1
36
+
37
+ MC/DC test case pairs can also be found:
38
+
39
+ logic mcdc_pairs '(a or b) and (c or d)'
40
+
41
+ Gives you:
42
+
43
+ a => [[2, 10], [3, 11], [4, 12]]
44
+ b => [[2, 6], [3, 7], [4, 8]]
45
+ c => [[5, 7], [9, 11], [13, 15]]
46
+ d => [[5, 6], [9, 10], [13, 14]]
47
+
48
+ HELP
49
+ exit 0
50
+ end
51
+
9
52
  parser = LogicParser.new
10
53
  decision = parser.parse ARGV[1]
11
54
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 6
9
- version: 0.0.6
8
+ - 7
9
+ version: 0.0.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - Bryan Ash
@@ -14,8 +14,8 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-08 00:00:00 -04:00
18
- default_executable: logic
17
+ date: 2010-04-27 00:00:00 -04:00
18
+ default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: treetop
@@ -71,7 +71,7 @@ files:
71
71
  - LICENSE
72
72
  - README.rdoc
73
73
  has_rdoc: true
74
- homepage: http://github.com/bryan-ash/logic
74
+ homepage:
75
75
  licenses: []
76
76
 
77
77
  post_install_message: