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
21 * questions.
22 */
23
24 /*
25 * @test
26 * @modules jdk.incubator.vector
27 * @run testng/othervm -ea -esa DoubleMaxVectorTests
28 */
29
30 import jdk.incubator.vector.Vector.Shape;
31 import jdk.incubator.vector.Vector;
32
33 import jdk.incubator.vector.DoubleVector;
34
35 import org.testng.Assert;
36 import org.testng.annotations.DataProvider;
37 import org.testng.annotations.Test;
38
39 import java.lang.Integer;
40 import java.util.List;
41 import java.util.Arrays;
42 import java.util.function.BiFunction;
43 import java.util.function.IntFunction;
44 import java.util.stream.Collectors;
45 import java.util.stream.Stream;
46
47 @Test
48 public class DoubleMaxVectorTests extends AbstractVectorTest {
49
50 static final Shape S_Max_BIT = getMaxBit();
51
52 static final DoubleVector.DoubleSpecies SPECIES =
53 DoubleVector.species(S_Max_BIT);
54
55 static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
56
57 static Shape getMaxBit() {
58 return Shape.S_Max_BIT;
59 }
60
61 interface FUnOp {
62 double apply(double a);
63 }
64
65 static void assertArraysEquals(double[] a, double[] r, FUnOp f) {
66 int i = 0;
67 try {
68 for (; i < a.length; i++) {
69 Assert.assertEquals(r[i], f.apply(a[i]));
70 }
71 } catch (AssertionError e) {
72 Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]);
73 }
|
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
21 * questions.
22 */
23
24 /*
25 * @test
26 * @modules jdk.incubator.vector
27 * @run testng/othervm -ea -esa DoubleMaxVectorTests
28 */
29
30 import jdk.incubator.vector.Vector.Shape;
31 import jdk.incubator.vector.Vector.Species;
32 import jdk.incubator.vector.Vector;
33
34 import jdk.incubator.vector.DoubleVector;
35
36 import org.testng.Assert;
37 import org.testng.annotations.DataProvider;
38 import org.testng.annotations.Test;
39
40 import java.lang.Integer;
41 import java.util.List;
42 import java.util.Arrays;
43 import java.util.function.BiFunction;
44 import java.util.function.IntFunction;
45 import java.util.stream.Collectors;
46 import java.util.stream.Stream;
47
48 @Test
49 public class DoubleMaxVectorTests extends AbstractVectorTest {
50
51 static final Species<Double> SPECIES =
52 DoubleVector.SPECIES_MAX;
53
54 static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
55
56 static Shape getMaxBit() {
57 return Shape.S_Max_BIT;
58 }
59
60 interface FUnOp {
61 double apply(double a);
62 }
63
64 static void assertArraysEquals(double[] a, double[] r, FUnOp f) {
65 int i = 0;
66 try {
67 for (; i < a.length; i++) {
68 Assert.assertEquals(r[i], f.apply(a[i]));
69 }
70 } catch (AssertionError e) {
71 Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]);
72 }
|