equal
deleted
inserted
replaced
15 |
15 |
16 !DoubleMetaphoneStringComparatorTest methodsFor:'running'! |
16 !DoubleMetaphoneStringComparatorTest methodsFor:'running'! |
17 |
17 |
18 setUp |
18 setUp |
19 |
19 |
20 dmsc := PhoneticStringUtilities::DoubleMetaphoneStringComparator new |
20 dmsc := PhoneticStringUtilities::DoubleMetaphoneStringComparator new |
21 ! ! |
21 ! ! |
22 |
22 |
23 !DoubleMetaphoneStringComparatorTest methodsFor:'tests'! |
23 !DoubleMetaphoneStringComparatorTest methodsFor:'tests'! |
24 |
24 |
25 testKeyMidStringFrom |
25 testKeyMidStringFrom |
97 self should: [ dmsc secondaryTranslation = 'A' ]. |
97 self should: [ dmsc secondaryTranslation = 'A' ]. |
98 self should: [ (dmsc inputKey at: dmsc startIndex) = $T ]. |
98 self should: [ (dmsc inputKey at: dmsc startIndex) = $T ]. |
99 ! |
99 ! |
100 |
100 |
101 testProcessB1 |
101 testProcessB1 |
102 dmsc inputKey: 'b'. |
102 dmsc inputKey: 'b'. |
103 self should: [ dmsc inputKey = 'B' ]. |
103 self should: [ dmsc inputKey = 'B' ]. |
104 |
104 |
105 self should: [ dmsc primaryTranslation = '' ]. |
105 self should: [ dmsc primaryTranslation = '' ]. |
106 self should: [ dmsc secondaryTranslation = '' ]. |
106 self should: [ dmsc secondaryTranslation = '' ]. |
107 self should: [ dmsc skipCount = 0 ]. |
107 self should: [ dmsc skipCount = 0 ]. |
108 |
108 |
109 dmsc processB. |
109 dmsc processB. |
110 |
110 |
111 self should: [ dmsc primaryTranslation = 'P' ]. |
111 self should: [ dmsc primaryTranslation = 'P' ]. |
112 self should: [ dmsc secondaryTranslation = 'P' ]. |
112 self should: [ dmsc secondaryTranslation = 'P' ]. |
113 self should: [ dmsc skipCount = 0 ] |
113 self should: [ dmsc skipCount = 0 ] |
114 ! |
114 ! |
115 |
115 |
116 testProcessB2 |
116 testProcessB2 |
117 dmsc inputKey: 'bb'. |
117 dmsc inputKey: 'bb'. |
118 self should: [ dmsc inputKey = 'BB' ]. |
118 self should: [ dmsc inputKey = 'BB' ]. |
1469 self should: [ dmsc secondaryTranslation = 'N' ]. |
1469 self should: [ dmsc secondaryTranslation = 'N' ]. |
1470 self should: [ dmsc skipCount = 1 ]. |
1470 self should: [ dmsc skipCount = 1 ]. |
1471 ! |
1471 ! |
1472 |
1472 |
1473 testProcessNtilde |
1473 testProcessNtilde |
1474 dmsc inputKey: 'Naa'. |
1474 dmsc inputKey: 'Naa'. |
1475 self should: [ dmsc inputKey = 'NAA' ]. |
1475 self should: [ dmsc inputKey = 'NAA' ]. |
1476 |
1476 |
1477 self should: [ dmsc primaryTranslation = '' ]. |
1477 self should: [ dmsc primaryTranslation = '' ]. |
1478 self should: [ dmsc secondaryTranslation = '' ]. |
1478 self should: [ dmsc secondaryTranslation = '' ]. |
1479 self should: [ dmsc skipCount = 0 ]. |
1479 self should: [ dmsc skipCount = 0 ]. |
1480 dmsc currentIndex: 3. |
1480 dmsc currentIndex: 3. |
1481 |
1481 |
1482 dmsc processNtilde. |
1482 dmsc processNtilde. |
1483 |
1483 |
1484 self should: [ dmsc primaryTranslation = 'N' ]. |
1484 self should: [ dmsc primaryTranslation = 'N' ]. |
1485 self should: [ dmsc secondaryTranslation = 'N' ]. |
1485 self should: [ dmsc secondaryTranslation = 'N' ]. |
1486 self should: [ dmsc skipCount = 0 ]. |
1486 self should: [ dmsc skipCount = 0 ]. |
1487 ! |
1487 ! |
1488 |
1488 |
1489 testProcessP |
1489 testProcessP |
1490 dmsc inputKey: 'phone'. |
1490 dmsc inputKey: 'phone'. |
1491 self should: [ dmsc inputKey = 'PHONE' ]. |
1491 self should: [ dmsc inputKey = 'PHONE' ]. |