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

disabled FastrTckTest

parent a5f16732
No related branches found
No related tags found
No related merge requests found
...@@ -22,482 +22,477 @@ ...@@ -22,482 +22,477 @@
*/ */
package com.oracle.truffle.r.test.tck; package com.oracle.truffle.r.test.tck;
import static org.junit.Assert.assertTrue; public class FastRTckTest /* extends TruffleTCK */ {
import org.junit.Test; // disabled
import com.oracle.truffle.api.source.Source; // @Test
import com.oracle.truffle.api.vm.PolyglotEngine; // public void testVerifyPresence() {
import com.oracle.truffle.api.vm.PolyglotEngine.Builder; // PolyglotEngine vm = PolyglotEngine.newBuilder().build();
import com.oracle.truffle.r.runtime.RRuntime; // assertTrue("Our language is present", vm.getLanguages().containsKey("text/x-r"));
import com.oracle.truffle.tck.TruffleTCK; // }
//
public class FastRTckTest extends TruffleTCK { // // @formatter:off
@Test // private static final String INITIALIZATION_CODE =
public void testVerifyPresence() { // "fourtyTwo <- function() {\n" +
PolyglotEngine vm = PolyglotEngine.newBuilder().build(); // " 42L\n" +
assertTrue("Our language is present", vm.getLanguages().containsKey("text/x-r")); // "}\n" +
} // "plus <- function(a, b) {\n" +
// " a + b\n" +
// @formatter:off // "}\n" +
private static final String INITIALIZATION_CODE = // "identity <- function(a) {\n" +
"fourtyTwo <- function() {\n" + // " a\n" +
" 42L\n" + // "}\n" +
"}\n" + // "apply <- function(f) {\n" +
"plus <- function(a, b) {\n" + // " f(18L, 32L) + 10L\n" +
" a + b\n" + // "}\n" +
"}\n" + // "null <- function() {\n" +
"identity <- function(a) {\n" + // " NULL\n" +
" a\n" + // "}\n" +
"}\n" + // "counter <- 0L\n" +
"apply <- function(f) {\n" + // "count <- function() {\n" +
" f(18L, 32L) + 10L\n" + // " counter <<- counter + 1L\n" +
"}\n" + // "}\n" +
"null <- function() {\n" + // "complexAdd <- function(a, b) {\n" +
" NULL\n" + // " a$imaginary <- a$imaginary + b$imaginary\n" +
"}\n" + // " a$real <- a$real + b$real\n" +
"counter <- 0L\n" + // "}\n" +
"count <- function() {\n" + // "countUpWhile <- function(fn) {\n" +
" counter <<- counter + 1L\n" + // " counter <- 0\n" +
"}\n" + // " while (T) {\n" +
"complexAdd <- function(a, b) {\n" + // " if (!fn(counter)) {\n" +
" a$imaginary <- a$imaginary + b$imaginary\n" + // " break\n" +
" a$real <- a$real + b$real\n" + // " }\n" +
"}\n" + // " counter <- counter + 1\n" +
"countUpWhile <- function(fn) {\n" + // " }\n" +
" counter <- 0\n" + // "}\n" +
" while (T) {\n" + // "complexSumReal <- function(a) {\n" +
" if (!fn(counter)) {\n" + // " sum <- 0\n" +
" break\n" + // " for (i in 1:length(a)) {\n" +
" }\n" + // " sum <- sum + a[i]$real\n" +
" counter <- counter + 1\n" + // " }\n" +
" }\n" + // " return(sum)\n" +
"}\n" + // "}\n" +
"complexSumReal <- function(a) {\n" + // "complexCopy <- function(a, b) {\n" +
" sum <- 0\n" + // " for (i in 0:(length(b)-1)) {\n" +
" for (i in 1:length(a)) {\n" + // " a[i]$real <- b[i]$real\n" +
" sum <- sum + a[i]$real\n" + // " a[i]$imaginary <- b[i]$imaginary\n" +
" }\n" + // " }\n" +
" return(sum)\n" + // "}\n" +
"}\n" + // "valuesObject <- function() {\n" +
"complexCopy <- function(a, b) {\n" + // " list('byteValue'=0L, 'shortValue'=0L, 'intValue'=0L, 'longValue'=0L, 'floatValue'=0, 'doubleValue'=0, 'charValue'=48L, 'stringValue'='', 'booleanValue'=FALSE)\n" +
" for (i in 0:(length(b)-1)) {\n" + // "}\n" +
" a[i]$real <- b[i]$real\n" + // "addNumbersFunction <- function() {\n" +
" a[i]$imaginary <- b[i]$imaginary\n" + // " function(a, b) a + b\n" +
" }\n" + // "}\n" +
"}\n" + // "objectWithValueProperty <- function() {\n" +
"valuesObject <- function() {\n" + // " list(value = 42L)\n" +
" list('byteValue'=0L, 'shortValue'=0L, 'intValue'=0L, 'longValue'=0L, 'floatValue'=0, 'doubleValue'=0, 'charValue'=48L, 'stringValue'='', 'booleanValue'=FALSE)\n" + // "}\n" +
"}\n" + // "callFunction <- function(f) {\n" +
"addNumbersFunction <- function() {\n" + // " f(41L, 42L)\n" +
" function(a, b) a + b\n" + // "}\n" +
"}\n" + // "objectWithElement <- function(f) {\n" +
"objectWithValueProperty <- function() {\n" + // " c(0L, 0L, 42L, 0L)\n" +
" list(value = 42L)\n" + // "}\n" +
"}\n" + // "objectWithValueAndAddProperty <- function(f) {\n" +
"callFunction <- function(f) {\n" + // " e <- new.env()\n" +
" f(41L, 42L)\n" + // " e$value <- 0L\n" +
"}\n" + // " e$add <- function(inc) { e$value <- e$value + inc; e$value }\n" +
"objectWithElement <- function(f) {\n" + // " e\n" +
" c(0L, 0L, 42L, 0L)\n" + // "}\n" +
"}\n" + // "callMethod <- function(f) {\n" +
"objectWithValueAndAddProperty <- function(f) {\n" + // " f(41L, 42L)\n" +
" e <- new.env()\n" + // "}\n" +
" e$value <- 0L\n" + // "readElementFromForeign <- function(f) {\n" +
" e$add <- function(inc) { e$value <- e$value + inc; e$value }\n" + // " f[[3L]]\n" +
" e\n" + // "}\n" +
"}\n" + // "writeElementToForeign <- function(f) {\n" +
"callMethod <- function(f) {\n" + // " f[[3L]] <- 42L\n" +
" f(41L, 42L)\n" + // "}\n" +
"}\n" + // "readValueFromForeign <- function(o) {\n" +
"readElementFromForeign <- function(f) {\n" + // " o$value\n" +
" f[[3L]]\n" + // "}\n" +
"}\n" + // "writeValueToForeign <- function(o) {\n" +
"writeElementToForeign <- function(f) {\n" + // " o$value <- 42L\n" +
" f[[3L]] <- 42L\n" + // "}\n" +
"}\n" + // "getSizeOfForeign <- function(o) {\n" +
"readValueFromForeign <- function(o) {\n" + // " length(o)\n" +
" o$value\n" + // "}\n" +
"}\n" + // "isNullOfForeign <- function(o) {\n" +
"writeValueToForeign <- function(o) {\n" + // " .fastr.interop.toBoolean(is.external.null(o))\n" +
" o$value <- 42L\n" + // "}\n" +
"}\n" + // "hasSizeOfForeign <- function(o) {\n" +
"getSizeOfForeign <- function(o) {\n" + // " .fastr.interop.toBoolean(is.external.array(o))\n" +
" length(o)\n" + // "}\n" +
"}\n" + // "isExecutableOfForeign <- function(o) {\n" +
"isNullOfForeign <- function(o) {\n" + // " .fastr.interop.toBoolean(is.external.executable(o))\n" +
" .fastr.interop.toBoolean(is.external.null(o))\n" + // "}\n" +
"}\n" + // "intValue <- function() 42L\n" +
"hasSizeOfForeign <- function(o) {\n" + // "intVectorValue <- function() c(42L, 40L)\n" +
" .fastr.interop.toBoolean(is.external.array(o))\n" + // "intSequenceValue <- function() 42:50\n" +
"}\n" + // "intType <- function() 'integer'\n" +
"isExecutableOfForeign <- function(o) {\n" + // "doubleValue <- function() 42.1\n" +
" .fastr.interop.toBoolean(is.external.executable(o))\n" + // "doubleVectorValue <- function() c(42.1, 40)\n" +
"}\n" + // "doubleSequenceValue <- function() 42.1:50\n" +
"intValue <- function() 42L\n" + // "doubleType <- function() 'double'\n" +
"intVectorValue <- function() c(42L, 40L)\n" + // "functionValue <- function() { function(x) 1 }\n" +
"intSequenceValue <- function() 42:50\n" + // "functionType <- function() 'closure'\n" +
"intType <- function() 'integer'\n" + // "builtinFunctionValue <- function() `+`\n" +
"doubleValue <- function() 42.1\n" + // "builtinFunctionType <- function() 'builtin'\n" +
"doubleVectorValue <- function() c(42.1, 40)\n" + // "valueWithSource <- function() intValue\n" +
"doubleSequenceValue <- function() 42.1:50\n" + // "objectWithKeyInfoAttributes <- function() { list(rw=1, invocable=function(){ 'invoked' }) }\n" +
"doubleType <- function() 'double'\n" + // "for (name in ls()) export(name, get(name))\n";
"functionValue <- function() { function(x) 1 }\n" + // // @formatter:on
"functionType <- function() 'closure'\n" + //
"builtinFunctionValue <- function() `+`\n" + // private static final Source INITIALIZATION =
"builtinFunctionType <- function() 'builtin'\n" + // Source.newBuilder(INITIALIZATION_CODE).name("TCK").mimeType(RRuntime.R_APP_MIME).build();
"valueWithSource <- function() intValue\n" + //
"objectWithKeyInfoAttributes <- function() { list(rw=1, invocable=function(){ 'invoked' }) }\n" + // @Override
"for (name in ls()) export(name, get(name))\n"; // protected PolyglotEngine prepareVM(Builder builder) throws Exception {
// @formatter:on // PolyglotEngine engine = builder.build();
// engine.eval(INITIALIZATION).get();
private static final Source INITIALIZATION = Source.newBuilder(INITIALIZATION_CODE).name("TCK").mimeType(RRuntime.R_APP_MIME).build(); // return engine;
// }
@Override //
protected PolyglotEngine prepareVM(Builder builder) throws Exception { // @Override
PolyglotEngine engine = builder.build(); // protected String mimeType() {
engine.eval(INITIALIZATION).get(); // return "text/x-r";
return engine; // }
} //
// @Override
@Override // protected String fourtyTwo() {
protected String mimeType() { // return "fourtyTwo";
return "text/x-r"; // }
} //
// @Override
@Override // protected String plusInt() {
protected String fourtyTwo() { // return "plus";
return "fourtyTwo"; // }
} //
// @Override
@Override // protected String identity() {
protected String plusInt() { // return "identity";
return "plus"; // }
} //
// @Override
@Override // protected String returnsNull() {
protected String identity() { // return "null";
return "identity"; // }
} //
// @Override
@Override // protected String applyNumbers() {
protected String returnsNull() { // return "apply";
return "null"; // }
} //
// @Override
@Override // protected String countInvocations() {
protected String applyNumbers() { // return "count";
return "apply"; // }
} //
// @Override
@Override // protected String complexAdd() {
protected String countInvocations() { // return "complexAdd";
return "count"; // }
} //
// @Override
@Override // protected String complexSumReal() {
protected String complexAdd() { // return "complexSumReal";
return "complexAdd"; // }
} //
// @Override
@Override // protected String complexCopy() {
protected String complexSumReal() { // return "complexCopy";
return "complexSumReal"; // }
} //
// @Override
@Override // protected String invalidCode() {
protected String complexCopy() { // return "main <- function() {\n";
return "complexCopy"; // }
} //
// @Override
@Override // protected String valuesObject() {
protected String invalidCode() { // return "valuesObject";
return "main <- function() {\n"; // }
} //
// @Override
@Override // protected String countUpWhile() {
protected String valuesObject() { // return "countUpWhile";
return "valuesObject"; // }
} //
// @Override
@Override // protected String addToArray() {
protected String countUpWhile() { // // TODO not yet supported
return "countUpWhile"; // return null;
} // }
//
@Override // @Override
protected String addToArray() { // protected String getSizeOfForeign() {
// TODO not yet supported // return "getSizeOfForeign";
return null; // }
} //
// @Override
@Override // protected String isNullForeign() {
protected String getSizeOfForeign() { // return "isNullOfForeign";
return "getSizeOfForeign"; // }
} //
// @Override
@Override // protected String hasSizeOfForeign() {
protected String isNullForeign() { // return "hasSizeOfForeign";
return "isNullOfForeign"; // }
} //
// @Override
@Override // protected String isExecutableOfForeign() {
protected String hasSizeOfForeign() { // return "isExecutableOfForeign";
return "hasSizeOfForeign"; // }
} //
// @Override
@Override // protected String readValueFromForeign() {
protected String isExecutableOfForeign() { // return "readValueFromForeign";
return "isExecutableOfForeign"; // }
} //
// @Override
@Override // protected String writeValueToForeign() {
protected String readValueFromForeign() { // return "writeValueToForeign";
return "readValueFromForeign"; // }
} //
// @Override
@Override // protected String callFunction() {
protected String writeValueToForeign() { // return "callFunction";
return "writeValueToForeign"; // }
} //
// @Override
@Override // protected String objectWithElement() {
protected String callFunction() { // return "objectWithElement";
return "callFunction"; // }
} //
// @Override
@Override // protected String objectWithValueAndAddProperty() {
protected String objectWithElement() { // return "objectWithValueAndAddProperty";
return "objectWithElement"; // }
} //
// @Override
@Override // protected String callMethod() {
protected String objectWithValueAndAddProperty() { // return "callMethod";
return "objectWithValueAndAddProperty"; // }
} //
// @Override
@Override // protected String readElementFromForeign() {
protected String callMethod() { // return "readElementFromForeign";
return "callMethod"; // }
} //
// @Override
@Override // protected String writeElementToForeign() {
protected String readElementFromForeign() { // return "writeElementToForeign";
return "readElementFromForeign"; // }
} //
// @Override
@Override // protected String objectWithValueProperty() {
protected String writeElementToForeign() { // return "objectWithValueProperty";
return "writeElementToForeign"; // }
} //
// @Override
@Override // protected String functionAddNumbers() {
protected String objectWithValueProperty() { // return "addNumbersFunction";
return "objectWithValueProperty"; // }
} //
// @Override
@Override // public void readWriteBooleanValue() throws Exception {
protected String functionAddNumbers() { // // TODO not yet supported
return "addNumbersFunction"; // }
} //
// @Override
@Override // public void readWriteCharValue() throws Exception {
public void readWriteBooleanValue() throws Exception { // // TODO not yet supported
// TODO not yet supported // }
} //
// @Override
@Override // public void readWriteShortValue() throws Exception {
public void readWriteCharValue() throws Exception { // // TODO not yet supported
// TODO not yet supported // }
} //
// @Override
@Override // public void readWriteByteValue() throws Exception {
public void readWriteShortValue() throws Exception { // // TODO not yet supported
// TODO not yet supported // }
} //
// @Override
@Override // public void readWriteFloatValue() throws Exception {
public void readWriteByteValue() throws Exception { // // TODO not yet supported
// TODO not yet supported // }
} //
// @Override
@Override // public void testAddComplexNumbersWithMethod() throws Exception {
public void readWriteFloatValue() throws Exception { // // TODO not yet supported
// TODO not yet supported // }
} //
// @Override
@Override // @Test
public void testAddComplexNumbersWithMethod() throws Exception { // public void testNull() {
// TODO not yet supported // // disabled because we don't provide a Java "null" value in R
} // }
//
@Override // @Override
@Test // @Test
public void testNull() { // public void testNullInCompoundObject() {
// disabled because we don't provide a Java "null" value in R // // disabled because we don't provide a Java "null" value in R
} // }
//
@Override // @Override
@Test // @Test
public void testNullInCompoundObject() { // public void testPlusWithIntsOnCompoundObject() throws Exception {
// disabled because we don't provide a Java "null" value in R // // TODO support this test case.
} // }
//
@Override // @Override
@Test // @Test
public void testPlusWithIntsOnCompoundObject() throws Exception { // public void testMaxOrMinValue() throws Exception {
// TODO support this test case. // // TODO support this test case.
} // }
//
@Override // @Override
@Test // @Test
public void testMaxOrMinValue() throws Exception { // public void testMaxOrMinValue2() throws Exception {
// TODO support this test case. // // TODO support this test case.
} // }
//
@Override // @Override
@Test // @Test
public void testMaxOrMinValue2() throws Exception { // public void testFortyTwoWithCompoundObject() throws Exception {
// TODO support this test case. // // TODO support this test case.
} // }
//
@Override // @Override
@Test // public void testPlusWithFloat() throws Exception {
public void testFortyTwoWithCompoundObject() throws Exception { // // no floats in FastR
// TODO support this test case. // }
} //
// @Override
@Override // public void testPrimitiveReturnTypeFloat() throws Exception {
public void testPlusWithFloat() throws Exception { // // no floats in FastR
// no floats in FastR // }
} //
// @Override
@Override // public void testPlusWithOneNegativeShort() throws Exception {
public void testPrimitiveReturnTypeFloat() throws Exception { // // no floats in FastR
// no floats in FastR // }
} //
// @Override
@Override // public void testPlusWithDoubleFloatSameAsInt() throws Exception {
public void testPlusWithOneNegativeShort() throws Exception { // // no floats in FastR
// no floats in FastR // }
} //
// @Override
@Override // public void testPlusWithLongMaxIntMinInt() throws Exception {
public void testPlusWithDoubleFloatSameAsInt() throws Exception { // // no longs in FastR
// no floats in FastR // }
} //
// @Override
@Override // public void testPlusWithLong() throws Exception {
public void testPlusWithLongMaxIntMinInt() throws Exception { // // no longs in FastR
// no longs in FastR // }
} //
// @Override
@Override // public void testPrimitiveReturnTypeLong() throws Exception {
public void testPlusWithLong() throws Exception { // // no longs in FastR
// no longs in FastR // }
} //
// @Override
@Override // public void testPlusWithBytes() throws Exception {
public void testPrimitiveReturnTypeLong() throws Exception { // // no bytes in FastR
// no longs in FastR // }
} //
// @Override
@Override // public void testPlusWithOneNegativeByte() throws Exception {
public void testPlusWithBytes() throws Exception { // // no bytes in FastR
// no bytes in FastR // }
} //
// @Override
@Override // public void testPlusWithShort() throws Exception {
public void testPlusWithOneNegativeByte() throws Exception { // // no shorts in FastR
// no bytes in FastR // }
} //
// @Override
@Override // public void testPrimitiveReturnTypeShort() throws Exception {
public void testPlusWithShort() throws Exception { // // no shorts in FastR
// no shorts in FastR // }
} //
// @Override
@Override // public void testGlobalObjectIsAccessible() throws Exception {
public void testPrimitiveReturnTypeShort() throws Exception { // // no global object in fastr.
// no shorts in FastR // }
} //
// @Override
@Override // public void testNullCanBeCastToAnything() throws Exception {
public void testGlobalObjectIsAccessible() throws Exception { // // TODO support
// no global object in fastr. // }
} //
// @Override
@Override // public void multiplyTwoVariables() throws Exception {
public void testNullCanBeCastToAnything() throws Exception { // // TODO support
// TODO support // }
} //
// @Override
@Override // public void testEvaluateSource() throws Exception {
public void multiplyTwoVariables() throws Exception { // // TODO support
// TODO support // }
} //
// @Override
@Override // public void testCopyComplexNumbersA() {
public void testEvaluateSource() throws Exception { // // TODO determine the semantics of assignments to a[i]$b
// TODO support // }
} //
// @Override
@Override // public void testCopyComplexNumbersB() {
public void testCopyComplexNumbersA() { // // TODO determine the semantics of assignments to a[i]$b
// TODO determine the semantics of assignments to a[i]$b // }
} //
// @Override
@Override // public void testCopyStructuredComplexToComplexNumbersA() {
public void testCopyComplexNumbersB() { // // TODO determine the semantics of assignments to a[i]$b
// TODO determine the semantics of assignments to a[i]$b // }
} //
// @Override
@Override // public void testAddComplexNumbers() {
public void testCopyStructuredComplexToComplexNumbersA() { // // TODO determine the semantics of assignments to a[i]$b
// TODO determine the semantics of assignments to a[i]$b // }
} //
// @Override
@Override // public void testWriteToObjectWithElement() throws Exception {
public void testAddComplexNumbers() { // // TODO mismatch between mutable and immutable data types
// TODO determine the semantics of assignments to a[i]$b // }
} //
// @Override
@Override // public void testObjectWithValueAndAddProperty() throws Exception {
public void testWriteToObjectWithElement() throws Exception { // // TODO mismatch between mutable and immutable data types
// TODO mismatch between mutable and immutable data types // }
} //
// @Override
@Override // public void testCallMethod() throws Exception {
public void testObjectWithValueAndAddProperty() throws Exception { // // R does not have method calls
// TODO mismatch between mutable and immutable data types // }
} //
// @Override
@Override // public String multiplyCode(String firstName, String secondName) {
public void testCallMethod() throws Exception { // return firstName + '*' + secondName;
// R does not have method calls // }
} //
// @Override
@Override // protected String[] metaObjects() {
public String multiplyCode(String firstName, String secondName) { // return new String[]{
return firstName + '*' + secondName; // "intValue", "intType", "intVectorValue", "intType", "intSequenceValue", "intType",
} // "doubleValue", "doubleType", "doubleVectorValue", "doubleType", "doubleSequenceValue",
// "doubleType",
@Override // "functionValue", "functionType",
protected String[] metaObjects() { // "builtinFunctionValue", "builtinFunctionType"};
return new String[]{ // }
"intValue", "intType", "intVectorValue", "intType", "intSequenceValue", "intType", //
"doubleValue", "doubleType", "doubleVectorValue", "doubleType", "doubleSequenceValue", "doubleType", // @Override
"functionValue", "functionType", // protected String valueWithSource() {
"builtinFunctionValue", "builtinFunctionType"}; // return "valueWithSource";
} // }
//
@Override // @Override
protected String valueWithSource() { // protected String objectWithKeyInfoAttributes() {
return "valueWithSource"; // return "objectWithKeyInfoAttributes";
} // }
@Override
protected String objectWithKeyInfoAttributes() {
return "objectWithKeyInfoAttributes";
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment