From b58f7ff862ec656c83375f972a0b6c1c84547b36 Mon Sep 17 00:00:00 2001 From: Zbynek Slajchrt <zbynek.slajchrt@oracle.com> Date: Thu, 15 Mar 2018 14:59:27 +0100 Subject: [PATCH] Cast-pipelines-related tests re-enabled --- .../oracle/truffle/r/nodes/casts/CastUtils.java | 4 ++-- .../oracle/truffle/r/nodes/casts/TypeExpr.java | 4 ++-- .../r/nodes/castsTests/CastBuilderTest.java | 9 ++++----- .../castsTests/ResultTypesAnalyserTest.java | 17 ++++++++++------- mx.fastr/mx_fastr.py | 2 +- 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/casts/CastUtils.java b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/casts/CastUtils.java index fda59988b9..bed51d5bb0 100644 --- a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/casts/CastUtils.java +++ b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/casts/CastUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -851,7 +851,7 @@ public class CastUtils { samples.add(RDataFactory.createComplexVectorFromScalar(RComplex.valueOf(1, 1))); samples.add(RDataFactory.createComplexVectorFromScalar(RComplex.valueOf(-1, 1))); samples.add(RDataFactory.createComplexVector(new double[]{-Math.PI, 0, Math.PI, - RRuntime.DOUBLE_NA, -Math.PI, 0, Math.PI, RRuntime.DOUBLE_NA}, true)); + RRuntime.DOUBLE_NA, -Math.PI, 0, Math.PI, RRuntime.DOUBLE_NA}, false)); samples.add(RDataFactory.createComplexVector(new double[]{-Math.PI, 0, Math.PI, RRuntime.DOUBLE_NA, -Math.PI, 0, Math.PI, RRuntime.DOUBLE_NA}, false)); samples.add(RDataFactory.createComplexVector(new double[]{RRuntime.DOUBLE_NA, RRuntime.DOUBLE_NA}, false)); diff --git a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/casts/TypeExpr.java b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/casts/TypeExpr.java index d156a5156a..57d985d5b6 100644 --- a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/casts/TypeExpr.java +++ b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/casts/TypeExpr.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -223,7 +223,7 @@ public final class TypeExpr { } public TypeExpr normalize() { - Set<Set<Type>> conjunctionsNormalized = disjNormForm.stream().map(conj -> normalizeConjunctionSet(conj)).filter(t -> !t.equals(Not.NOTHING)).collect(Collectors.toSet()); + Set<Set<Type>> conjunctionsNormalized = disjNormForm.stream().map(conj -> normalizeConjunctionSet(conj)).filter(t -> !t.isEmpty()).collect(Collectors.toSet()); return new TypeExpr(conjunctionsNormalized, samples); } diff --git a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/castsTests/CastBuilderTest.java b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/castsTests/CastBuilderTest.java index 817a66144f..7e692d619e 100644 --- a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/castsTests/CastBuilderTest.java +++ b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/castsTests/CastBuilderTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -655,7 +655,7 @@ public class CastBuilderTest { } @Test - public void testSampleNonNASequence() { + public void testMustNotBeNAOnIntSequence() { arg.mustNotBeNA(RError.Message.GENERIC, "Error"); RIntSequence seq = RDataFactory.createIntSequence(1, 1, 1); Object res = cast(seq); @@ -663,10 +663,9 @@ public class CastBuilderTest { } @Test - public void testSampleNAVector() { + public void testReplaceDoubleNA() { arg.replaceNA("REPLACEMENT"); - RDoubleVector vec = RDataFactory.createDoubleVector(new double[]{0, 1, RRuntime.DOUBLE_NA, 3}, false); - Object res = cast(vec); + Object res = cast(RRuntime.DOUBLE_NA); Assert.assertEquals("REPLACEMENT", res); } diff --git a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/castsTests/ResultTypesAnalyserTest.java b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/castsTests/ResultTypesAnalyserTest.java index 47670c9a92..c275686083 100644 --- a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/castsTests/ResultTypesAnalyserTest.java +++ b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/castsTests/ResultTypesAnalyserTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -88,10 +88,13 @@ import com.oracle.truffle.r.runtime.data.RNull; import com.oracle.truffle.r.runtime.data.RRaw; import com.oracle.truffle.r.runtime.data.RRawVector; import com.oracle.truffle.r.runtime.data.RString; +import com.oracle.truffle.r.runtime.data.RStringSequence; import com.oracle.truffle.r.runtime.data.RStringVector; +import com.oracle.truffle.r.runtime.data.model.RAbstractComplexVector; import com.oracle.truffle.r.runtime.data.model.RAbstractDoubleVector; import com.oracle.truffle.r.runtime.data.model.RAbstractIntVector; import com.oracle.truffle.r.runtime.data.model.RAbstractLogicalVector; +import com.oracle.truffle.r.runtime.data.model.RAbstractRawVector; import com.oracle.truffle.r.runtime.data.model.RAbstractStringVector; import com.oracle.truffle.r.runtime.data.model.RAbstractVector; @@ -114,7 +117,7 @@ public class ResultTypesAnalyserTest { @Test public void testAsDoubleVector() { arg.asDoubleVector(); - assertTypes(RNull.class, RMissing.class, double.class, RDoubleSequence.class, RDoubleVector.class); + assertTypes(RNull.class, RMissing.class, double.class, RAbstractDoubleVector.class, RDoubleVector.class); } @Test @@ -126,25 +129,25 @@ public class ResultTypesAnalyserTest { @Test public void testAsLogicalVector() { arg.asLogicalVector(); - assertTypes(RNull.class, RMissing.class, byte.class, RLogicalVector.class); + assertTypes(RNull.class, RMissing.class, byte.class, RAbstractLogicalVector.class, RLogicalVector.class); } @Test public void testAsStringVector() { arg.asStringVector(); - assertTypes(RNull.class, RMissing.class, String.class, RStringVector.class); + assertTypes(RNull.class, RMissing.class, String.class, RAbstractStringVector.class, RStringVector.class, RStringSequence.class); } @Test public void testAsRawVector() { arg.asRawVector(); - assertTypes(RNull.class, RMissing.class, RRaw.class, RRawVector.class); + assertTypes(RNull.class, RMissing.class, RAbstractRawVector.class, RRaw.class, RRawVector.class); } @Test public void testAsComplexVector() { arg.asComplexVector(); - assertTypes(RNull.class, RMissing.class, RComplex.class, RComplexVector.class); + assertTypes(RNull.class, RMissing.class, RAbstractComplexVector.class, RComplex.class, RComplexVector.class); } @Test @@ -442,7 +445,7 @@ public class ResultTypesAnalyserTest { @Test public void testMustNotBeMissingAndBoxPrimitive() { arg.mustNotBeMissing().returnIf(nullValue(), nullConstant()).mustBe(stringValue()).boxPrimitive().asStringVector(); - assertTypes(atom(RNull.class).or(atom(RStringVector.class)), true); + assertTypes(atom(RNull.class).or(atom(RStringVector.class).or(atom(RAbstractStringVector.class))), true); } @Test diff --git a/mx.fastr/mx_fastr.py b/mx.fastr/mx_fastr.py index 700ba88357..429c9d84e4 100644 --- a/mx.fastr/mx_fastr.py +++ b/mx.fastr/mx_fastr.py @@ -338,7 +338,7 @@ def _simple_generated_unit_tests(): return map(_test_subpackage, ['engine.shell', 'engine.interop', 'library.base', 'library.grid', 'library.fastrGrid', 'library.methods', 'library.stats', 'library.tools', 'library.utils', 'library.fastr', 'builtins', 'functions', 'parser', 'rffi', 'rng', 'runtime.data', 'S4']) def _simple_unit_tests(): - return _simple_generated_unit_tests() + ['com.oracle.truffle.tck.tests'] + return _simple_generated_unit_tests() + ['com.oracle.truffle.r.nodes.castsTests', 'com.oracle.truffle.tck.tests'] def _nodes_unit_tests(): return ['com.oracle.truffle.r.nodes.test', 'com.oracle.truffle.r.nodes.access.vector'] -- GitLab