commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1155040 - /commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/bm/BeiderMorseEncoderTest.java
Date Mon, 08 Aug 2011 18:25:34 GMT
Author: ggregory
Date: Mon Aug  8 18:25:34 2011
New Revision: 1155040

URL: http://svn.apache.org/viewvc?rev=1155040&view=rev
Log:
Add testSpeedCheckAZ

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=1155040&r1=1155039&r2=1155040&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
Mon Aug  8 18:25:34 2011
@@ -165,23 +165,11 @@ public class BeiderMorseEncoderTest exte
     }
 
     /**
-     * Runs between 1.1 and 13 seconds at length 40 for me (Gary Gregory, 2011/08/06)
+     * (Un)luckily, the worse performing test because of the data in {@link TEST_CHARS}
      * 
      * @throws EncoderException
      */
     @Test(/* timeout = 20000L */)
-    public void testSpeedCheckRandom() throws EncoderException {
-        BeiderMorseEncoder bmpm = this.createGenericApproxEncoder();
-        StringBuffer stringBuffer = new StringBuffer();
-        Random rand = new Random();
-        stringBuffer.append(TEST_CHARS[rand.nextInt(TEST_CHARS.length)]);
-        for (int i = 0; i < 40; i++) {
-            bmpm.encode(stringBuffer.toString());
-            stringBuffer.append(TEST_CHARS[rand.nextInt(TEST_CHARS.length)]);
-        }
-    }
-
-    @Test(/* timeout = 20000L */)
     public void testSpeedCheck() throws EncoderException {
         BeiderMorseEncoder bmpm = this.createGenericApproxEncoder();
         StringBuffer stringBuffer = new StringBuffer();
@@ -194,4 +182,35 @@ public class BeiderMorseEncoderTest exte
             stringBuffer.append(TEST_CHARS[j]);
         }
     }
+
+    /**
+     * Another odd performance edge case.
+     * 
+     * @throws EncoderException
+     */
+    @Test(/* timeout = 20000L */)
+    public void testSpeedCheckAZ() throws EncoderException {
+        BeiderMorseEncoder bmpm = this.createGenericApproxEncoder();
+        String phrase = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz";
+        for (int i = 1; i <= phrase.length(); i++) {
+            bmpm.encode(phrase.subSequence(0, i));
+        }
+    }
+
+    /**
+     * Runs between 1.6 and 13 seconds at length 40 for me (Gary Gregory, 2011/08/06)
+     * 
+     * @throws EncoderException
+     */
+    @Test(/* timeout = 20000L */)
+    public void testSpeedCheckRandom() throws EncoderException {
+        BeiderMorseEncoder bmpm = this.createGenericApproxEncoder();
+        StringBuffer stringBuffer = new StringBuffer();
+        Random rand = new Random();
+        stringBuffer.append(TEST_CHARS[rand.nextInt(TEST_CHARS.length)]);
+        for (int i = 0; i < 40; i++) {
+            bmpm.encode(stringBuffer.toString());
+            stringBuffer.append(TEST_CHARS[rand.nextInt(TEST_CHARS.length)]);
+        }
+    }
 }



Mime
View raw message