Mercurial > hg > graal-compiler
diff graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/vm/TruffleTCK.java @ 21557:31fc2fce38f3
Merge.
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 27 May 2015 13:32:18 +0200 |
parents | b1530a6cce8c 3286fb5fea4a |
children | ed234a3178af |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/vm/TruffleTCK.java Wed May 27 00:36:16 2015 +0200 +++ b/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/vm/TruffleTCK.java Wed May 27 13:32:18 2015 +0200 @@ -24,6 +24,8 @@ import java.util.*; +import org.junit.*; + import com.oracle.truffle.api.vm.*; /** @@ -31,10 +33,10 @@ * requirements of the Truffle infrastructure and tooling. Subclass, implement abstract methods and * include in your test suite. */ -public abstract class TruffleTCK { - private TruffleVM vm; +public class TruffleTCK { // abstract + private TruffleVM tckVM; - protected TruffleTCK() { + public TruffleTCK() { // protected } /** @@ -46,8 +48,11 @@ * for internal testing. * * @return initialized Truffle virtual machine + * @throws java.lang.Exception thrown when the VM preparation fails */ - protected abstract TruffleVM prepareVM() throws Exception; + protected TruffleVM prepareVM() throws Exception { // abstract + return null; + } /** * Name of function which will return value 42 as a number. The return value of the method @@ -56,7 +61,9 @@ * * @return name of globally exported symbol */ - protected abstract String fourtyTwo(); + protected String fourtyTwo() { // abstract + return null; + } /** * Name of function to add two integer values together. The symbol will be invoked with two @@ -65,20 +72,26 @@ * * @return name of globally exported symbol */ - protected abstract String plusInt(); + protected String plusInt() { // abstract + return null; + } private TruffleVM vm() throws Exception { - if (vm == null) { - vm = prepareVM(); + if (tckVM == null) { + tckVM = prepareVM(); } - return vm; + return tckVM; } // // The tests // + @Test public void testFortyTwo() throws Exception { + if (getClass() == TruffleTCK.class) { + return; + } TruffleVM.Symbol fourtyTwo = findGlobalSymbol(fourtyTwo()); Object res = fourtyTwo.invoke(null); @@ -90,7 +103,11 @@ assert 42 == n.intValue() : "The value is 42 = " + n.intValue(); } + @Test public void testPlusWithInts() throws Exception { + if (getClass() == TruffleTCK.class) { + return; + } Random r = new Random(); int a = r.nextInt(100); int b = r.nextInt(100);