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