You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@Linearisation@Consequence(id="[1]", expectation=Expectation.ACCEPTABLE, description="get correct value set"@Consequence(id="[-1]", expectation=Expectation.ACCEPTABLE, description="unable to get value set, get was called before set"@Consequence(id="[-2]", expectation=Expectation.FORBIDDEN, description="exception thrown while trying to get"@Ref("https://github.com/tmjee/linearisability/blob/master/docs/results/create_custom_linearisation_tests.md")
publicclassMyLinearisationTest {
@InvariantpublicstaticclassMyState {
volatileList<Integer> myLockFreeThreadSafeList = newMyLockFreeThreadSafeList();
}
@RecordpublicclassMyIntResult1 {
publicvolatileintvalue1;
@OverridepublicStringtoString() {
returnformat("[%s]", value1);
}
}
@TestUnit(name="myLinearisationTest"description="This is my Linearisation test")
publicstaticclassTestUnit1 {
@Playerpublicvoidplayer1(MyStatestate, MyIntResult1result) {
// the state and result objects will be the same for both player 1 and 2state.myLockFreeThreadSafeList.set(1,1);
}
@Playerpublicvoidplayer2(MyStatestate, IntResult1result) {
try {
// the state and result objects will be the same for both player 1 and 2Integeri = state.myLockFreeThreadSafeList.get(1);
result.value1 = (i == null ? -1 : (i == 1 ? 1 : -1));
} catch(Exceptione) {
i = -2;
}
}
}
}
Compile code, to generate java and class files and meta data xml file