Skip to content

Commit 9c0cabe

Browse files
committed
Modifying the unit test for CODEC-57 to test for empty string, and added a note to the Metaphone javadoc that it does not match the PHP or Perl variants
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/codec/trunk@651873 13f79535-47bb-0310-9956-ffa450edef68
1 parent 292322e commit 9c0cabe

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

src/java/org/apache/commons/codec/language/Metaphone.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@
3030
* <CITE>Hanging on the Metaphone</CITE> by <CITE>Lawrence Philips</CITE> in <CITE>Computer Language of Dec. 1990, p
3131
* 39.</CITE>
3232
* </p>
33+
* <p>
34+
* Note, that this does not match the algorithm that ships with PHP, or the algorithm
35+
* found in the Perl <a href="http://search.cpan.org/~mschwern/Text-Metaphone-1.96/Metaphone.pm">Text:Metaphone-1.96</a>.
36+
* They have had undocumented changes from the originally published algorithm.
37+
* </p>
3338
*
3439
* @author Apache Software Foundation
3540
* @version $Id$

src/test/org/apache/commons/codec/language/MetaphoneTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,8 @@ public void testDiscardOfSCEOrSCIOrSCY() {
406406
* Tests (CODEC-57) Metaphone.metaphone(String) returns an empty string when passed the word "why"
407407
*/
408408
public void testWhy() {
409-
assertEquals("H", this.getMetaphone().metaphone("WHY"));
409+
// PHP returns "H". The original metaphone returns an empty string.
410+
assertEquals("", this.getMetaphone().metaphone("WHY"));
410411
}
411412

412413
public void testWordsWithCIA() {

0 commit comments

Comments
 (0)