You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2014/04/29 20:41:27 UTC
svn commit: r1591051 -
/pdfbox/branches/1.8/pdfbox/src/test/java/org/apache/pdfbox/filter/TestFilters.java
Author: tilman
Date: Tue Apr 29 18:41:27 2014
New Revision: 1591051
URL: http://svn.apache.org/r1591051
Log:
PDFBOX-2034: testFilters now does deterministic and non-deterministic tests
Modified:
pdfbox/branches/1.8/pdfbox/src/test/java/org/apache/pdfbox/filter/TestFilters.java
Modified: pdfbox/branches/1.8/pdfbox/src/test/java/org/apache/pdfbox/filter/TestFilters.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/test/java/org/apache/pdfbox/filter/TestFilters.java?rev=1591051&r1=1591050&r2=1591051&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/test/java/org/apache/pdfbox/filter/TestFilters.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/test/java/org/apache/pdfbox/filter/TestFilters.java Tue Apr 29 18:41:27 2014
@@ -36,15 +36,29 @@ public class TestFilters extends TestCas
{
/**
- * This will test all of the filters in the system.
+ * This will test all of the filters in the system. There will be COUNT
+ * of deterministic tests and COUNT of non-deterministic tests, see also
+ * the discussion in PDFBOX-1977.
*
* @throws IOException If there is an exception while encoding.
*/
public void testFilters() throws IOException
{
- for(int iter=0;iter<10;iter++)
+ final int COUNT = 10;
+ Random rd = new Random(123456);
+ for (int iter = 0; iter < COUNT * 2; iter++)
{
- final long seed = new Random().nextLong();
+ long seed;
+ if (iter < COUNT)
+ {
+ // deterministic seed
+ seed = rd.nextLong();
+ }
+ else
+ {
+ // non-deterministic seed
+ seed = new Random().nextLong();
+ }
boolean success = false;
try
{
@@ -58,7 +72,7 @@ public class TestFilters extends TestCas
final int left = numBytes - upto;
if (random.nextBoolean() || left < 2)
{
- // Fill w/ truly random bytes:
+ // Fill w/ pseudo-random bytes:
final int end = upto + Math.min(left, 10+random.nextInt(100));
while(upto < end)
{