pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1723392 - /pdfbox/branches/1.8/pdfbox/src/test/java/org/apache/pdfbox/util/TestQuickSort.java
Date Wed, 06 Jan 2016 17:38:16 GMT
Author: tilman
Date: Wed Jan  6 17:38:16 2016
New Revision: 1723392

URL: http://svn.apache.org/viewvc?rev=1723392&view=rev
Log:
PDFBOX-2996: add bigger test

Modified:
    pdfbox/branches/1.8/pdfbox/src/test/java/org/apache/pdfbox/util/TestQuickSort.java

Modified: pdfbox/branches/1.8/pdfbox/src/test/java/org/apache/pdfbox/util/TestQuickSort.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/test/java/org/apache/pdfbox/util/TestQuickSort.java?rev=1723392&r1=1723391&r2=1723392&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/test/java/org/apache/pdfbox/util/TestQuickSort.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/test/java/org/apache/pdfbox/util/TestQuickSort.java Wed
Jan  6 17:38:16 2016
@@ -18,6 +18,7 @@ package org.apache.pdfbox.util;
 
 import java.util.Arrays;
 import java.util.List;
+import java.util.Random;
 import junit.framework.TestCase;
 
 /**
@@ -79,5 +80,19 @@ public class TestQuickSort extends TestC
             doTest(input, expected);
         }
 
+        Random rnd = new Random(12345);
+        for (int cnt = 0; cnt < 100; ++cnt)
+        {
+            int len = rnd.nextInt(20000) + 2;
+            Integer[] input = new Integer[len];
+            Integer[] expected = new Integer[len];
+            for (int i = 0; i < len; ++i)
+            {
+                // choose values so that there are some duplicates
+                expected[i] = input[i] = rnd.nextInt(rnd.nextInt(100)+1);
+            }
+            Arrays.sort(expected);
+            doTest(input, expected);
+        }
     }
 }



Mime
View raw message