author | Jaroslav Tulach <jaroslav.tulach@apidesign.org> |
Mon, 13 May 2013 11:39:33 +0200 | |
changeset 1201 | b6fd8b9ccc7a |
permissions | -rw-r--r-- |
jaroslav@1201 | 1 |
package ${package}; |
jaroslav@1201 | 2 |
|
jaroslav@1201 | 3 |
import org.apidesign.bck2brwsr.vmtest.Compare; |
jaroslav@1201 | 4 |
import org.apidesign.bck2brwsr.vmtest.VMTest; |
jaroslav@1201 | 5 |
import org.testng.annotations.Factory; |
jaroslav@1201 | 6 |
|
jaroslav@1201 | 7 |
/** Bck2brwsr cares about compatibility with real Java. Whatever API is |
jaroslav@1201 | 8 |
* supported by bck2brwsr, it needs to behave the same way as when running |
jaroslav@1201 | 9 |
* in HotSpot VM. |
jaroslav@1201 | 10 |
* <p> |
jaroslav@1201 | 11 |
* There can be bugs, however. To help us fix them, we kindly ask you to |
jaroslav@1201 | 12 |
* write an "inconsistency" test. A test that compares behavior of the API |
jaroslav@1201 | 13 |
* between real VM and bck2brwsr VM. This class is skeleton of such test. |
jaroslav@1201 | 14 |
* |
jaroslav@1201 | 15 |
* @author Jaroslav Tulach <jtulach@netbeans.org> |
jaroslav@1201 | 16 |
*/ |
jaroslav@1201 | 17 |
public class InconsistencyTest { |
jaroslav@1201 | 18 |
/** A method to demonstrate inconsistency between bck2brwsr and HotSpot. |
jaroslav@1201 | 19 |
* Make calls to an API that behaves strangely, return some result at |
jaroslav@1201 | 20 |
* the end. No need to use any <code>assert</code>. |
jaroslav@1201 | 21 |
* |
jaroslav@1201 | 22 |
* @return value to compare between HotSpot and bck2brwsr |
jaroslav@1201 | 23 |
*/ |
jaroslav@1201 | 24 |
@Compare |
jaroslav@1201 | 25 |
public int checkStringHashCode() throws Exception { |
jaroslav@1201 | 26 |
return "Is string hashCode the same?".hashCode(); |
jaroslav@1201 | 27 |
} |
jaroslav@1201 | 28 |
|
jaroslav@1201 | 29 |
/** Factory method that creates a three tests for each method annotated with |
jaroslav@1201 | 30 |
* {@link org.apidesign.bck2brwsr.vmtest.Compare}. One executes the code in |
jaroslav@1201 | 31 |
* HotSpot, one in Rhino and the last one compares the results. |
jaroslav@1201 | 32 |
* |
jaroslav@1201 | 33 |
* @see org.apidesign.bck2brwsr.vmtest.VMTest |
jaroslav@1201 | 34 |
*/ |
jaroslav@1201 | 35 |
@Factory |
jaroslav@1201 | 36 |
public static Object[] create() { |
jaroslav@1201 | 37 |
return VMTest.create(InconsistencyTest.class); |
jaroslav@1201 | 38 |
} |
jaroslav@1201 | 39 |
|
jaroslav@1201 | 40 |
} |