diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BasePackage.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BasePackage.java index 1b9d8c311222962e25d0bd5c7565c90cf4ea1b92..51b362a8ad50a0dcfbbd5611d4c86cebdf494201 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BasePackage.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BasePackage.java @@ -624,8 +624,8 @@ public class BasePackage extends RBuiltinPackage { add(Vector.class, VectorNodeGen::create); add(Warning.class, WarningNodeGen::create); add(WhichFunctions.Which.class, WhichFunctionsFactory.WhichNodeGen::create); - add(WhichFunctions.WhichMax.class, WhichFunctionsFactory.WhichMaxNodeGen::create); - add(WhichFunctions.WhichMin.class, WhichFunctionsFactory.WhichMinNodeGen::create); + add(WhichFunctions.WhichMax.class, WhichFunctions.WhichMax::create); + add(WhichFunctions.WhichMin.class, WhichFunctions.WhichMin::create); add(Xtfrm.class, XtfrmNodeGen::create); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Scan.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Scan.java index 304af5f57e8333b6ea11b5a962f98d9607d0ca77..049375ae56f6834addf7f3827751016107526c6f 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Scan.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Scan.java @@ -12,7 +12,16 @@ package com.oracle.truffle.r.nodes.builtin.base; -import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.*; +import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.charAt0; +import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.constant; +import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.length; +import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.lengthLte; +import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.logicalValue; +import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.lt; +import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.nullValue; +import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.singleElement; +import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.stringValue; +import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.toBoolean; import static com.oracle.truffle.r.runtime.builtins.RBehavior.IO; import static com.oracle.truffle.r.runtime.builtins.RBuiltinKind.INTERNAL; @@ -30,7 +39,6 @@ import com.oracle.truffle.r.nodes.unary.CastToVectorNodeGen; import com.oracle.truffle.r.runtime.RError; import com.oracle.truffle.r.runtime.RInternalError; import com.oracle.truffle.r.runtime.RRuntime; -import com.oracle.truffle.r.runtime.builtins.RBehavior; import com.oracle.truffle.r.runtime.builtins.RBuiltin; import com.oracle.truffle.r.runtime.conn.RConnection; import com.oracle.truffle.r.runtime.conn.StdConnections; @@ -45,14 +53,11 @@ import com.oracle.truffle.r.runtime.data.RNull; import com.oracle.truffle.r.runtime.data.RRaw; import com.oracle.truffle.r.runtime.data.RString; import com.oracle.truffle.r.runtime.data.RVector; -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.RAbstractStringVector; import com.oracle.truffle.r.runtime.data.model.RAbstractVector; import com.oracle.truffle.r.runtime.ops.na.NACheck; -import com.sun.org.apache.bcel.internal.generic.INSTANCEOF; -@SuppressWarnings("unused") @RBuiltin(name = "scan", kind = INTERNAL, parameterNames = {"file", "what", "nmax", "sep", "dec", "quote", "skip", "nlines", "na.strings", "flush", "fill", "strip.white", "quiet", "blank.lines.skip", "multi.line", "comment.char", "allowEscapes", "encoding", "skipNull"}, behavior = IO) public abstract class Scan extends RBuiltinNode { @@ -74,6 +79,7 @@ public abstract class Scan extends RBuiltinNode { return ((RAbstractVector) castVector.execute(value)).materialize(); } + @SuppressWarnings("unused") private static class LocalData { RAbstractStringVector naStrings = null; boolean quiet = false; @@ -181,7 +187,6 @@ public abstract class Scan extends RBuiltinNode { // TODO: quite a few more things happen in GNU R around connections data.con = file; - Object result = RNull.instance; data.save = 0; try (RConnection openConn = data.con.forceOpen("r")) { @@ -199,14 +204,6 @@ public abstract class Scan extends RBuiltinNode { } } - private static int firstElementOrNA(RAbstractIntVector nmaxVec) { - return nmaxVec.getLength() == 0 ? RRuntime.INT_NA : nmaxVec.getDataAt(0); - } - - private static byte firstElementOrNA(RAbstractLogicalVector flushVec) { - return flushVec.getLength() == 0 ? RRuntime.LOGICAL_NA : flushVec.getDataAt(0); - } - private static int getFirstQuoteInd(String str, char sepChar) { int quoteInd = str.indexOf(sepChar); if (quoteInd >= 0) { @@ -320,7 +317,8 @@ public abstract class Scan extends RBuiltinNode { } } - private RVector scanFrame(RList what, int maxRecords, int maxLines, boolean flush, boolean fill, boolean stripWhite, boolean blSkip, boolean multiLine, LocalData data) throws IOException { + private RVector scanFrame(RList what, int maxRecords, int maxLines, boolean flush, boolean fill, @SuppressWarnings("unused") boolean stripWhite, boolean blSkip, boolean multiLine, LocalData data) + throws IOException { int nc = what.getLength(); if (nc == 0) { @@ -442,7 +440,8 @@ public abstract class Scan extends RBuiltinNode { } @TruffleBoundary - private RVector scanVector(RAbstractVector what, int maxItems, int maxLines, boolean flush, boolean stripWhite, boolean blSkip, LocalData data) throws IOException { + private RVector scanVector(RAbstractVector what, int maxItems, int maxLines, @SuppressWarnings("unused") boolean flush, @SuppressWarnings("unused") boolean stripWhite, boolean blSkip, + LocalData data) throws IOException { int blockSize = maxItems > 0 ? maxItems : SCAN_BLOCKSIZE; RVector vec = what.createEmptySameType(blockSize, RDataFactory.COMPLETE_VECTOR); naCheck.enable(true); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/WhichFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/WhichFunctions.java index ffa0cc5c29b71e409b06dadc9080542cfd02c7cb..17662ce966d830026fbd35be2cfbb5ba69a8f6b2 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/WhichFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/WhichFunctions.java @@ -22,23 +22,28 @@ */ package com.oracle.truffle.r.nodes.builtin.base; +import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.logicalValue; import static com.oracle.truffle.r.runtime.builtins.RBehavior.PURE; import static com.oracle.truffle.r.runtime.builtins.RBuiltinKind.INTERNAL; -import java.util.ArrayList; - -import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; +import com.oracle.truffle.api.dsl.Cached; import com.oracle.truffle.api.dsl.Specialization; +import com.oracle.truffle.api.profiles.ConditionProfile; +import com.oracle.truffle.api.profiles.LoopConditionProfile; import com.oracle.truffle.r.nodes.builtin.CastBuilder; import com.oracle.truffle.r.nodes.builtin.RBuiltinNode; +import com.oracle.truffle.r.nodes.builtin.base.WhichFunctionsFactory.WhichMinMaxNodeGen; +import com.oracle.truffle.r.nodes.profile.VectorLengthProfile; import com.oracle.truffle.r.runtime.RRuntime; import com.oracle.truffle.r.runtime.builtins.RBuiltin; import com.oracle.truffle.r.runtime.data.RAttributeProfiles; import com.oracle.truffle.r.runtime.data.RDataFactory; import com.oracle.truffle.r.runtime.data.RIntVector; +import com.oracle.truffle.r.runtime.data.RNull; import com.oracle.truffle.r.runtime.data.RStringVector; import com.oracle.truffle.r.runtime.data.model.RAbstractDoubleVector; import com.oracle.truffle.r.runtime.data.model.RAbstractLogicalVector; +import com.oracle.truffle.r.runtime.nodes.RNode; import com.oracle.truffle.r.runtime.ops.na.NACheck; /** @@ -49,94 +54,125 @@ public class WhichFunctions { @RBuiltin(name = "which", kind = INTERNAL, parameterNames = {"x"}, behavior = PURE) public abstract static class Which extends RBuiltinNode { - private final NACheck naCheck = NACheck.create(); - private final RAttributeProfiles attrProfiles = RAttributeProfiles.create(); + @Override + protected void createCasts(CastBuilder casts) { + casts.arg("x").mustBe(logicalValue()).asLogicalVector(); + } - @Specialization(guards = "!hasNames(x)") - @TruffleBoundary - protected RIntVector which(RAbstractLogicalVector x) { - ArrayList<Integer> w = new ArrayList<>(); - for (int i = 0; i < x.getLength(); i++) { + @Specialization + protected RIntVector which(RAbstractLogicalVector x, + @Cached("create()") VectorLengthProfile lengthProfile, + @Cached("createCountingProfile()") LoopConditionProfile loopProfile, + @Cached("createBinaryProfile()") ConditionProfile hasNamesProfile, + @Cached("create()") RAttributeProfiles attrProfiles, + @Cached("create()") NACheck naCheck) { + int length = lengthProfile.profile(x.getLength()); + loopProfile.profileCounted(length); + // determine the length of the result + int resultLength = 0; + for (int i = 0; loopProfile.inject(i < length); i++) { if (x.getDataAt(i) == RRuntime.LOGICAL_TRUE) { - w.add(i); + resultLength++; } } - int[] result = new int[w.size()]; - for (int i = 0; i < result.length; i++) { - result[i] = w.get(i) + 1; - } - return RDataFactory.createIntVector(result, RDataFactory.COMPLETE_VECTOR); - } - - @Specialization(guards = "hasNames(x)") - @TruffleBoundary - protected RIntVector whichNames(RAbstractLogicalVector x) { - ArrayList<Integer> w = new ArrayList<>(); - ArrayList<String> n = new ArrayList<>(); - RStringVector oldNames = x.getNames(attrProfiles); - naCheck.enable(oldNames); - for (int i = 0; i < x.getLength(); i++) { + // collect result indexes + int[] result = new int[resultLength]; + int pos = 0; + for (int i = 0; loopProfile.inject(i < length); i++) { if (x.getDataAt(i) == RRuntime.LOGICAL_TRUE) { - w.add(i); - String s = oldNames.getDataAt(i); - naCheck.check(s); - n.add(s); + result[pos++] = i + 1; } } - int[] result = new int[w.size()]; - for (int i = 0; i < result.length; i++) { - result[i] = w.get(i) + 1; + RStringVector names = x.getNames(attrProfiles); + if (hasNamesProfile.profile(names != null)) { + // collect result names + String[] resultNames = new String[resultLength]; + naCheck.enable(names); + pos = 0; + for (int i = 0; i < x.getLength(); i++) { + if (x.getDataAt(i) == RRuntime.LOGICAL_TRUE) { + String name = names.getDataAt(i); + naCheck.check(name); + resultNames[pos++] = name; + } + } + return RDataFactory.createIntVector(result, RDataFactory.COMPLETE_VECTOR, RDataFactory.createStringVector(resultNames, naCheck.neverSeenNA())); + } else { + return RDataFactory.createIntVector(result, RDataFactory.COMPLETE_VECTOR); } - String[] names = new String[n.size()]; - return RDataFactory.createIntVector(result, RDataFactory.COMPLETE_VECTOR, RDataFactory.createStringVector(n.toArray(names), naCheck.neverSeenNA())); - } - - protected boolean hasNames(RAbstractLogicalVector x) { - return x.getNames(attrProfiles) != null; } } @RBuiltin(name = "which.max", kind = INTERNAL, parameterNames = {"x"}, behavior = PURE) - public abstract static class WhichMax extends RBuiltinNode { - - @Override - protected void createCasts(CastBuilder casts) { - casts.toDouble(0); + public abstract static class WhichMax { + private WhichMax() { + // private } - @Specialization - protected int which(RAbstractDoubleVector x) { - double max = x.getDataAt(0); - int maxIndex = 0; - for (int i = 0; i < x.getLength(); i++) { - if (x.getDataAt(i) > max) { - max = x.getDataAt(i); - maxIndex = i; - } - } - return maxIndex + 1; + public static WhichMinMax create(RNode[] arguments) { + return WhichMinMaxNodeGen.create(true, arguments); } } @RBuiltin(name = "which.min", kind = INTERNAL, parameterNames = {"x"}, behavior = PURE) - public abstract static class WhichMin extends RBuiltinNode { + public abstract static class WhichMin { + private WhichMin() { + // private + } + + public static WhichMinMax create(RNode[] arguments) { + return WhichMinMaxNodeGen.create(false, arguments); + } + } + + public abstract static class WhichMinMax extends RBuiltinNode { + + private final boolean isMax; + + protected WhichMinMax(boolean isMax) { + this.isMax = isMax; + } @Override protected void createCasts(CastBuilder casts) { - casts.toDouble(0); + casts.arg(0, "x").asDoubleVector(true, false, false); } @Specialization - protected int which(RAbstractDoubleVector x) { - double minimum = x.getDataAt(0); - int minIndex = 0; - for (int i = 0; i < x.getLength(); i++) { - if (x.getDataAt(i) < minimum) { - minimum = x.getDataAt(i); - minIndex = i; + protected RIntVector which(RAbstractDoubleVector x, + @Cached("create()") VectorLengthProfile lengthProfile, + @Cached("createCountingProfile()") LoopConditionProfile loopProfile, + @Cached("createBinaryProfile()") ConditionProfile isNaNProfile, + @Cached("createBinaryProfile()") ConditionProfile hasNamesProfile, + @Cached("create()") RAttributeProfiles attrProfiles) { + int length = lengthProfile.profile(x.getLength()); + loopProfile.profileCounted(length); + double extreme = Double.NaN; + int extremeIndex = -1; + for (int i = 0; loopProfile.inject(i < length); i++) { + double d = x.getDataAt(i); + // inverted comparison to pass when extreme is NaN + if (!Double.isNaN(d) && (isMax ? !(d <= extreme) : !(d >= extreme))) { + extreme = x.getDataAt(i); + extremeIndex = i; } } - return minIndex + 1; + if (isNaNProfile.profile(extremeIndex == -1)) { + return RDataFactory.createEmptyIntVector(); + } + RStringVector names = x.getNames(attrProfiles); + if (hasNamesProfile.profile(names != null)) { + // collect result names + RStringVector resultNames = RDataFactory.createStringVectorFromScalar(names.getDataAt(extremeIndex)); + return RDataFactory.createIntVector(new int[]{extremeIndex + 1}, true, resultNames); + } else { + return RDataFactory.createIntVectorFromScalar(extremeIndex + 1); + } + } + + @Specialization + protected RIntVector which(@SuppressWarnings("unused") RNull x) { + return RDataFactory.createEmptyIntVector(); } } } diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_whichmax.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_whichmax.java index 2fe9d80df244312a224515e494fa1fc7ced6783c..ddf4c669f82f8a705cacddb8ba2f8b227097aad2 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_whichmax.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_whichmax.java @@ -24,7 +24,7 @@ public class TestBuiltin_whichmax extends TestBase { @Test public void testwhichmax2() { - assertEval(Ignored.Unknown, "argv <- list(structure(c(TRUE, FALSE), .Names = c('d', 'I(as.numeric(d)^2)'))); .Internal(which.max(argv[[1]]))"); + assertEval("argv <- list(structure(c(TRUE, FALSE), .Names = c('d', 'I(as.numeric(d)^2)'))); .Internal(which.max(argv[[1]]))"); } @Test @@ -34,23 +34,22 @@ public class TestBuiltin_whichmax extends TestBase { @Test public void testwhichmax4() { - assertEval(Ignored.Unknown, - "argv <- list(structure(c(NA, 87, 82, 75, 63, 50, 43, 32, 35, 60, 54, 55, 36, 39, NA, NA, 69, 57, 57, 51, 45, 37, 46, 39, 36, 24, 32, 23, 25, 32, NA, 32, 59, 74, 75, 60, 71, 61, 71, 57, 71, 68, 79, 73, 76, 71, 67, 75, 79, 62, 63, 57, 60, 49, 48, 52, 57, 62, 61, 66, 71, 62, 61, 57, 72, 83, 71, 78, 79, 71, 62, 74, 76, 64, 62, 57, 80, 73, 69, 69, 71, 64, 69, 62, 63, 46, 56, 44, 44, 52, 38, 46, 36, 49, 35, 44, 59, 65, 65, 56, 66, 53, 61, 52, 51, 48, 54, 49, 49, 61, NA, NA, 68, 44, 40, 27, 28, 25, 24, 24), .Tsp = c(1945, 1974.75, 4), class = 'ts')); .Internal(which.max(argv[[1]]))"); + assertEval("argv <- list(structure(c(NA, 87, 82, 75, 63, 50, 43, 32, 35, 60, 54, 55, 36, 39, NA, NA, 69, 57, 57, 51, 45, 37, 46, 39, 36, 24, 32, 23, 25, 32, NA, 32, 59, 74, 75, 60, 71, 61, 71, 57, 71, 68, 79, 73, 76, 71, 67, 75, 79, 62, 63, 57, 60, 49, 48, 52, 57, 62, 61, 66, 71, 62, 61, 57, 72, 83, 71, 78, 79, 71, 62, 74, 76, 64, 62, 57, 80, 73, 69, 69, 71, 64, 69, 62, 63, 46, 56, 44, 44, 52, 38, 46, 36, 49, 35, 44, 59, 65, 65, 56, 66, 53, 61, 52, 51, 48, 54, 49, 49, 61, NA, NA, 68, 44, 40, 27, 28, 25, 24, 24), .Tsp = c(1945, 1974.75, 4), class = 'ts')); .Internal(which.max(argv[[1]]))"); } @Test public void testwhichmax5() { - assertEval(Ignored.Unknown, "argv <- list(NULL); .Internal(which.max(argv[[1]]))"); + assertEval("argv <- list(NULL); .Internal(which.max(argv[[1]]))"); } @Test public void testwhichmax6() { - assertEval(Ignored.Unknown, "argv <- list(list()); .Internal(which.max(argv[[1]]))"); + assertEval("argv <- list(list()); .Internal(which.max(argv[[1]]))"); } @Test public void testwhichmax8() { - assertEval(Ignored.Unknown, "argv <- structure(list(x = c(NA, NA)), .Names = 'x');do.call('which.max', argv)"); + assertEval("argv <- structure(list(x = c(NA, NA)), .Names = 'x');do.call('which.max', argv)"); } @Test diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_whichmin.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_whichmin.java index c68a12f92aeb6613580324898e4074e1212331ef..8dbadd6a6face7e01fb9f1830fe277a4b5186edd 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_whichmin.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_whichmin.java @@ -19,41 +19,37 @@ public class TestBuiltin_whichmin extends TestBase { @Test public void testwhichmin1() { - assertEval(Ignored.Unknown, - "argv <- list(structure(c(345595, 172795, 69115, 34555, 23035, 11515, 5755, 2875, 1147, 571, 379, 187, 91, 27, 11, 3, 1, 3, 4.42857142857143, 4.73716632443532, 4.86858316221766, 4.95619438740589, 4.97809719370294, 4.98904859685147, 4.99452429842574, 4.99780971937029, 4.99890485968515, 4.99945242984257, 4.99978097193703, 4.99989048596851, 4.99994524298426, 4.9999780971937, 4.99998904859685), .Names = c('1 sec', '2 secs', '5 secs', '10 secs', '15 secs', '30 secs', '1 min', '2 mins', '5 mins', '10 mins', '15 mins', '30 mins', '1 hour', '3 hours', '6 hours', '12 hours', '1 DSTday', '2 DSTdays', '1 week', 'halfmonth', '1 month', '3 months', '6 months', '1 year', '2 years', '5 years', '10 years', '20 years', '50 years', '100 years', '200 years', '500 years', '1000 years'))); .Internal(which.min(argv[[1]]))"); + assertEval("argv <- list(structure(c(345595, 172795, 69115, 34555, 23035, 11515, 5755, 2875, 1147, 571, 379, 187, 91, 27, 11, 3, 1, 3, 4.42857142857143, 4.73716632443532, 4.86858316221766, 4.95619438740589, 4.97809719370294, 4.98904859685147, 4.99452429842574, 4.99780971937029, 4.99890485968515, 4.99945242984257, 4.99978097193703, 4.99989048596851, 4.99994524298426, 4.9999780971937, 4.99998904859685), .Names = c('1 sec', '2 secs', '5 secs', '10 secs', '15 secs', '30 secs', '1 min', '2 mins', '5 mins', '10 mins', '15 mins', '30 mins', '1 hour', '3 hours', '6 hours', '12 hours', '1 DSTday', '2 DSTdays', '1 week', 'halfmonth', '1 month', '3 months', '6 months', '1 year', '2 years', '5 years', '10 years', '20 years', '50 years', '100 years', '200 years', '500 years', '1000 years'))); .Internal(which.min(argv[[1]]))"); } @Test public void testwhichmin2() { - assertEval(Ignored.Unknown, - "argv <- list(structure(c(295, 145, 55, 25, 15, 5, 0, 2.5, 4, 4.5, 4.66666666666667, 4.83333333333333, 4.91666666666667, 4.97222222222222, 4.98611111111111, 4.99305555555556, 4.99652777777778, 4.99826388888889, 4.99950396825397, 4.99977184576774, 4.99988592288387, 4.99996197429462, 4.99998098714731, 4.99999049357366, 4.99999524678683, 4.99999809871473, 4.99999904935737, 4.99999952467868, 4.99999980987147, 4.99999990493574, 4.99999995246787, 4.99999998098715, 4.99999999049357), .Names = c('1 sec', '2 secs', '5 secs', '10 secs', '15 secs', '30 secs', '1 min', '2 mins', '5 mins', '10 mins', '15 mins', '30 mins', '1 hour', '3 hours', '6 hours', '12 hours', '1 DSTday', '2 DSTdays', '1 week', 'halfmonth', '1 month', '3 months', '6 months', '1 year', '2 years', '5 years', '10 years', '20 years', '50 years', '100 years', '200 years', '500 years', '1000 years'))); .Internal(which.min(argv[[1]]))"); + assertEval("argv <- list(structure(c(295, 145, 55, 25, 15, 5, 0, 2.5, 4, 4.5, 4.66666666666667, 4.83333333333333, 4.91666666666667, 4.97222222222222, 4.98611111111111, 4.99305555555556, 4.99652777777778, 4.99826388888889, 4.99950396825397, 4.99977184576774, 4.99988592288387, 4.99996197429462, 4.99998098714731, 4.99999049357366, 4.99999524678683, 4.99999809871473, 4.99999904935737, 4.99999952467868, 4.99999980987147, 4.99999990493574, 4.99999995246787, 4.99999998098715, 4.99999999049357), .Names = c('1 sec', '2 secs', '5 secs', '10 secs', '15 secs', '30 secs', '1 min', '2 mins', '5 mins', '10 mins', '15 mins', '30 mins', '1 hour', '3 hours', '6 hours', '12 hours', '1 DSTday', '2 DSTdays', '1 week', 'halfmonth', '1 month', '3 months', '6 months', '1 year', '2 years', '5 years', '10 years', '20 years', '50 years', '100 years', '200 years', '500 years', '1000 years'))); .Internal(which.min(argv[[1]]))"); } @Test public void testwhichmin3() { - assertEval(Ignored.Unknown, "argv <- list(NULL); .Internal(which.min(argv[[1]]))"); + assertEval("argv <- list(NULL); .Internal(which.min(argv[[1]]))"); } @Test public void testwhichmin4() { - assertEval(Ignored.Unknown, "argv <- list(list()); .Internal(which.min(argv[[1]]))"); + assertEval("argv <- list(list()); .Internal(which.min(argv[[1]]))"); } @Test public void testwhichmin5() { - assertEval(Ignored.Unknown, - "argv <- list(c(NA, 0.951840581382975, 0.805577027554469, 0.663985017923499, 0.53717416750558, 0.496765449963868, 0.472038350505409, 0.463306413812878, 0.485896454097402, 0.520777596351646, 0.524391122960607, 0.492063804965834, 0.513821989320989, 0.521702559081969, 0.533525525673351)); .Internal(which.min(argv[[1]]))"); + assertEval("argv <- list(c(NA, 0.951840581382975, 0.805577027554469, 0.663985017923499, 0.53717416750558, 0.496765449963868, 0.472038350505409, 0.463306413812878, 0.485896454097402, 0.520777596351646, 0.524391122960607, 0.492063804965834, 0.513821989320989, 0.521702559081969, 0.533525525673351)); .Internal(which.min(argv[[1]]))"); } @Test public void testwhichmin6() { - assertEval(Ignored.Unknown, - "argv <- list(structure(c(NA, 87, 82, 75, 63, 50, 43, 32, 35, 60, 54, 55, 36, 39, NA, NA, 69, 57, 57, 51, 45, 37, 46, 39, 36, 24, 32, 23, 25, 32, NA, 32, 59, 74, 75, 60, 71, 61, 71, 57, 71, 68, 79, 73, 76, 71, 67, 75, 79, 62, 63, 57, 60, 49, 48, 52, 57, 62, 61, 66, 71, 62, 61, 57, 72, 83, 71, 78, 79, 71, 62, 74, 76, 64, 62, 57, 80, 73, 69, 69, 71, 64, 69, 62, 63, 46, 56, 44, 44, 52, 38, 46, 36, 49, 35, 44, 59, 65, 65, 56, 66, 53, 61, 52, 51, 48, 54, 49, 49, 61, NA, NA, 68, 44, 40, 27, 28, 25, 24, 24), .Tsp = c(1945, 1974.75, 4), class = 'ts')); .Internal(which.min(argv[[1]]))"); + assertEval("argv <- list(structure(c(NA, 87, 82, 75, 63, 50, 43, 32, 35, 60, 54, 55, 36, 39, NA, NA, 69, 57, 57, 51, 45, 37, 46, 39, 36, 24, 32, 23, 25, 32, NA, 32, 59, 74, 75, 60, 71, 61, 71, 57, 71, 68, 79, 73, 76, 71, 67, 75, 79, 62, 63, 57, 60, 49, 48, 52, 57, 62, 61, 66, 71, 62, 61, 57, 72, 83, 71, 78, 79, 71, 62, 74, 76, 64, 62, 57, 80, 73, 69, 69, 71, 64, 69, 62, 63, 46, 56, 44, 44, 52, 38, 46, 36, 49, 35, 44, 59, 65, 65, 56, 66, 53, 61, 52, 51, 48, 54, 49, 49, 61, NA, NA, 68, 44, 40, 27, 28, 25, 24, 24), .Tsp = c(1945, 1974.75, 4), class = 'ts')); .Internal(which.min(argv[[1]]))"); } @Test public void testwhichmin8() { - assertEval(Ignored.Unknown, "argv <- structure(list(x = c(NA, NA, Inf)), .Names = 'x');do.call('which.min', argv)"); + assertEval("argv <- structure(list(x = c(NA, NA, Inf)), .Names = 'x');do.call('which.min', argv)"); } @Test