Skip to content
Snippets Groups Projects
Commit 5e2cfd40 authored by Tomas Stupka's avatar Tomas Stupka
Browse files

added as.integer testcase

parent e242a9cb
Branches
No related tags found
No related merge requests found
...@@ -7262,6 +7262,12 @@ Error: (list) object cannot be coerced to type 'integer' ...@@ -7262,6 +7262,12 @@ Error: (list) object cannot be coerced to type 'integer'
#{ as.integer.cls <- function(x) 42; as.integer(structure(c(1,2), class='cls')); } #{ as.integer.cls <- function(x) 42; as.integer(structure(c(1,2), class='cls')); }
[1] 42 [1] 42
   
##com.oracle.truffle.r.test.builtins.TestBuiltin_asinteger.testAsInteger#Output.IgnoreWarningContext#
#{ f <- function() as.integer(10+2i); f() }
[1] 10
Warning message:
In f() : imaginary parts discarded in coercion
##com.oracle.truffle.r.test.builtins.TestBuiltin_asinteger.testAsInteger# ##com.oracle.truffle.r.test.builtins.TestBuiltin_asinteger.testAsInteger#
#{ x<-c(a=1.1, b=2.2); dim(x)<-c(1,2); attr(x, "foo")<-"foo"; y<-as.integer(x); attributes(y) } #{ x<-c(a=1.1, b=2.2); dim(x)<-c(1,2); attr(x, "foo")<-"foo"; y<-as.integer(x); attributes(y) }
NULL NULL
...@@ -138,6 +138,7 @@ public class TestBuiltin_asinteger extends TestBase { ...@@ -138,6 +138,7 @@ public class TestBuiltin_asinteger extends TestBase {
assertEval("{ as.integer(-0/0) }"); assertEval("{ as.integer(-0/0) }");
assertEval("{ as.integer(as.raw(c(1,2,3,4))) }"); assertEval("{ as.integer(as.raw(c(1,2,3,4))) }");
assertEval("{ as.integer(10+2i) }"); assertEval("{ as.integer(10+2i) }");
assertEval(Output.IgnoreWarningContext, "{ f <- function() as.integer(10+2i); f() }");
assertEval("{ as.integer(c(3+3i, 4+4i)) }"); assertEval("{ as.integer(c(3+3i, 4+4i)) }");
assertEval("{ as.integer(10000000000000) }"); assertEval("{ as.integer(10000000000000) }");
assertEval("{ as.integer(list(c(1),2,3)) }"); assertEval("{ as.integer(list(c(1),2,3)) }");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment