--- a/RegressionTests__KoelnerPhoneticCodeStringComparatorTest.st Fri Jul 28 09:45:10 2017 +0200
+++ b/RegressionTests__KoelnerPhoneticCodeStringComparatorTest.st Fri Jul 28 09:45:17 2017 +0200
@@ -18,24 +18,28 @@
!KoelnerPhoneticCodeStringComparatorTest methodsFor:'tests'!
-testSomeCombinations
+test01_SomeCombinations
|code s|
- "/ compares all 4-char combinations against
+ self skip:'this test does not really test anything (except if all 4-char string combinations can be soundexed)'.
+
+ "/ compares all 4-char combinations against what?
$A to:$Z do:[:c1 |
- $A to:$Z do:[:c2 |
- $A to:$Z do:[:c3 |
- $A to:$Z do:[:c4 |
- s := String with:c1 with:c2 with:c3 with:c4.
- code := (sc phoneticStringsFor:s) first.
- self assert:( code = s asKoelnerPhoneticCode).
- ].
- ].
- ].
+ $A to:$Z do:[:c2 |
+ $A to:$Z do:[:c3 |
+ $A to:$Z do:[:c4 |
+ s := String with:c1 with:c2 with:c3 with:c4.
+ code := (sc phoneticStringsFor:s) first.
+ self assert:( code = s asKoelnerPhoneticCode).
+ ].
+ ].
+ ].
].
+
+ "Created: / 28-07-2017 / 09:21:39 / cg"
!
-testWellKnownResults
+test02_WellKnownResults
|code koeln|
koeln := [:w | (sc phoneticStringsFor:w) first].
@@ -45,20 +49,20 @@
#( 'Acton' 'Ashdown' 'Ashton' 'Astin' 'Aston' 'Austen' 'Austin' 'Austine' 'Axten')
do:[:w |
- code := koeln value:(w).
- self assert:( code = (w asKoelnerPhoneticCode)).
+ code := koeln value:(w).
+ self assert:( code = (w asKoelnerPhoneticCode)).
].
#( 'Reader' 'Reeder' 'Rider' 'Ritter' 'Rothera' 'Rothra' 'Ruder' 'Rutter' 'Ryder')
do:[:w |
- code := koeln value:(w).
- self assert:( code = (w asKoelnerPhoneticCode)).
+ code := koeln value:(w).
+ self assert:( code = (w asKoelnerPhoneticCode)).
].
#( 'Wace' 'Waugh' 'Wookey')
do:[:w |
- code := koeln value:(w).
- self assert:( code = (w asKoelnerPhoneticCode)).
+ code := koeln value:(w).
+ self assert:( code = (w asKoelnerPhoneticCode)).
].
code := koeln value:('Abbot').
@@ -110,6 +114,84 @@
self assert: ( koeln value:( 'L' )) = ('L' asKoelnerPhoneticCode).
self assert: ( koeln value:( 'MN' )) = ('MN' asKoelnerPhoneticCode).
self assert: ( koeln value:( 'R' )) = ('R' asKoelnerPhoneticCode).
+
+ "Created: / 28-07-2017 / 09:21:47 / cg"
+!
+
+test03_WellKnownResults
+ |code|
+
+ code := PhoneticStringUtilities koelnerPhoneticCodeOf:'Breschnew'.
+ self assert:(code = '17863').
+
+ "/ these all sound similar - so they should get the same code
+ #(
+ 'Breschnew'
+ 'Breschneff'
+ 'Braeschneff'
+ 'Braessneff'
+ 'Pressneff'
+ 'Presznäph'
+ 'Präschnäf'
+ ) do:[:each |
+ self assert:((PhoneticStringUtilities koelnerPhoneticCodeOf:each) = '17863').
+ ].
+
+ "/ these all sound similar - so they should get the same code
+ #(
+ 'müller'
+ 'möller'
+ 'miller'
+ 'muller'
+ 'muler'
+ ) do:[:each |
+ self assert:((PhoneticStringUtilities koelnerPhoneticCodeOf:each) = '657').
+ ].
+
+ "/ these all sound similar - so they should get the same code
+ #(
+ 'schmidt'
+ 'schmid'
+ 'schmit'
+ 'schmidtt'
+ 'schmidd'
+ ) do:[:each |
+ self assert:((PhoneticStringUtilities koelnerPhoneticCodeOf:each) = '862').
+ ].
+
+ self assert:((PhoneticStringUtilities koelnerPhoneticCodeOf:'schneider') = '8627').
+ self assert:((PhoneticStringUtilities koelnerPhoneticCodeOf:'sneider') = '8627').
+ self assert:((PhoneticStringUtilities koelnerPhoneticCodeOf:'shneider') = '8627').
+
+ self assert:((PhoneticStringUtilities koelnerPhoneticCodeOf:'fischer') = '387').
+ self assert:((PhoneticStringUtilities koelnerPhoneticCodeOf:'weber') = '317').
+ self assert:((PhoneticStringUtilities koelnerPhoneticCodeOf:'webber') = '317').
+ self assert:((PhoneticStringUtilities koelnerPhoneticCodeOf:'weeber') = '317').
+ self assert:((PhoneticStringUtilities koelnerPhoneticCodeOf:'wehber') = '317').
+
+ self assert:((PhoneticStringUtilities koelnerPhoneticCodeOf:'meyer') = '67').
+ self assert:((PhoneticStringUtilities koelnerPhoneticCodeOf:'mayer') = '67').
+ self assert:((PhoneticStringUtilities koelnerPhoneticCodeOf:'meier') = '67').
+ self assert:((PhoneticStringUtilities koelnerPhoneticCodeOf:'maier') = '67').
+
+ self assert:((PhoneticStringUtilities koelnerPhoneticCodeOf:'wagner') = '3467').
+ self assert:((PhoneticStringUtilities koelnerPhoneticCodeOf:'vagner') = '3467').
+
+ self assert:((PhoneticStringUtilities koelnerPhoneticCodeOf:'schulz') = '858').
+ self assert:((PhoneticStringUtilities koelnerPhoneticCodeOf:'schultz') = '858').
+ self assert:((PhoneticStringUtilities koelnerPhoneticCodeOf:'schults') = '858').
+
+ self assert:((PhoneticStringUtilities koelnerPhoneticCodeOf:'becker') = '147').
+ self assert:((PhoneticStringUtilities koelnerPhoneticCodeOf:'hoffmann') = '036').
+ self assert:((PhoneticStringUtilities koelnerPhoneticCodeOf:'hofmann') = '036').
+ self assert:((PhoneticStringUtilities koelnerPhoneticCodeOf:'hovmann') = '036').
+ self assert:((PhoneticStringUtilities koelnerPhoneticCodeOf:'hovman') = '036').
+ self assert:((PhoneticStringUtilities koelnerPhoneticCodeOf:'schäfer') = '837').
+ self assert:((PhoneticStringUtilities koelnerPhoneticCodeOf:'schäffer') = '837').
+ self assert:((PhoneticStringUtilities koelnerPhoneticCodeOf:'schaeffer') = '837').
+ self assert:((PhoneticStringUtilities koelnerPhoneticCodeOf:'schaefer') = '837').
+
+ "Created: / 28-07-2017 / 09:36:16 / cg"
! !
!KoelnerPhoneticCodeStringComparatorTest class methodsFor:'documentation'!