Commit ba078850 authored by Ivo Anjo's avatar Ivo Anjo

Added some more tests

parent 6ec1d233
......@@ -73,4 +73,35 @@ public class TransactionTest1 {
Assert.assertTrue(result);
}
@Test
public void testExplicitAbort() {
int status = Transaction.begin();
if (status == Transaction.STARTED) {
Transaction.abort();
} else {
if (status == 0) {
testExplicitAbort();
return;
}
Assert.assertEquals(status, 1);
}
}
@Test
public void testExplicitAbort2() {
for (int i = 0; i <= 255; i++) {
int txStatus = Transaction.begin();
if (txStatus == Transaction.STARTED) {
Transaction.abort(i);
} else {
if ((txStatus & 1) == 0) {
// Something went wrong, retry
i--;
continue;
}
Assert.assertEquals(Transaction.getAbortReason(txStatus), i);
}
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment