forked from zerebubuth/openstreetmap-license-change
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_abbrev.rb
29 lines (25 loc) · 946 Bytes
/
test_abbrev.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
require './change_bot'
require './user'
require './changeset'
require './db'
require './actions'
require './util.rb'
require './abbreviations.rb'
require 'test/unit'
class TestAbbrev < Test::Unit::TestCase
# test that some strings are the same under abbreviation,
# even when there's differing whitespace or punctuation
# involved.
def test_abbrev
check_abbrev_equality("Foobar Rd", "Foobar Road")
check_abbrev_equality("Foobar Road", "Foobar Rd")
check_abbrev_equality("E Foobar Wy", "East Foobar Way")
check_abbrev_equality("NE Foobar Crescent", "North East Foobar Cr.")
check_abbrev_equality("N.E. Foobar Crescent", "North East Foobar Cr")
end
private
# utility func to make output from failed tests more useful
def check_abbrev_equality(a, b)
assert_equal(true, Abbrev.equal_expansions(a, b), "Expecting #{a.inspect} to equal #{b.inspect} under abbreviation/expansion, but it doesn't.")
end
end