From 542c5188595ca06bad7fbea82d804bd852daae69 Mon Sep 17 00:00:00 2001 From: Lukas Stadler <lukas.stadler@oracle.com> Date: Wed, 15 Nov 2017 16:03:55 +0100 Subject: [PATCH] enable passing tests --- .../truffle/r/test/ArithmeticWhiteList.java | 2 -- .../truffle/r/test/ExpectedTestOutput.test | 34 +++++++++---------- .../TestBuiltin_attributesassign.java | 1 + .../r/test/builtins/TestBuiltin_c.java | 6 +--- .../builtins/TestBuiltin_encodeString.java | 7 ++-- .../r/test/builtins/TestBuiltin_iconv.java | 9 ++--- .../test/builtins/TestBuiltin_identical.java | 7 ++-- .../r/test/builtins/TestBuiltin_list.java | 3 +- .../test/builtins/TestBuiltin_operators.java | 6 +--- .../r/test/builtins/TestBuiltin_range.java | 5 ++- .../r/test/builtins/TestBuiltin_rowMeans.java | 11 +++--- .../r/test/builtins/TestBuiltin_summary.java | 6 ++-- .../library/base/TestSimpleArithmetic.java | 4 +-- .../r/test/library/utils/TestUtils.java | 3 +- 14 files changed, 40 insertions(+), 64 deletions(-) diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ArithmeticWhiteList.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ArithmeticWhiteList.java index 01d39683e7..336127e33b 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ArithmeticWhiteList.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ArithmeticWhiteList.java @@ -37,7 +37,6 @@ public class ArithmeticWhiteList { static { WHITELIST.add("{ abs((-0-1i)/(0+0i)) }", "[1] NaN\n", "[1] Inf\n"); WHITELIST.add("{ abs((-1-0i)/(0+0i)) }", "[1] NaN\n", "[1] Inf\n"); - WHITELIST.add("{rowMeans(matrix(c(NaN,4+5i,2+0i,5+10i),nrow=2,ncol=2), na.rm = FALSE)}", "[1] NaN+NaNi 4.5+7.5i\n", "[1] NaN+0.0i 4.5+7.5i\n"); WHITELIST.add("{ ((0+1i)/0) * ((0+1i)/0) }", "[1] NaN+NaNi\n", "[1] -Inf+NaNi\n"); WHITELIST.add("{ ((0-1i)/0) * ((-1-1i)/0) }", "[1] NaN+NaNi\n", "[1] -Inf+Infi\n"); WHITELIST.add("{ ((0-1i)/0) * ((0+1i)/0) }", "[1] NaN+NaNi\n", "[1] Inf+NaNi\n"); @@ -55,7 +54,6 @@ public class ArithmeticWhiteList { WHITELIST.add("{ -((0+1i)/0) }", "[1] NaN+NaNi\n", "[1] NaN-Infi\n"); WHITELIST.add("{ -((1+0i)/0) }", "[1] NaN+NaNi\n", "[1] -Inf+NaNi\n"); WHITELIST.add("{ -c((1+0i)/0,2) }", "[1] NaN+NaNi -2+ 0i\n", "[1] -Inf+NaNi -2+ 0i\n"); - WHITELIST.add("x <- c(NaN, 3+2i); xre <- Re(x); xim <- (0+1i) * Im(x); xre + xim", "[1] NaN+NaNi 3+ 2i\n", "[1] NaN+0i 3+2i\n"); WHITELIST.add("{ c(0/0+1i,2+1i) == c(1+1i,2+1i) }", "[1] FALSE TRUE\n", "[1] NA TRUE\n"); WHITELIST.add("{ c(1+1i,2+1i) == c(0/0+1i,2+1i) }", "[1] FALSE TRUE\n", "[1] NA TRUE\n"); WHITELIST.add("exp(-abs((0+1i)/(0+0i)))", "[1] NaN\n", "[1] 0\n"); diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test index 7713a1a6af..8aef4723e6 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test @@ -11395,7 +11395,7 @@ $Residuals #argv <- list(structure(1208822400, class = c('POSIXct', 'POSIXt')), structure(1209168000, class = c('POSIXct', 'POSIXt')));c(argv[[1]],argv[[2]]); [1] "2008-04-22 GMT" "2008-04-26 GMT" -##com.oracle.truffle.r.test.builtins.TestBuiltin_c.testc14#Ignored.OutputFormatting# +##com.oracle.truffle.r.test.builtins.TestBuiltin_c.testc14# #argv <- list(`Grand mean` = structure(103.87323943662, class = 'mtable'), structure(list(N = structure(c(78.7365206866197, 98.5088731171753, 113.842206450509, 123.008873117175), .Dim = 4L, .Dimnames = structure(list(N = c('0.0cwt', '0.2cwt', '0.4cwt', '0.6cwt')), .Names = 'N'), class = 'mtable'), `V:N` = structure(c(79.5323303457107, 86.1989970123773, 69.7732394366197, 98.0323303457106, 108.032330345711, 89.1989970123773, 114.198997012377, 116.698997012377, 110.365663679044, 124.365663679044, 126.365663679044, 118.032330345711), .Dim = 3:4, .Dimnames = structure(list(V = c('Golden.rain', 'Marvellous', 'Victory'), N = c('0.0cwt', '0.2cwt', '0.4cwt', '0.6cwt')), .Names = c('V', 'N')), class = 'mtable')), .Names = c('N', 'V:N')));c(argv[[1]],argv[[2]]); [[1]] [1] 103.8732 @@ -24892,7 +24892,7 @@ character(0) #argv <- list(c('1', '2', NA), 0L, '\'', 0L, FALSE); .Internal(encodeString(argv[[1]], argv[[2]], argv[[3]], argv[[4]], argv[[5]])) [1] "'1'" "'2'" NA -##com.oracle.truffle.r.test.builtins.TestBuiltin_encodeString.testencodeString10#Ignored.ImplementationError# +##com.oracle.truffle.r.test.builtins.TestBuiltin_encodeString.testencodeString10# #argv <- list('\'class\' is a reserved slot name and cannot be redefined', 0L, '\'', 0L, FALSE); .Internal(encodeString(argv[[1]], argv[[2]], argv[[3]], argv[[4]], argv[[5]])) [1] "'\\'class\\' is a reserved slot name and cannot be redefined'" @@ -24923,7 +24923,7 @@ character(0) #argv <- list(c('NA', 'a', 'b', 'c', 'd', NA), 0L, '', 0L, TRUE); .Internal(encodeString(argv[[1]], argv[[2]], argv[[3]], argv[[4]], argv[[5]])) [1] "NA" "a" "b" "c" "d" "<NA>" -##com.oracle.truffle.r.test.builtins.TestBuiltin_encodeString.testencodeString7#Ignored.ImplementationError# +##com.oracle.truffle.r.test.builtins.TestBuiltin_encodeString.testencodeString7# #argv <- list('ab\bc\ndef', 0L, '', 0L, TRUE); .Internal(encodeString(argv[[1]], argv[[2]], argv[[3]], argv[[4]], argv[[5]])) [1] "ab\\bc\\ndef" @@ -28333,7 +28333,7 @@ Error: 'x' must be a character vector #argv <- list('Report Information on C Stack Size and Usage', 'UTF-8', '', 'byte', FALSE, FALSE); .Internal(iconv(argv[[1]], argv[[2]], argv[[3]], argv[[4]], argv[[5]], argv[[6]])) [1] "Report Information on C Stack Size and Usage" -##com.oracle.truffle.r.test.builtins.TestBuiltin_iconv.testiconv2#Ignored.ImplementationError# +##com.oracle.truffle.r.test.builtins.TestBuiltin_iconv.testiconv2# #argv <- list('façile' , 'latin1', 'ASCII', NA_character_, TRUE, FALSE); .Internal(iconv(argv[[1]], argv[[2]], argv[[3]], argv[[4]], argv[[5]], argv[[6]])) [1] NA @@ -28408,7 +28408,7 @@ character(0) #argv <- list(list(), 'latin1', 'ASCII', NA_character_, TRUE, FALSE); .Internal(iconv(argv[[1]], argv[[2]], argv[[3]], argv[[4]], argv[[5]], argv[[6]])) character(0) -##com.oracle.truffle.r.test.builtins.TestBuiltin_iconv.testiconv7#Ignored.ImplementationError# +##com.oracle.truffle.r.test.builtins.TestBuiltin_iconv.testiconv7# #argv <- list('façile' , 'latin1', 'ASCII', '', TRUE, FALSE); .Internal(iconv(argv[[1]], argv[[2]], argv[[3]], argv[[4]], argv[[5]], argv[[6]])) [1] "faile" @@ -28512,7 +28512,7 @@ attr(,"Rd_tag") #identical(NaN, NaN, num.eq=T, single.NA=T) [1] TRUE -##com.oracle.truffle.r.test.builtins.TestBuiltin_identical.testIdentical#Ignored.ImplementationError# +##com.oracle.truffle.r.test.builtins.TestBuiltin_identical.testIdentical# #{ f1 <- function() {}; f2 <- function() {}; identical(f1, f2) } [1] TRUE @@ -28540,7 +28540,7 @@ attr(,"Rd_tag") #{ identical(1L,1) } [1] FALSE -##com.oracle.truffle.r.test.builtins.TestBuiltin_identical.testIdentical#Ignored.ImplementationError# +##com.oracle.truffle.r.test.builtins.TestBuiltin_identical.testIdentical# #{ identical(function() 42, function() 42) } [1] TRUE @@ -34491,7 +34491,7 @@ attr(,"class")attr(,"package") [1] "methods" -##com.oracle.truffle.r.test.builtins.TestBuiltin_list.testlist33#Ignored.OutputFormatting# +##com.oracle.truffle.r.test.builtins.TestBuiltin_list.testlist33# #argv <- list(tables = structure(list(`Grand mean` = 103.87323943662, N = structure(c(78.7365206866197, 98.5088731171753, 113.842206450509, 123.008873117175), .Dim = 4L, .Dimnames = structure(list(N = c('0.0cwt', '0.2cwt', '0.4cwt', '0.6cwt')), .Names = 'N'), class = 'mtable'), `V:N` = structure(c(79.5323303457107, 86.1989970123773, 69.7732394366197, 98.0323303457106, 108.032330345711, 89.1989970123773, 114.198997012377, 116.698997012377, 110.365663679044, 124.365663679044, 126.365663679044, 118.032330345711), .Dim = 3:4, .Dimnames = structure(list(V = c('Golden.rain', 'Marvellous', 'Victory'), N = c('0.0cwt', '0.2cwt', '0.4cwt', '0.6cwt')), .Names = c('V', 'N')), class = 'mtable')), .Names = c('Grand mean', 'N', 'V:N')), n = structure(list(N = structure(c(17, 18, 18, 18), .Dim = 4L, .Dimnames = structure(list(N = c('0.0cwt', '0.2cwt', '0.4cwt', '0.6cwt')), .Names = 'N')), `V:N` = structure(c(6, 6, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6), .Dim = 3:4, .Dimnames = structure(list(V = c('Golden.rain', 'Marvellous', 'Victory'), N = c('0.0cwt', '0.2cwt', '0.4cwt', '0.6cwt')), .Names = c('V', 'N')))), .Names = c('N', 'V:N')));list(argv[[1]],argv[[2]]); [[1]] [[1]]$`Grand mean` @@ -45283,7 +45283,7 @@ attr(,"class") #argv <- list(181L, 3.14159265358979);`*`(argv[[1]],argv[[2]]); [1] 568.6283 -##com.oracle.truffle.r.test.builtins.TestBuiltin_operators.testoperators39#Ignored.OutputFormatting# +##com.oracle.truffle.r.test.builtins.TestBuiltin_operators.testoperators39# #argv <- list(structure(c(-24.5833333333333, -5.08333333333333, 10.25, 19.4166666666667), .Dim = 4L, .Dimnames = structure(list(N = c('0.0cwt', '0.2cwt', '0.4cwt', '0.6cwt')), .Names = 'N'), strata = structure('Within', .Names = 'N'), class = 'mtable'), structure(103.972222222222, class = 'mtable'));`+`(argv[[1]],argv[[2]]); N 0.0cwt 0.2cwt 0.4cwt 0.6cwt @@ -48880,7 +48880,7 @@ NULL #range(c(T, F, NA, NA, T)) [1] NA NA -##com.oracle.truffle.r.test.builtins.TestBuiltin_range.testNaRmAndFiniteWithLogical# +##com.oracle.truffle.r.test.builtins.TestBuiltin_range.testNaRmAndFiniteWithLogical#Ignored.ReferenceError# #range(c(T, F, NA, NA, T), finite=T) [1] NA NA @@ -51868,7 +51868,7 @@ Error: a matrix-like object is required as argument to 'row' #{ rowMeans(matrix(as.complex(1:6), nrow=2)) } [1] 3+0i 4+0i -##com.oracle.truffle.r.test.builtins.TestBuiltin_rowMeans.testRowMeans#Ignored.OutputFormatting# +##com.oracle.truffle.r.test.builtins.TestBuiltin_rowMeans.testRowMeans# #{rowMeans(matrix(NA,NA,NA),TRUE)} Error in matrix(NA, NA, NA) : invalid 'nrow' value (too large or NA) @@ -51912,11 +51912,11 @@ Error in matrix(NA, NA, NA) : invalid 'nrow' value (too large or NA) #{rowMeans(matrix(c(NA,NaN,NaN,NA),ncol=2,nrow=2))} [1] NA NaN -##com.oracle.truffle.r.test.builtins.TestBuiltin_rowMeans.testRowMeans#WhiteList.arithmetic# +##com.oracle.truffle.r.test.builtins.TestBuiltin_rowMeans.testRowMeans# #{rowMeans(matrix(c(NaN,4+5i,2+0i,5+10i),nrow=2,ncol=2), na.rm = FALSE)} [1] NaN+0.0i 4.5+7.5i -##com.oracle.truffle.r.test.builtins.TestBuiltin_rowMeans.testRowMeans#WhiteList.arithmetic# +##com.oracle.truffle.r.test.builtins.TestBuiltin_rowMeans.testRowMeans# #{rowMeans(matrix(c(NaN,4+5i,2+0i,5+10i),nrow=2,ncol=2), na.rm = TRUE)} [1] 2.0+0.0i 4.5+7.5i @@ -71936,7 +71936,7 @@ In sum(argv[[1]]) : integer overflow - use sum(as.numeric(.)) Min. 1st Qu. Median Mean 3rd Qu. Max. 1.601 1.605 1.609 1.609 1.612 1.616 -##com.oracle.truffle.r.test.builtins.TestBuiltin_summary.testsummary1#Ignored.OutputFormatting# +##com.oracle.truffle.r.test.builtins.TestBuiltin_summary.testsummary1# #argv <- structure(list(object = structure(c(4L, 4L, 4L, 4L, 4L, 3L, 4L, 4L, 4L, 4L, 3L, 4L, 3L, 4L, 4L, 4L, 4L, 2L, 4L, 3L, 4L, 4L, 4L, 2L), .Dim = c(6L, 4L), .Dimnames = structure(list(c('25-34', '35-44', '45-54', '55-64', '65-74', '75+'), c('0-39g/day', '40-79', '80-119', '120+')), .Names = c('', '')), class = 'table')), .Names = 'object');do.call('summary', argv) Number of cases in table: 88 Number of factors: 2 @@ -83595,7 +83595,7 @@ Error in as.raw(1:3) %*% 1:3 : [,1] [1,] NaN -##com.oracle.truffle.r.test.library.base.TestSimpleArithmetic.testMatricesProduct#Ignored.Unknown# +##com.oracle.truffle.r.test.library.base.TestSimpleArithmetic.testMatricesProduct# #{ c(1,2,NaN,NA) %*% c(1,3,3,4) } [,1] [1,] NA @@ -85075,7 +85075,7 @@ logical(0) #{ x<-c(1,2,3);x+TRUE } [1] 2 3 4 -##com.oracle.truffle.r.test.library.base.TestSimpleArithmetic.testVectorsComplex#WhiteList.arithmetic# +##com.oracle.truffle.r.test.library.base.TestSimpleArithmetic.testVectorsComplex# #x <- c(NaN, 3+2i); xre <- Re(x); xim <- (0+1i) * Im(x); xre + xim [1] NaN+0i 3+2i @@ -167454,7 +167454,7 @@ Error: the first argument must be of mode character [,1] [,2] [2,] 2 4 -##com.oracle.truffle.r.test.library.utils.TestUtils.testMethods#Ignored.ImplementationError# +##com.oracle.truffle.r.test.library.utils.TestUtils.testMethods# #methods(plot) [1] plot.HoltWinters* plot.TukeyHSD* plot.acf* [4] plot.data.frame* plot.decomposed.ts* plot.default diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_attributesassign.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_attributesassign.java index 1b6a07daec..3da11be7a2 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_attributesassign.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_attributesassign.java @@ -53,5 +53,6 @@ public class TestBuiltin_attributesassign extends TestBase { public void testArgsCasts() { assertEval("x <- 42; attributes(x) <- 44"); assertEval("x <- 42; attributes(x) <- NULL"); + assertEval("x <- 42; attributes(x) <- list()"); } } diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_c.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_c.java index 5b22103fc9..7dd4697df4 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_c.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_c.java @@ -86,12 +86,8 @@ public class TestBuiltin_c extends TestBase { @Test public void testc14() { - // FIXME FastR does not honor setting options(digits=ndecimaldigits) - // First test is a simplified problem on which the second test would fail too (besides that - // it should work fine) assertEval("options(digits=4);c(0.12345678912345,0.123)"); - assertEval(Ignored.OutputFormatting, - "argv <- list(`Grand mean` = structure(103.87323943662, class = 'mtable'), structure(list(N = structure(c(78.7365206866197, 98.5088731171753, 113.842206450509, 123.008873117175), .Dim = 4L, .Dimnames = structure(list(N = c('0.0cwt', '0.2cwt', '0.4cwt', '0.6cwt')), .Names = 'N'), class = 'mtable'), `V:N` = structure(c(79.5323303457107, 86.1989970123773, 69.7732394366197, 98.0323303457106, 108.032330345711, 89.1989970123773, 114.198997012377, 116.698997012377, 110.365663679044, 124.365663679044, 126.365663679044, 118.032330345711), .Dim = 3:4, .Dimnames = structure(list(V = c('Golden.rain', 'Marvellous', 'Victory'), N = c('0.0cwt', '0.2cwt', '0.4cwt', '0.6cwt')), .Names = c('V', 'N')), class = 'mtable')), .Names = c('N', 'V:N')));c(argv[[1]],argv[[2]]);"); + assertEval("argv <- list(`Grand mean` = structure(103.87323943662, class = 'mtable'), structure(list(N = structure(c(78.7365206866197, 98.5088731171753, 113.842206450509, 123.008873117175), .Dim = 4L, .Dimnames = structure(list(N = c('0.0cwt', '0.2cwt', '0.4cwt', '0.6cwt')), .Names = 'N'), class = 'mtable'), `V:N` = structure(c(79.5323303457107, 86.1989970123773, 69.7732394366197, 98.0323303457106, 108.032330345711, 89.1989970123773, 114.198997012377, 116.698997012377, 110.365663679044, 124.365663679044, 126.365663679044, 118.032330345711), .Dim = 3:4, .Dimnames = structure(list(V = c('Golden.rain', 'Marvellous', 'Victory'), N = c('0.0cwt', '0.2cwt', '0.4cwt', '0.6cwt')), .Names = c('V', 'N')), class = 'mtable')), .Names = c('N', 'V:N')));c(argv[[1]],argv[[2]]);"); } @Test diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_encodeString.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_encodeString.java index 29a4623970..332eb05d14 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_encodeString.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_encodeString.java @@ -39,8 +39,7 @@ public class TestBuiltin_encodeString extends TestBase { @Test public void testencodeString7() { - // FIXME No \b and \n encoding done in FastR - assertEval(Ignored.ImplementationError, "argv <- list('ab\\bc\\ndef', 0L, '', 0L, TRUE); .Internal(encodeString(argv[[1]], argv[[2]], argv[[3]], argv[[4]], argv[[5]]))"); + assertEval("argv <- list('ab\\bc\\ndef', 0L, '', 0L, TRUE); .Internal(encodeString(argv[[1]], argv[[2]], argv[[3]], argv[[4]], argv[[5]]))"); } @Test @@ -55,9 +54,7 @@ public class TestBuiltin_encodeString extends TestBase { @Test public void testencodeString10() { - // FIXME No \ to \\ encoding done - assertEval(Ignored.ImplementationError, - "argv <- list('\\\'class\\\' is a reserved slot name and cannot be redefined', 0L, '\\\'', 0L, FALSE); .Internal(encodeString(argv[[1]], argv[[2]], argv[[3]], argv[[4]], argv[[5]]))"); + assertEval("argv <- list('\\\'class\\\' is a reserved slot name and cannot be redefined', 0L, '\\\'', 0L, FALSE); .Internal(encodeString(argv[[1]], argv[[2]], argv[[3]], argv[[4]], argv[[5]]))"); } @Test diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_iconv.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_iconv.java index 9bb79a5737..2f835d1662 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_iconv.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_iconv.java @@ -24,10 +24,7 @@ public class TestBuiltin_iconv extends TestBase { @Test public void testiconv2() { - // FIXME ç is not an ASCII char (although it's an extended ASCII char wit code==135) - // and NA_character_ replacement leads to whole output to become NA - assertEval(Ignored.ImplementationError, - "argv <- list('façile' , 'latin1', 'ASCII', NA_character_, TRUE, FALSE); .Internal(iconv(argv[[1]], argv[[2]], argv[[3]], argv[[4]], argv[[5]], argv[[6]]))"); + assertEval("argv <- list('façile' , 'latin1', 'ASCII', NA_character_, TRUE, FALSE); .Internal(iconv(argv[[1]], argv[[2]], argv[[3]], argv[[4]], argv[[5]], argv[[6]]))"); } @Test @@ -55,9 +52,7 @@ public class TestBuiltin_iconv extends TestBase { @Test public void testiconv7() { - // FIXME ç is not an ASCII char (although it's an extended ASCII char wit code==135) - // so GnuR elimination of ç character is correct. - assertEval(Ignored.ImplementationError, "argv <- list('façile' , 'latin1', 'ASCII', '', TRUE, FALSE); .Internal(iconv(argv[[1]], argv[[2]], argv[[3]], argv[[4]], argv[[5]], argv[[6]]))"); + assertEval("argv <- list('façile' , 'latin1', 'ASCII', '', TRUE, FALSE); .Internal(iconv(argv[[1]], argv[[2]], argv[[3]], argv[[4]], argv[[5]], argv[[6]]))"); } @Test diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_identical.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_identical.java index c5fd6055e2..ecb854a29a 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_identical.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_identical.java @@ -256,11 +256,8 @@ public class TestBuiltin_identical extends TestBase { // functions - // GnuR adds a srcref attribute, FastR does not, so we really can't do any comparative - // tests. - assertEval(Ignored.ImplementationError, "{ f1 <- function() {}; f2 <- function() {}; identical(f1, f2) }"); - assertEval(Ignored.ImplementationError, "{ identical(function() 42, function() 42) }"); - + assertEval("{ f1 <- function() {}; f2 <- function() {}; identical(f1, f2) }"); + assertEval("{ identical(function() 42, function() 42) }"); } @Test diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_list.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_list.java index 9087339f29..7b5ffe64de 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_list.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_list.java @@ -187,8 +187,7 @@ public class TestBuiltin_list extends TestBase { @Test public void testlist33() { - assertEval(Ignored.OutputFormatting, - "argv <- list(tables = structure(list(`Grand mean` = 103.87323943662, N = structure(c(78.7365206866197, 98.5088731171753, 113.842206450509, 123.008873117175), .Dim = 4L, .Dimnames = structure(list(N = c('0.0cwt', '0.2cwt', '0.4cwt', '0.6cwt')), .Names = 'N'), class = 'mtable'), `V:N` = structure(c(79.5323303457107, 86.1989970123773, 69.7732394366197, 98.0323303457106, 108.032330345711, 89.1989970123773, 114.198997012377, 116.698997012377, 110.365663679044, 124.365663679044, 126.365663679044, 118.032330345711), .Dim = 3:4, .Dimnames = structure(list(V = c('Golden.rain', 'Marvellous', 'Victory'), N = c('0.0cwt', '0.2cwt', '0.4cwt', '0.6cwt')), .Names = c('V', 'N')), class = 'mtable')), .Names = c('Grand mean', 'N', 'V:N')), n = structure(list(N = structure(c(17, 18, 18, 18), .Dim = 4L, .Dimnames = structure(list(N = c('0.0cwt', '0.2cwt', '0.4cwt', '0.6cwt')), .Names = 'N')), `V:N` = structure(c(6, 6, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6), .Dim = 3:4, .Dimnames = structure(list(V = c('Golden.rain', 'Marvellous', 'Victory'), N = c('0.0cwt', '0.2cwt', '0.4cwt', '0.6cwt')), .Names = c('V', 'N')))), .Names = c('N', 'V:N')));list(argv[[1]],argv[[2]]);"); + assertEval("argv <- list(tables = structure(list(`Grand mean` = 103.87323943662, N = structure(c(78.7365206866197, 98.5088731171753, 113.842206450509, 123.008873117175), .Dim = 4L, .Dimnames = structure(list(N = c('0.0cwt', '0.2cwt', '0.4cwt', '0.6cwt')), .Names = 'N'), class = 'mtable'), `V:N` = structure(c(79.5323303457107, 86.1989970123773, 69.7732394366197, 98.0323303457106, 108.032330345711, 89.1989970123773, 114.198997012377, 116.698997012377, 110.365663679044, 124.365663679044, 126.365663679044, 118.032330345711), .Dim = 3:4, .Dimnames = structure(list(V = c('Golden.rain', 'Marvellous', 'Victory'), N = c('0.0cwt', '0.2cwt', '0.4cwt', '0.6cwt')), .Names = c('V', 'N')), class = 'mtable')), .Names = c('Grand mean', 'N', 'V:N')), n = structure(list(N = structure(c(17, 18, 18, 18), .Dim = 4L, .Dimnames = structure(list(N = c('0.0cwt', '0.2cwt', '0.4cwt', '0.6cwt')), .Names = 'N')), `V:N` = structure(c(6, 6, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6), .Dim = 3:4, .Dimnames = structure(list(V = c('Golden.rain', 'Marvellous', 'Victory'), N = c('0.0cwt', '0.2cwt', '0.4cwt', '0.6cwt')), .Names = c('V', 'N')))), .Names = c('N', 'V:N')));list(argv[[1]],argv[[2]]);"); } @Test diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_operators.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_operators.java index 81dafef3a6..d5454e3d33 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_operators.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_operators.java @@ -223,11 +223,7 @@ public class TestBuiltin_operators extends TestBase { @Test public void testoperators39() { - // FIXME number of digits in output: - // GnuR: 79.38889 98.88889 114.22222 123.38889 - // FastR: 79.3889 98.8889 114.2222 123.3889 - assertEval(Ignored.OutputFormatting, - "argv <- list(structure(c(-24.5833333333333, -5.08333333333333, 10.25, 19.4166666666667), .Dim = 4L, .Dimnames = structure(list(N = c('0.0cwt', '0.2cwt', '0.4cwt', '0.6cwt')), .Names = 'N'), strata = structure('Within', .Names = 'N'), class = 'mtable'), structure(103.972222222222, class = 'mtable'));`+`(argv[[1]],argv[[2]]);"); + assertEval("argv <- list(structure(c(-24.5833333333333, -5.08333333333333, 10.25, 19.4166666666667), .Dim = 4L, .Dimnames = structure(list(N = c('0.0cwt', '0.2cwt', '0.4cwt', '0.6cwt')), .Names = 'N'), strata = structure('Within', .Names = 'N'), class = 'mtable'), structure(103.972222222222, class = 'mtable'));`+`(argv[[1]],argv[[2]]);"); } @Test diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_range.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_range.java index a59ce3191e..ba33e425f1 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_range.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_range.java @@ -175,7 +175,10 @@ public class TestBuiltin_range extends TestBase { @Test public void testNaRmAndFiniteWithLogical() { - assertEval(template("range(c(T, F, NA, NA, T)%0)", OPTIONAL_ARGS)); + assertEval("range(c(T, F, NA, NA, T))"); + assertEval("range(c(T, F, NA, NA, T), na.rm=T)"); + // GNU R doesn't honor "finite implies na.rm" for logical + assertEval(Ignored.ReferenceError, "range(c(T, F, NA, NA, T), finite=T)"); } @Test diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_rowMeans.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_rowMeans.java index d5c271e0c1..b441e70b3f 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_rowMeans.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_rowMeans.java @@ -12,7 +12,6 @@ package com.oracle.truffle.r.test.builtins; import org.junit.Test; -import com.oracle.truffle.r.test.ArithmeticWhiteList; import com.oracle.truffle.r.test.TestBase; // Checkstyle: stop line length check @@ -55,15 +54,13 @@ public class TestBuiltin_rowMeans extends TestBase { assertEval("{rowMeans(matrix(c(TRUE,FALSE,FALSE,NA),nrow=2,ncol=2), na.rm = TRUE)}"); assertEval("{rowMeans(matrix(c(TRUE,FALSE,FALSE,NaN),nrow=2,ncol=2), na.rm = FALSE)}"); assertEval("{rowMeans(matrix(c(TRUE,FALSE,FALSE,NA),nrow=2,ncol=2), na.rm = FALSE)}"); - assertEval(ArithmeticWhiteList.WHITELIST, "{rowMeans(matrix(c(NaN,4+5i,2+0i,5+10i),nrow=2,ncol=2), na.rm = TRUE)}"); + assertEval("{rowMeans(matrix(c(NaN,4+5i,2+0i,5+10i),nrow=2,ncol=2), na.rm = TRUE)}"); + // Whichever value(NA or NaN) is first in the row will be returned for that row. assertEval("{rowMeans(matrix(c(NA,NaN,NaN,NA),ncol=2,nrow=2))}"); assertEval("{x<-matrix(c(\"1\",\"2\",\"3\",\"4\"),ncol=2);rowMeans(x)}"); - assertEval(ArithmeticWhiteList.WHITELIST, "{rowMeans(matrix(c(NaN,4+5i,2+0i,5+10i),nrow=2,ncol=2), na.rm = FALSE)}"); - // FIXME GnuR error description slightly better for matrix() - // Expected output: Error in matrix(NA, NA, NA) : invalid 'nrow' value (too large or NA) - // FastR output: Error: the dims contain missing values - assertEval(Ignored.OutputFormatting, "{rowMeans(matrix(NA,NA,NA),TRUE)}"); + assertEval("{rowMeans(matrix(c(NaN,4+5i,2+0i,5+10i),nrow=2,ncol=2), na.rm = FALSE)}"); + assertEval("{rowMeans(matrix(NA,NA,NA),TRUE)}"); } } diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_summary.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_summary.java index 4005ecd53c..8523b9af8c 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_summary.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_summary.java @@ -20,10 +20,8 @@ public class TestBuiltin_summary extends TestBase { @Test public void testsummary1() { - // Little rounding difference 1.4189 vs. 1.419 in FastR - assertEval(Ignored.OutputFormatting, - "argv <- structure(list(object = structure(c(4L, 4L, 4L, 4L, 4L, 3L, 4L, 4L, 4L, 4L, 3L, 4L, 3L, 4L, 4L, 4L, 4L, 2L, 4L, 3L, 4L, 4L, 4L, 2L), .Dim = c(6L, 4L), .Dimnames = structure(list(c('25-34', '35-44', '45-54', '55-64', '65-74', '75+'), c('0-39g/day', '40-79', '80-119', '120+')), .Names = c('', '')), class = 'table')), .Names = 'object');" + - "do.call('summary', argv)"); + assertEval("argv <- structure(list(object = structure(c(4L, 4L, 4L, 4L, 4L, 3L, 4L, 4L, 4L, 4L, 3L, 4L, 3L, 4L, 4L, 4L, 4L, 2L, 4L, 3L, 4L, 4L, 4L, 2L), .Dim = c(6L, 4L), .Dimnames = structure(list(c('25-34', '35-44', '45-54', '55-64', '65-74', '75+'), c('0-39g/day', '40-79', '80-119', '120+')), .Names = c('', '')), class = 'table')), .Names = 'object');" + + "do.call('summary', argv)"); } @Test diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/base/TestSimpleArithmetic.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/base/TestSimpleArithmetic.java index 4919034187..be6e824235 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/base/TestSimpleArithmetic.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/base/TestSimpleArithmetic.java @@ -306,7 +306,7 @@ public class TestSimpleArithmetic extends TestBase { public void testVectorsComplex() { assertEval("{ 1:4+c(1,2+2i) }"); assertEval("{ c(1,2+2i)+1:4 }"); - assertEval(ArithmeticWhiteList.WHITELIST, "x <- c(NaN, 3+2i); xre <- Re(x); xim <- (0+1i) * Im(x); xre + xim"); + assertEval("x <- c(NaN, 3+2i); xre <- Re(x); xim <- (0+1i) * Im(x); xre + xim"); } @Test @@ -475,7 +475,7 @@ public class TestSimpleArithmetic extends TestBase { assertEval("{ options(matprod = 'blas'); matrix(c(NaN,1,7,2,4,NA), nrow=3) %*% matrix(c(3,1,NA,2,NaN,5,6,7), nrow=2) }"); // NaN vs. NA issue assertEval(Ignored.Unknown, "{ c(1,2,NA,NaN) %*% c(1,3,3,4) }"); - assertEval(Ignored.Unknown, "{ c(1,2,NaN,NA) %*% c(1,3,3,4) }"); + assertEval("{ c(1,2,NaN,NA) %*% c(1,3,3,4) }"); assertEval(Ignored.Unknown, "{ c(1,2,2,3) %*% c(1,3,NA,NaN) }"); assertEval("{ c(1,2,2,3) %*% c(1,3,NaN,NA) }"); } diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/utils/TestUtils.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/utils/TestUtils.java index 9153421fab..5c9cd054ba 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/utils/TestUtils.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/utils/TestUtils.java @@ -41,8 +41,7 @@ public class TestUtils extends TestBase { @Test public void testMethods() { - // The vector of methods is not sorted alphabetically - assertEval(Ignored.ImplementationError, "methods(plot)"); + assertEval("methods(plot)"); } private static final String[] TEST_OCTSIZE_PARAMS = {"1L", "1.0", Integer.toString(Integer.MAX_VALUE), "NA", "NULL"}; -- GitLab