logic 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/logic_operations.rb +3 -3
- data/lib/range.rb +2 -2
- data/lib/test_case.rb +4 -0
- data/lib/truth_table.rb +2 -3
- metadata +2 -2
data/lib/logic_operations.rb
CHANGED
@@ -45,9 +45,9 @@ module Decision
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def evaluate(conditions)
|
48
|
-
|
49
|
-
|
50
|
-
operator.apply(
|
48
|
+
left = operand_1.evaluate(conditions)
|
49
|
+
right = operand_2.evaluate(conditions)
|
50
|
+
operator.apply(left, right)
|
51
51
|
end
|
52
52
|
|
53
53
|
end
|
data/lib/range.rb
CHANGED
data/lib/test_case.rb
CHANGED
data/lib/truth_table.rb
CHANGED
@@ -9,13 +9,12 @@ class TruthTable
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def header
|
12
|
-
|
13
|
-
"#{conditions.rjust(conditions.length + 4)} | output\n"
|
12
|
+
" %s | output\n" % @test_cases.condition_identifiers.join(" ")
|
14
13
|
end
|
15
14
|
|
16
15
|
def formatted_cases
|
17
16
|
@test_cases.inject("") do |output, test_case|
|
18
|
-
output +=
|
17
|
+
output += test_case.formatted("%2d) %s | %3d\n")
|
19
18
|
end
|
20
19
|
end
|
21
20
|
|