commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tobr...@apache.org
Subject cvs commit: jakarta-commons-sandbox/codec/src/test/org/apache/commons/codec/language TestMetaphone.java TestRefinedSoundex.java TestSoundex.java
Date Tue, 04 Feb 2003 04:46:01 GMT
tobrien     2003/02/03 20:46:01

  Modified:    codec/src/test/org/apache/commons/codec TestAll.java
  Added:       codec/src/test/org/apache/commons/codec/language
                        TestMetaphone.java TestRefinedSoundex.java
                        TestSoundex.java
  Removed:     codec/src/test/org/apache/commons/codec TestMetaphone.java
                        TestRefinedSoundex.java TestSoundex.java
  Log:
  migrated language tests to language package
  
  Revision  Changes    Path
  1.5       +5 -6      jakarta-commons-sandbox/codec/src/test/org/apache/commons/codec/TestAll.java
  
  Index: TestAll.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/codec/src/test/org/apache/commons/codec/TestAll.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TestAll.java	3 Feb 2003 15:48:14 -0000	1.4
  +++ TestAll.java	4 Feb 2003 04:46:01 -0000	1.5
  @@ -61,8 +61,7 @@
   
   package org.apache.commons.codec;
   
  -import org.apache.commons.codec.language.TestDoubleMetaphone;
  -import org.apache.commons.codec.language.TestNysiis;
  +import org.apache.commons.codec.language.*;
   
   import junit.framework.Test;
   import junit.framework.TestCase;
  
  
  
  1.1                  jakarta-commons-sandbox/codec/src/test/org/apache/commons/codec/language/TestMetaphone.java
  
  Index: TestMetaphone.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/codec/src/test/org/apache/commons/codec/language/TestMetaphone.java,v
1.1 2003/02/04 04:46:01 tobrien Exp $
   * $Revision: 1.1 $
   * $Date: 2003/02/04 04:46:01 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.codec.language;
  
  import junit.framework.Test;
  import junit.framework.TestCase;
  import junit.framework.TestSuite;
  
  import org.apache.commons.codec.Encoder;
  import org.apache.commons.codec.TestEncoder;
  
  /**
   * @version $Revision: 1.1 $ $Date: 2003/02/04 04:46:01 $
   * @author Rodney Waldhoff
   */
  public class TestMetaphone extends TestEncoder {
  
      public TestMetaphone(String name) {
          super(name);
      }
  
      public static Test suite() {
          return (new TestSuite(TestMetaphone.class));
      }
  
      public void setUp() throws Exception {        
          super.setUp();
          _metaphone = new Metaphone();
      }
  
      public void tearDown() throws Exception {
          super.tearDown();
          _metaphone = null;
      }
  
      protected Encoder makeEncoder() {
          return new Metaphone();
      }
      
      // ------------------------------------------------------------------------
  
      public void testMetaphone() {
          assertEquals("TSTN",_metaphone.metaphone("testing"));
          assertEquals("0",_metaphone.metaphone("The"));
          assertEquals("KK",_metaphone.metaphone("quick"));
          assertEquals("BRN",_metaphone.metaphone("brown"));
          assertEquals("FKS",_metaphone.metaphone("fox"));
          assertEquals("JMPT",_metaphone.metaphone("jumped"));
          assertEquals("OFR",_metaphone.metaphone("over"));
          assertEquals("0",_metaphone.metaphone("the"));
          assertEquals("LS",_metaphone.metaphone("lazy"));
          assertEquals("TKS",_metaphone.metaphone("dogs"));
      }
  
      public void testIsMetaphoneEqual() {
          assertTrue(_metaphone.isMetaphoneEqual("Case","case"));
          assertTrue(_metaphone.isMetaphoneEqual("CASE","Case"));
          assertTrue(_metaphone.isMetaphoneEqual("caSe","cAsE"));
          
          assertTrue(_metaphone.isMetaphoneEqual("cookie","quick"));
          assertTrue(_metaphone.isMetaphoneEqual("quick","cookie"));
      }
  
      private Metaphone _metaphone = null;
  }
  
  
  
  1.1                  jakarta-commons-sandbox/codec/src/test/org/apache/commons/codec/language/TestRefinedSoundex.java
  
  Index: TestRefinedSoundex.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/codec/src/test/org/apache/commons/codec/language/TestRefinedSoundex.java,v
1.1 2003/02/04 04:46:01 tobrien Exp $
   * $Revision: 1.1 $
   * $Date: 2003/02/04 04:46:01 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.codec.language;
  
  import junit.framework.Test;
  import junit.framework.TestCase;
  import junit.framework.TestSuite;
  
  import org.apache.commons.codec.Encoder;
  import org.apache.commons.codec.TestEncoder;
  
  /**
   * @version $Revision: 1.1 $ $Date: 2003/02/04 04:46:01 $
   * @author Rodney Waldhoff
   */
  public class TestRefinedSoundex extends TestEncoder {
  
      public TestRefinedSoundex(String name) {
          super(name);
      }
  
      public static Test suite() {
          return (new TestSuite(TestRefinedSoundex.class));
      }
  
      public void setUp() throws Exception {        
          super.setUp();
          _encoder = new RefinedSoundex();
      }
  
      public void tearDown() throws Exception {
          super.tearDown();
          _encoder = null;
      }
  
      protected Encoder makeEncoder() {
          return new RefinedSoundex();
      }
  
      // ------------------------------------------------------------------------
  
      public void testEncode() {
          assertEquals("T6036084",_encoder.encode("testing"));
          assertEquals("T60",_encoder.encode("The"));
          assertEquals("Q503",_encoder.encode("quick"));
          assertEquals("B1908",_encoder.encode("brown"));
          assertEquals("F205",_encoder.encode("fox"));
          assertEquals("J408106",_encoder.encode("jumped"));
          assertEquals("O0209",_encoder.encode("over"));
          assertEquals("T60",_encoder.encode("the"));
          assertEquals("L7050",_encoder.encode("lazy"));
          assertEquals("D6043",_encoder.encode("dogs"));
      }
  
      private RefinedSoundex _encoder = null;
  }
  
  
  
  1.1                  jakarta-commons-sandbox/codec/src/test/org/apache/commons/codec/language/TestSoundex.java
  
  Index: TestSoundex.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/codec/src/test/org/apache/commons/codec/language/TestSoundex.java,v
1.1 2003/02/04 04:46:01 tobrien Exp $
   * $Revision: 1.1 $
   * $Date: 2003/02/04 04:46:01 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.codec.language;
  
  import junit.framework.Test;
  import junit.framework.TestCase;
  import junit.framework.TestSuite;
  
  import org.apache.commons.codec.Encoder;
  import org.apache.commons.codec.TestEncoder;
  
  /**
   * @version $Revision: 1.1 $ $Date: 2003/02/04 04:46:01 $
   * @author Rodney Waldhoff
   */
  public class TestSoundex extends TestEncoder {
  
      public TestSoundex(String name) {
          super(name);
      }
  
      public static Test suite() {
          return (new TestSuite(TestSoundex.class));
      }
  
      public void setUp() throws Exception {        
          super.setUp();
          _encoder = new Soundex();
      }
  
      public void tearDown() throws Exception {
          super.tearDown();
          _encoder = null;
      }
  
      protected Encoder makeEncoder() {
          return new Soundex();
      }
  
      // ------------------------------------------------------------------------
  
      public void testEncode() {
          assertEquals("T235",_encoder.encode("testing"));
          assertEquals("T000",_encoder.encode("The"));
          assertEquals("Q200",_encoder.encode("quick"));
          assertEquals("B650",_encoder.encode("brown"));
          assertEquals("F200",_encoder.encode("fox"));
          assertEquals("J513",_encoder.encode("jumped"));
          assertEquals("O160",_encoder.encode("over"));
          assertEquals("T000",_encoder.encode("the"));
          assertEquals("L200",_encoder.encode("lazy"));
          assertEquals("D200",_encoder.encode("dogs"));
      }
  
      private Soundex _encoder = null;
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message