1 /* 2 * Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 package test.java.util.Random; 24 25 import org.junit.Test; 26 import org.junit.runner.RunWith; 27 import org.junit.runners.Parameterized; 28 29 import java.util.random.RandomGeneratorFactory; 30 31 /** 32 * This is just parameterized version of RandomTestBsi1999 as 33 * testing infra is not happy about long running tests. 34 */ 35 @RunWith(Parameterized.class) 36 public class RandomTestBsi1999Split { 37 38 @Parameterized.Parameters(name = "{1}") data()39 public static Object[][] data() { 40 return RandomGeneratorFactory.all() 41 // skip because stochastic 42 .filter(factory -> !factory.name().equals("SecureRandom")) 43 // autocorrelation failure for java.util.Random longs bit 0: 44 // count=2207 (should be in [2267,2733]), tau=2819 45 .filter(factory -> !factory.name().equals("Random")) 46 .map(factory -> new Object[] { factory, factory.name() } ) 47 .toArray(Object[][]::new); 48 } 49 50 private final RandomGeneratorFactory factory; 51 private final String name; 52 RandomTestBsi1999Split(RandomGeneratorFactory factory, String name)53 public RandomTestBsi1999Split(RandomGeneratorFactory factory, String name) { 54 this.factory = factory; 55 this.name = name; 56 } 57 58 @Test randomTestBsi1999()59 public void randomTestBsi1999() { 60 RandomTestBsi1999.failCount = 0; 61 RandomTestBsi1999.setRNG(name); 62 63 RandomTestBsi1999.testOneRng(factory.create(59), 0); 64 65 RandomTestBsi1999.exceptionOnFail(); 66 } 67 } 68