loose_tight_dictionary 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/loose_tight_dictionary.rb +18 -18
- data/test/test_loose_tight_dictionary.rb +14 -0
- metadata +3 -3
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.0.
|
|
1
|
+
0.0.5
|
|
@@ -82,26 +82,26 @@ class LooseTightDictionary
|
|
|
82
82
|
left = read_left left_record
|
|
83
83
|
right = read_right right_record
|
|
84
84
|
|
|
85
|
-
if
|
|
86
|
-
correct_right =
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
incorrect_right = :ignore
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
if correct_right != :ignore and right != correct_right
|
|
98
|
-
logger.andand.debug " Mismatch! (should be #{correct_right})"
|
|
99
|
-
raise Mismatch
|
|
85
|
+
if positive_record = positives.andand.detect { |record| record[0] == left }
|
|
86
|
+
correct_right = positive_record[1]
|
|
87
|
+
if correct_right.blank? and right.present?
|
|
88
|
+
logger.andand.debug " Mismatch! (should match SOMETHING)"
|
|
89
|
+
raise Mismatch
|
|
90
|
+
elsif right != correct_right
|
|
91
|
+
logger.andand.debug " Mismatch! (should be #{correct_right})"
|
|
92
|
+
raise Mismatch
|
|
93
|
+
end
|
|
100
94
|
end
|
|
101
95
|
|
|
102
|
-
if
|
|
103
|
-
|
|
104
|
-
|
|
96
|
+
if negative_record = negatives.andand.detect { |record| record[0] == left }
|
|
97
|
+
incorrect_right = negative_record[1]
|
|
98
|
+
if incorrect_right.blank? and right.present?
|
|
99
|
+
logger.andand.debug " False positive! (should NOT match ANYTHING)"
|
|
100
|
+
raise FalsePositive
|
|
101
|
+
elsif right == incorrect_right
|
|
102
|
+
logger.andand.debug " False positive! (should NOT be #{incorrect_right})"
|
|
103
|
+
raise FalsePositive
|
|
104
|
+
end
|
|
105
105
|
end
|
|
106
106
|
end
|
|
107
107
|
|
|
@@ -68,6 +68,20 @@ class TestLooseTightDictionary < Test::Unit::TestCase
|
|
|
68
68
|
end
|
|
69
69
|
|
|
70
70
|
if ENV['OLD'] == 'true' or ENV['ALL'] == 'true'
|
|
71
|
+
should "call it a mismatch if you hit a blank positive" do
|
|
72
|
+
@positives.push [@a_left[0], '']
|
|
73
|
+
assert_raises(LooseTightDictionary::Mismatch) do
|
|
74
|
+
ltd.left_to_right @a_left
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
should "call it a false positive if you hit a blank negative" do
|
|
79
|
+
@negatives.push [@a_left[0], '']
|
|
80
|
+
assert_raises(LooseTightDictionary::FalsePositive) do
|
|
81
|
+
ltd.left_to_right @a_left
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
71
85
|
should "have a false match without blocking" do
|
|
72
86
|
# @d_left will be our victim
|
|
73
87
|
@right.push @d_lookalike
|
metadata
CHANGED
|
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
|
5
5
|
segments:
|
|
6
6
|
- 0
|
|
7
7
|
- 0
|
|
8
|
-
-
|
|
9
|
-
version: 0.0.
|
|
8
|
+
- 5
|
|
9
|
+
version: 0.0.5
|
|
10
10
|
platform: ruby
|
|
11
11
|
authors:
|
|
12
12
|
- Seamus Abshere
|
|
@@ -14,7 +14,7 @@ autorequire:
|
|
|
14
14
|
bindir: bin
|
|
15
15
|
cert_chain: []
|
|
16
16
|
|
|
17
|
-
date: 2010-
|
|
17
|
+
date: 2010-05-03 00:00:00 -04:00
|
|
18
18
|
default_executable:
|
|
19
19
|
dependencies:
|
|
20
20
|
- !ruby/object:Gem::Dependency
|