commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1151546 - /commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/bm/BeiderMorseEncoderTest.java
Date Wed, 27 Jul 2011 17:29:51 GMT
Author: ggregory
Date: Wed Jul 27 17:29:50 2011
New Revision: 1151546

URL: http://svn.apache.org/viewvc?rev=1151546&view=rev
Log:
Rename test method.

Modified:
    commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/bm/BeiderMorseEncoderTest.java

Modified: commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/bm/BeiderMorseEncoderTest.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/bm/BeiderMorseEncoderTest.java?rev=1151546&r1=1151545&r2=1151546&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/bm/BeiderMorseEncoderTest.java
(original)
+++ commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/bm/BeiderMorseEncoderTest.java
Wed Jul 27 17:29:50 2011
@@ -20,6 +20,7 @@ package org.apache.commons.codec.languag
 import static org.junit.Assert.assertEquals;
 
 import java.util.Collections;
+import java.util.Random;
 
 import org.apache.commons.codec.EncoderException;
 import org.apache.commons.codec.StringEncoder;
@@ -47,7 +48,7 @@ public class BeiderMorseEncoderTest exte
      */
     @Ignore
     @Test
-    public void encodeGna() throws EncoderException {
+    public void testEncodeGna() throws EncoderException {
         BeiderMorseEncoder bmpm = new BeiderMorseEncoder();
         bmpm.setNameType(NameType.GENERIC);
         bmpm.setRuleType(RuleType.APPROX);
@@ -101,4 +102,25 @@ public class BeiderMorseEncoderTest exte
         BeiderMorseEncoder bmpm = new BeiderMorseEncoder();
         bmpm.setRuleType(RuleType.RULES);
     }
+    
+    @Ignore
+    @Test
+    public void testSpeedCheck() throws EncoderException {
+        char[] chars = new char[] { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'o','u' };
+        BeiderMorseEncoder bmpm = new BeiderMorseEncoder();
+        bmpm.setNameType(NameType.GENERIC);
+        bmpm.setRuleType(RuleType.APPROX);
+        StringBuffer stringBuffer = new StringBuffer();
+        Random rand = new Random();
+        stringBuffer.append(chars[rand.nextInt(chars.length)]);
+        long start;
+        for (int i = 0; i < 20; i++) {
+            start = System.currentTimeMillis();
+            System.out.println("String to encode:" + stringBuffer.toString());
+            bmpm.encode(stringBuffer.toString());
+            stringBuffer.append(chars[rand.nextInt(chars.length)]);
+            System.out.println("Elapsed time in ms:"
+                    + (System.currentTimeMillis() - start));
+        }
+    }
 }



Mime
View raw message