mirror of
https://github.com/Qortal/AT.git
synced 2025-01-30 19:02:14 +00:00
Rename 'MachineState.getIsSleeping()', and similar, to proper 'isSleeping()'
Examples: getHadFatalError() to hadFatalError() getIsSleeping() to isSleeping() etc.
This commit is contained in:
parent
a58b4d4bec
commit
ee2a81430c
@ -854,7 +854,7 @@ public enum FunctionCode {
|
|||||||
functionData.returnValue = state.getAPI().generateRandomUsingTransactionInA(state);
|
functionData.returnValue = state.getAPI().generateRandomUsingTransactionInA(state);
|
||||||
|
|
||||||
// If API set isSleeping then rewind program counter (actually codeByteBuffer) ready for being awoken
|
// If API set isSleeping then rewind program counter (actually codeByteBuffer) ready for being awoken
|
||||||
if (state.getIsSleeping()) {
|
if (state.isSleeping()) {
|
||||||
// EXT_FUN_RET(1) + our function code(2) + address(4)
|
// EXT_FUN_RET(1) + our function code(2) + address(4)
|
||||||
state.rewindCodePosition(MachineState.OPCODE_SIZE + MachineState.FUNCTIONCODE_SIZE + MachineState.ADDRESS_SIZE);
|
state.rewindCodePosition(MachineState.OPCODE_SIZE + MachineState.FUNCTIONCODE_SIZE + MachineState.ADDRESS_SIZE);
|
||||||
|
|
||||||
|
@ -273,7 +273,7 @@ public class MachineState {
|
|||||||
this.onErrorAddress = address;
|
this.onErrorAddress = address;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getIsSleeping() {
|
public boolean isSleeping() {
|
||||||
return this.isSleeping;
|
return this.isSleeping;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -289,7 +289,7 @@ public class MachineState {
|
|||||||
this.sleepUntilHeight = height;
|
this.sleepUntilHeight = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getIsStopped() {
|
public boolean isStopped() {
|
||||||
return this.isStopped;
|
return this.isStopped;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -297,7 +297,7 @@ public class MachineState {
|
|||||||
this.isStopped = isStopped;
|
this.isStopped = isStopped;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getIsFrozen() {
|
public boolean isFrozen() {
|
||||||
return this.isFrozen;
|
return this.isFrozen;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,7 +313,7 @@ public class MachineState {
|
|||||||
this.frozenBalance = frozenBalance;
|
this.frozenBalance = frozenBalance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getIsFinished() {
|
public boolean isFinished() {
|
||||||
return this.isFinished;
|
return this.isFinished;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -321,7 +321,7 @@ public class MachineState {
|
|||||||
this.isFinished = isFinished;
|
this.isFinished = isFinished;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getHadFatalError() {
|
public boolean hadFatalError() {
|
||||||
return this.hadFatalError;
|
return this.hadFatalError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,8 +31,8 @@ public class BlockchainFunctionCodeTests extends ExecutableTest {
|
|||||||
Timestamp blockTimestamp = new Timestamp(getData(0));
|
Timestamp blockTimestamp = new Timestamp(getData(0));
|
||||||
assertEquals("Block timestamp incorrect", TestAPI.DEFAULT_INITIAL_BLOCK_HEIGHT, blockTimestamp.blockHeight);
|
assertEquals("Block timestamp incorrect", TestAPI.DEFAULT_INITIAL_BLOCK_HEIGHT, blockTimestamp.blockHeight);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -55,7 +55,7 @@ public class BlockchainFunctionCodeTests extends ExecutableTest {
|
|||||||
blockTimestamp = new Timestamp(getData(0));
|
blockTimestamp = new Timestamp(getData(0));
|
||||||
assertEquals("Block timestamp incorrect", expectedBlockHeight, blockTimestamp.blockHeight);
|
assertEquals("Block timestamp incorrect", expectedBlockHeight, blockTimestamp.blockHeight);
|
||||||
|
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -69,8 +69,8 @@ public class BlockchainFunctionCodeTests extends ExecutableTest {
|
|||||||
Timestamp blockTimestamp = new Timestamp(getData(0));
|
Timestamp blockTimestamp = new Timestamp(getData(0));
|
||||||
assertEquals("Block timestamp incorrect", TestAPI.DEFAULT_AT_CREATION_BLOCK_HEIGHT, blockTimestamp.blockHeight);
|
assertEquals("Block timestamp incorrect", TestAPI.DEFAULT_AT_CREATION_BLOCK_HEIGHT, blockTimestamp.blockHeight);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -86,8 +86,8 @@ public class BlockchainFunctionCodeTests extends ExecutableTest {
|
|||||||
Timestamp blockTimestamp = new Timestamp(getData(0));
|
Timestamp blockTimestamp = new Timestamp(getData(0));
|
||||||
assertEquals("Block timestamp incorrect", expectedBlockHeight, blockTimestamp.blockHeight);
|
assertEquals("Block timestamp incorrect", expectedBlockHeight, blockTimestamp.blockHeight);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -104,8 +104,8 @@ public class BlockchainFunctionCodeTests extends ExecutableTest {
|
|||||||
byte[] aBytes = api.getA(state);
|
byte[] aBytes = api.getA(state);
|
||||||
assertTrue("Block hash mismatch", Arrays.equals(expectedBlockHash, aBytes));
|
assertTrue("Block hash mismatch", Arrays.equals(expectedBlockHash, aBytes));
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -141,8 +141,8 @@ public class BlockchainFunctionCodeTests extends ExecutableTest {
|
|||||||
Timestamp txTimestamp = new Timestamp(transaction.timestamp);
|
Timestamp txTimestamp = new Timestamp(transaction.timestamp);
|
||||||
assertEquals("Transaction hash mismatch", currentBlockHeight, txTimestamp.blockHeight);
|
assertEquals("Transaction hash mismatch", currentBlockHeight, txTimestamp.blockHeight);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -188,8 +188,8 @@ public class BlockchainFunctionCodeTests extends ExecutableTest {
|
|||||||
long transactionsCount = getData(2);
|
long transactionsCount = getData(2);
|
||||||
assertEquals("Transaction count incorrect", expectedTransactionsCount, transactionsCount);
|
assertEquals("Transaction count incorrect", expectedTransactionsCount, transactionsCount);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -235,8 +235,8 @@ public class BlockchainFunctionCodeTests extends ExecutableTest {
|
|||||||
long messageTxType = getData(2);
|
long messageTxType = getData(2);
|
||||||
assertEquals("Message tx type mismatch", messageTx.txType.value, messageTxType);
|
assertEquals("Message tx type mismatch", messageTx.txType.value, messageTxType);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -282,8 +282,8 @@ public class BlockchainFunctionCodeTests extends ExecutableTest {
|
|||||||
long messageTxAmount = getData(2);
|
long messageTxAmount = getData(2);
|
||||||
assertEquals("Message tx amount mismatch", messageTx.amount, messageTxAmount);
|
assertEquals("Message tx amount mismatch", messageTx.amount, messageTxAmount);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -299,8 +299,8 @@ public class BlockchainFunctionCodeTests extends ExecutableTest {
|
|||||||
execute(false);
|
execute(false);
|
||||||
|
|
||||||
assertNotEquals("Random wasn't generated", 0L, getData(1));
|
assertNotEquals("Random wasn't generated", 0L, getData(1));
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -358,8 +358,8 @@ public class BlockchainFunctionCodeTests extends ExecutableTest {
|
|||||||
getDataBytes(8, actualMessage);
|
getDataBytes(8, actualMessage);
|
||||||
assertTrue("Message tx message mismatch", Arrays.equals(expectedMessage, actualMessage));
|
assertTrue("Message tx message mismatch", Arrays.equals(expectedMessage, actualMessage));
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -402,8 +402,8 @@ public class BlockchainFunctionCodeTests extends ExecutableTest {
|
|||||||
String actualSender = TestAPI.decodeAddress(actualSenderBytes);
|
String actualSender = TestAPI.decodeAddress(actualSenderBytes);
|
||||||
assertEquals("Sender address string mismatch", expectedSender, actualSender);
|
assertEquals("Sender address string mismatch", expectedSender, actualSender);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -428,8 +428,8 @@ public class BlockchainFunctionCodeTests extends ExecutableTest {
|
|||||||
String actualAtCreator = TestAPI.decodeAddress(actualAtCreatorBytes);
|
String actualAtCreator = TestAPI.decodeAddress(actualAtCreatorBytes);
|
||||||
assertEquals("AT creator address string mismatch", expectedAtCreator, actualAtCreator);
|
assertEquals("AT creator address string mismatch", expectedAtCreator, actualAtCreator);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -468,8 +468,8 @@ public class BlockchainFunctionCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
assertEquals("Final 'current balance' mismatch", expectedBalance, getData(3));
|
assertEquals("Final 'current balance' mismatch", expectedBalance, getData(3));
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -492,7 +492,7 @@ public class BlockchainFunctionCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
assertEquals("Final 'previous balance' mismatch", expectedBalance, getData(1));
|
assertEquals("Final 'previous balance' mismatch", expectedBalance, getData(1));
|
||||||
|
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -531,7 +531,7 @@ public class BlockchainFunctionCodeTests extends ExecutableTest {
|
|||||||
actualBalance = recipient.balance;
|
actualBalance = recipient.balance;
|
||||||
assertEquals("Final recipient balance mismatch", expectedBalance, actualBalance);
|
assertEquals("Final recipient balance mismatch", expectedBalance, actualBalance);
|
||||||
|
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -574,7 +574,7 @@ public class BlockchainFunctionCodeTests extends ExecutableTest {
|
|||||||
actualBalance = recipient.balance;
|
actualBalance = recipient.balance;
|
||||||
assertEquals("Final recipient balance mismatch", expectedBalance, actualBalance);
|
assertEquals("Final recipient balance mismatch", expectedBalance, actualBalance);
|
||||||
|
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -613,7 +613,7 @@ public class BlockchainFunctionCodeTests extends ExecutableTest {
|
|||||||
actualBalance = recipient.balance;
|
actualBalance = recipient.balance;
|
||||||
assertEquals("Final recipient balance mismatch", expectedBalance, actualBalance);
|
assertEquals("Final recipient balance mismatch", expectedBalance, actualBalance);
|
||||||
|
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -652,7 +652,7 @@ public class BlockchainFunctionCodeTests extends ExecutableTest {
|
|||||||
actualBalance = recipient.balance;
|
actualBalance = recipient.balance;
|
||||||
assertEquals("Final recipient balance mismatch", expectedBalance, actualBalance);
|
assertEquals("Final recipient balance mismatch", expectedBalance, actualBalance);
|
||||||
|
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -700,7 +700,7 @@ public class BlockchainFunctionCodeTests extends ExecutableTest {
|
|||||||
actualBalance = recipient.balance;
|
actualBalance = recipient.balance;
|
||||||
assertEquals("Final recipient balance mismatch", expectedBalance, actualBalance);
|
assertEquals("Final recipient balance mismatch", expectedBalance, actualBalance);
|
||||||
|
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -744,8 +744,8 @@ public class BlockchainFunctionCodeTests extends ExecutableTest {
|
|||||||
byte[] actualMessage = recipient.messages.get(0);
|
byte[] actualMessage = recipient.messages.get(0);
|
||||||
assertTrue("Recipient message incorrect", Arrays.equals(message, actualMessage));
|
assertTrue("Recipient message incorrect", Arrays.equals(message, actualMessage));
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -769,8 +769,8 @@ public class BlockchainFunctionCodeTests extends ExecutableTest {
|
|||||||
long actualTimestamp = getData(2);
|
long actualTimestamp = getData(2);
|
||||||
assertEquals("Expected timestamp incorrect", expectedTimestamp, actualTimestamp);
|
assertEquals("Expected timestamp incorrect", expectedTimestamp, actualTimestamp);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -31,8 +31,8 @@ public class BranchingOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", 2L, getData(1));
|
assertEquals("Data does not match", 2L, getData(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ public class BranchingOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getHadFatalError());
|
assertTrue(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -63,7 +63,7 @@ public class BranchingOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getHadFatalError());
|
assertTrue(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -83,8 +83,8 @@ public class BranchingOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", 2L, getData(1));
|
assertEquals("Data does not match", 2L, getData(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,8 +105,8 @@ public class BranchingOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", 1L, getData(1));
|
assertEquals("Data does not match", 1L, getData(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,8 +127,8 @@ public class BranchingOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", 2L, getData(1));
|
assertEquals("Data does not match", 2L, getData(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,8 +149,8 @@ public class BranchingOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", 1L, getData(1));
|
assertEquals("Data does not match", 1L, getData(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,8 +172,8 @@ public class BranchingOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", 2L, getData(2));
|
assertEquals("Data does not match", 2L, getData(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,8 +195,8 @@ public class BranchingOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", 1L, getData(2));
|
assertEquals("Data does not match", 1L, getData(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,8 +218,8 @@ public class BranchingOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", 2L, getData(2));
|
assertEquals("Data does not match", 2L, getData(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,8 +241,8 @@ public class BranchingOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", 1L, getData(2));
|
assertEquals("Data does not match", 1L, getData(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,8 +264,8 @@ public class BranchingOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", 2L, getData(2));
|
assertEquals("Data does not match", 2L, getData(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -287,8 +287,8 @@ public class BranchingOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", 2L, getData(2));
|
assertEquals("Data does not match", 2L, getData(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -310,8 +310,8 @@ public class BranchingOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", 1L, getData(2));
|
assertEquals("Data does not match", 1L, getData(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -333,8 +333,8 @@ public class BranchingOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", 2L, getData(2));
|
assertEquals("Data does not match", 2L, getData(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -356,8 +356,8 @@ public class BranchingOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", 2L, getData(2));
|
assertEquals("Data does not match", 2L, getData(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -379,8 +379,8 @@ public class BranchingOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", 1L, getData(2));
|
assertEquals("Data does not match", 1L, getData(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -402,8 +402,8 @@ public class BranchingOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", 2L, getData(2));
|
assertEquals("Data does not match", 2L, getData(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -425,8 +425,8 @@ public class BranchingOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", 1L, getData(2));
|
assertEquals("Data does not match", 1L, getData(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -448,8 +448,8 @@ public class BranchingOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", 2L, getData(2));
|
assertEquals("Data does not match", 2L, getData(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -471,8 +471,8 @@ public class BranchingOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", 1L, getData(2));
|
assertEquals("Data does not match", 1L, getData(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,8 +25,8 @@ public class CallStackOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
|
|
||||||
int expectedCallStackPosition = (state.numCallStackPages - 1) * MachineState.ADDRESS_SIZE;
|
int expectedCallStackPosition = (state.numCallStackPages - 1) * MachineState.ADDRESS_SIZE;
|
||||||
assertEquals("Call stack pointer incorrect", expectedCallStackPosition, getCallStackPosition());
|
assertEquals("Call stack pointer incorrect", expectedCallStackPosition, getCallStackPosition());
|
||||||
@ -59,8 +59,8 @@ public class CallStackOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
|
|
||||||
int expectedCallStackPosition = (state.numCallStackPages - 1 - 1) * MachineState.ADDRESS_SIZE;
|
int expectedCallStackPosition = (state.numCallStackPages - 1 - 1) * MachineState.ADDRESS_SIZE;
|
||||||
assertEquals("Call stack pointer incorrect", expectedCallStackPosition, getCallStackPosition());
|
assertEquals("Call stack pointer incorrect", expectedCallStackPosition, getCallStackPosition());
|
||||||
@ -83,8 +83,8 @@ public class CallStackOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertTrue(state.getHadFatalError());
|
assertTrue(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -103,8 +103,8 @@ public class CallStackOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
|
|
||||||
int expectedCallStackPosition = (state.numCallStackPages - 1 + 1) * MachineState.ADDRESS_SIZE;
|
int expectedCallStackPosition = (state.numCallStackPages - 1 + 1) * MachineState.ADDRESS_SIZE;
|
||||||
assertEquals("Call stack pointer incorrect", expectedCallStackPosition, getCallStackPosition());
|
assertEquals("Call stack pointer incorrect", expectedCallStackPosition, getCallStackPosition());
|
||||||
@ -140,8 +140,8 @@ public class CallStackOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
|
|
||||||
int expectedCallStackPosition = (state.numCallStackPages - 1 - 1 + 1 + 1) * MachineState.ADDRESS_SIZE;
|
int expectedCallStackPosition = (state.numCallStackPages - 1 - 1 + 1 + 1) * MachineState.ADDRESS_SIZE;
|
||||||
assertEquals("Call stack pointer incorrect", expectedCallStackPosition, getCallStackPosition());
|
assertEquals("Call stack pointer incorrect", expectedCallStackPosition, getCallStackPosition());
|
||||||
@ -161,8 +161,8 @@ public class CallStackOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertTrue(state.getHadFatalError());
|
assertTrue(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -175,8 +175,8 @@ public class CallStackOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertTrue(state.getHadFatalError());
|
assertTrue(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,8 +16,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", 2222L, getData(2));
|
assertEquals("Data does not match", 2222L, getData(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,8 +29,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertTrue(state.getHadFatalError());
|
assertTrue(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -41,8 +41,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", 2222L, getData(1));
|
assertEquals("Data does not match", 2222L, getData(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,8 +54,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertTrue(state.getHadFatalError());
|
assertTrue(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Check that trying to use an address outside data segment throws a fatal error. */
|
/** Check that trying to use an address outside data segment throws a fatal error. */
|
||||||
@ -66,8 +66,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertTrue(state.getHadFatalError());
|
assertTrue(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -78,8 +78,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
|
|
||||||
// Check data all zero
|
// Check data all zero
|
||||||
for (int i = 0; i < 0x0020; ++i)
|
for (int i = 0; i < 0x0020; ++i)
|
||||||
@ -94,8 +94,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertTrue(state.getHadFatalError());
|
assertTrue(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -106,8 +106,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", 2222L + 1L, getData(2));
|
assertEquals("Data does not match", 2222L + 1L, getData(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,8 +119,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertTrue(state.getHadFatalError());
|
assertTrue(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Check that incrementing maximum unsigned long value overflows back to zero correctly. */
|
/** Check that incrementing maximum unsigned long value overflows back to zero correctly. */
|
||||||
@ -132,8 +132,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", 0L, getData(2));
|
assertEquals("Data does not match", 0L, getData(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,8 +145,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", 2222L - 1L, getData(2));
|
assertEquals("Data does not match", 2222L - 1L, getData(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,8 +157,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
codeByteBuffer.put(OpCode.FIN_IMD.value);
|
codeByteBuffer.put(OpCode.FIN_IMD.value);
|
||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertTrue(state.getHadFatalError());
|
assertTrue(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Check that decrementing zero long value underflows back to maximum unsigned long correctly. */
|
/** Check that decrementing zero long value underflows back to maximum unsigned long correctly. */
|
||||||
@ -170,8 +170,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", 0xffffffffffffffffL, getData(2));
|
assertEquals("Data does not match", 0xffffffffffffffffL, getData(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,8 +184,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", 2222L + 3333L, getData(2));
|
assertEquals("Data does not match", 2222L + 3333L, getData(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,8 +197,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertTrue(state.getHadFatalError());
|
assertTrue(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Check that trying to use an address outside data segment throws a fatal error. */
|
/** Check that trying to use an address outside data segment throws a fatal error. */
|
||||||
@ -209,8 +209,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertTrue(state.getHadFatalError());
|
assertTrue(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Check that adding to an unsigned long value overflows correctly. */
|
/** Check that adding to an unsigned long value overflows correctly. */
|
||||||
@ -223,8 +223,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", 0x0000000000000098L, getData(2));
|
assertEquals("Data does not match", 0x0000000000000098L, getData(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,8 +237,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", 3333L - 2222L, getData(3));
|
assertEquals("Data does not match", 3333L - 2222L, getData(3));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,8 +251,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", (3333L * 2222L), getData(3));
|
assertEquals("Data does not match", (3333L * 2222L), getData(3));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,8 +265,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", (3333L / 2222L), getData(3));
|
assertEquals("Data does not match", (3333L / 2222L), getData(3));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -280,8 +280,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertTrue(state.getHadFatalError());
|
assertTrue(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Check divide-by-zero is non-fatal because error handler is set. */
|
/** Check divide-by-zero is non-fatal because error handler is set. */
|
||||||
@ -304,8 +304,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Error flag not set", 1L, getData(1));
|
assertEquals("Error flag not set", 1L, getData(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,8 +318,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", (3333L | 2222L), getData(3));
|
assertEquals("Data does not match", (3333L | 2222L), getData(3));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -332,8 +332,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", (3333L & 2222L), getData(3));
|
assertEquals("Data does not match", (3333L & 2222L), getData(3));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -346,8 +346,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", (3333L ^ 2222L), getData(3));
|
assertEquals("Data does not match", (3333L ^ 2222L), getData(3));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -359,8 +359,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", ~2222L, getData(2));
|
assertEquals("Data does not match", ~2222L, getData(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -380,8 +380,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", 3333L, getData(6));
|
assertEquals("Data does not match", 3333L, getData(6));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -400,8 +400,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertTrue(state.getHadFatalError());
|
assertTrue(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Check that trying to use an address outside data segment throws a fatal error. */
|
/** Check that trying to use an address outside data segment throws a fatal error. */
|
||||||
@ -419,8 +419,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertTrue(state.getHadFatalError());
|
assertTrue(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -438,8 +438,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", 4444L, getData(0));
|
assertEquals("Data does not match", 4444L, getData(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -459,8 +459,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertTrue(state.getHadFatalError());
|
assertTrue(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Check that trying to use an address outside data segment throws a fatal error. */
|
/** Check that trying to use an address outside data segment throws a fatal error. */
|
||||||
@ -479,8 +479,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertTrue(state.getHadFatalError());
|
assertTrue(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Check that trying to use an address outside data segment throws a fatal error. */
|
/** Check that trying to use an address outside data segment throws a fatal error. */
|
||||||
@ -499,8 +499,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertTrue(state.getHadFatalError());
|
assertTrue(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Check that trying to use an address outside data segment throws a fatal error. */
|
/** Check that trying to use an address outside data segment throws a fatal error. */
|
||||||
@ -519,8 +519,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertTrue(state.getHadFatalError());
|
assertTrue(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -537,8 +537,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", 5555L, getData(3));
|
assertEquals("Data does not match", 5555L, getData(3));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -557,8 +557,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertTrue(state.getHadFatalError());
|
assertTrue(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Check that trying to use an address outside data segment throws a fatal error. */
|
/** Check that trying to use an address outside data segment throws a fatal error. */
|
||||||
@ -576,8 +576,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertTrue(state.getHadFatalError());
|
assertTrue(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -595,8 +595,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", 5555L, getData(4));
|
assertEquals("Data does not match", 5555L, getData(4));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -616,8 +616,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertTrue(state.getHadFatalError());
|
assertTrue(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Check that trying to use an address outside data segment throws a fatal error. */
|
/** Check that trying to use an address outside data segment throws a fatal error. */
|
||||||
@ -636,8 +636,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertTrue(state.getHadFatalError());
|
assertTrue(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Check that trying to use an address outside data segment throws a fatal error. */
|
/** Check that trying to use an address outside data segment throws a fatal error. */
|
||||||
@ -656,8 +656,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertTrue(state.getHadFatalError());
|
assertTrue(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Check that trying to use an address outside data segment throws a fatal error. */
|
/** Check that trying to use an address outside data segment throws a fatal error. */
|
||||||
@ -676,8 +676,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertTrue(state.getHadFatalError());
|
assertTrue(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -689,8 +689,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", 2222L % 3333L, getData(2));
|
assertEquals("Data does not match", 2222L % 3333L, getData(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -704,8 +704,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertTrue(state.getHadFatalError());
|
assertTrue(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Check divide-by-zero is non-fatal because error handler is set. */
|
/** Check divide-by-zero is non-fatal because error handler is set. */
|
||||||
@ -728,8 +728,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Error flag not set", 1L, getData(1));
|
assertEquals("Error flag not set", 1L, getData(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -742,8 +742,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", 2222L << 3, getData(2));
|
assertEquals("Data does not match", 2222L << 3, getData(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -756,8 +756,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", 0L, getData(2));
|
assertEquals("Data does not match", 0L, getData(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -770,8 +770,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", 2222L >>> 3, getData(2));
|
assertEquals("Data does not match", 2222L >>> 3, getData(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -784,8 +784,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", 0L, getData(2));
|
assertEquals("Data does not match", 0L, getData(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -798,8 +798,8 @@ public class DataOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", -1L >>> 3, getData(2));
|
assertEquals("Data does not match", -1L >>> 3, getData(2));
|
||||||
assertTrue("Sign does not match", getData(2) >= 0);
|
assertTrue("Sign does not match", getData(2) >= 0);
|
||||||
}
|
}
|
||||||
|
@ -46,8 +46,8 @@ public class FunctionCodeTests extends ExecutableTest {
|
|||||||
getDataBytes(destAddress, dest);
|
getDataBytes(destAddress, dest);
|
||||||
assertTrue("Data wasn't copied correctly", Arrays.equals(TEST_BYTES, dest));
|
assertTrue("Data wasn't copied correctly", Arrays.equals(TEST_BYTES, dest));
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -57,8 +57,8 @@ public class FunctionCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertTrue(state.getHadFatalError());
|
assertTrue(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -69,8 +69,8 @@ public class FunctionCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -81,8 +81,8 @@ public class FunctionCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertTrue(state.getHadFatalError());
|
assertTrue(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -89,8 +89,8 @@ public class HashingFunctionCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue("MachineState isn't in finished state", state.getIsFinished());
|
assertTrue("MachineState isn't in finished state", state.isFinished());
|
||||||
assertFalse("MachineState encountered fatal error", state.getHadFatalError());
|
assertFalse("MachineState encountered fatal error", state.hadFatalError());
|
||||||
assertEquals(hashName + " hashes do not match", 1L, getData(1));
|
assertEquals(hashName + " hashes do not match", 1L, getData(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,8 +118,8 @@ public class HashingFunctionCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue("MachineState isn't in finished state", state.getIsFinished());
|
assertTrue("MachineState isn't in finished state", state.isFinished());
|
||||||
assertFalse("MachineState encountered fatal error", state.getHadFatalError());
|
assertFalse("MachineState encountered fatal error", state.hadFatalError());
|
||||||
assertEquals(hashName + " hashes do not match", 1L, getData(1));
|
assertEquals(hashName + " hashes do not match", 1L, getData(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,8 +22,8 @@ public class MiscTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", testValue, getData(0));
|
assertEquals("Data does not match", testValue, getData(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,8 +33,8 @@ public class MiscTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertTrue(state.getHadFatalError());
|
assertTrue(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -47,7 +47,7 @@ public class MiscTests extends ExecutableTest {
|
|||||||
for (long i = 0; i < minRounds; ++i)
|
for (long i = 0; i < minRounds; ++i)
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFrozen());
|
assertTrue(state.isFrozen());
|
||||||
|
|
||||||
Long frozenBalance = state.getFrozenBalance();
|
Long frozenBalance = state.getFrozenBalance();
|
||||||
assertNotNull(frozenBalance);
|
assertNotNull(frozenBalance);
|
||||||
@ -64,7 +64,7 @@ public class MiscTests extends ExecutableTest {
|
|||||||
|
|
||||||
state = new MachineState(api, logger, headerBytes, codeBytes, dataBytes);
|
state = new MachineState(api, logger, headerBytes, codeBytes, dataBytes);
|
||||||
|
|
||||||
assertTrue(state.getIsFrozen());
|
assertTrue(state.isFrozen());
|
||||||
assertEquals((Long) (minActivationAmount - 1L), state.getFrozenBalance());
|
assertEquals((Long) (minActivationAmount - 1L), state.getFrozenBalance());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,8 +17,8 @@ public class OpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
|
|
||||||
// Check data unchanged
|
// Check data unchanged
|
||||||
for (int i = 0; i < 0x0020; ++i)
|
for (int i = 0; i < 0x0020; ++i)
|
||||||
@ -39,8 +39,8 @@ public class OpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Data does not match", 2L, getData(0));
|
assertEquals("Data does not match", 2L, getData(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,9 +54,9 @@ public class OpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsSleeping());
|
assertTrue(state.isSleeping());
|
||||||
assertFalse(state.getIsFinished());
|
assertFalse(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Sleep-until block height incorrect", blockHeight, getData(0));
|
assertEquals("Sleep-until block height incorrect", blockHeight, getData(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,9 +68,9 @@ public class OpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getIsSleeping());
|
assertFalse(state.isSleeping());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -81,9 +81,9 @@ public class OpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertFalse(state.getIsFinished());
|
assertFalse(state.isFinished());
|
||||||
assertTrue(state.getIsSleeping());
|
assertTrue(state.isSleeping());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -96,9 +96,9 @@ public class OpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsStopped());
|
assertTrue(state.isStopped());
|
||||||
assertFalse(state.getIsFinished());
|
assertFalse(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Program counter incorrect", stopAddress, state.getProgramCounter());
|
assertEquals("Program counter incorrect", stopAddress, state.getProgramCounter());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,9 +111,9 @@ public class OpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertFalse(state.getIsStopped());
|
assertFalse(state.isStopped());
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -123,9 +123,9 @@ public class OpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getIsStopped());
|
assertFalse(state.isStopped());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -138,9 +138,9 @@ public class OpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsStopped());
|
assertTrue(state.isStopped());
|
||||||
assertFalse(state.getIsFinished());
|
assertFalse(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Program counter incorrect", stopAddress, state.getProgramCounter());
|
assertEquals("Program counter incorrect", stopAddress, state.getProgramCounter());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,16 +153,16 @@ public class OpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsSleeping());
|
assertTrue(state.isSleeping());
|
||||||
assertFalse(state.getIsFinished());
|
assertFalse(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Program counter incorrect", postSleepAddress, state.getProgramCounter());
|
assertEquals("Program counter incorrect", postSleepAddress, state.getProgramCounter());
|
||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertFalse(state.getIsSleeping());
|
assertFalse(state.isSleeping());
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Program counter incorrect", postFinishAddress, state.getProgramCounter());
|
assertEquals("Program counter incorrect", postFinishAddress, state.getProgramCounter());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,8 +186,8 @@ public class OpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Error flag not set", 1L, getData(2));
|
assertEquals("Error flag not set", 1L, getData(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,8 +204,8 @@ public class OpCodeTests extends ExecutableTest {
|
|||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertEquals(expectedStopAddress, state.getOnStopAddress());
|
assertEquals(expectedStopAddress, state.getOnStopAddress());
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -219,8 +219,8 @@ public class OpCodeTests extends ExecutableTest {
|
|||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertEquals(expectedStopAddress, state.getOnStopAddress());
|
assertEquals(expectedStopAddress, state.getOnStopAddress());
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -46,8 +46,8 @@ public class SerializationTests extends ExecutableTest {
|
|||||||
simulate();
|
simulate();
|
||||||
|
|
||||||
assertEquals(expectedStopAddress, (int) state.getOnStopAddress());
|
assertEquals(expectedStopAddress, (int) state.getOnStopAddress());
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Test serialization of state with data pushed onto user stack. */
|
/** Test serialization of state with data pushed onto user stack. */
|
||||||
@ -78,8 +78,8 @@ public class SerializationTests extends ExecutableTest {
|
|||||||
byte[] savedState = simulate();
|
byte[] savedState = simulate();
|
||||||
|
|
||||||
assertEquals(expectedStopAddress, (int) state.getOnStopAddress());
|
assertEquals(expectedStopAddress, (int) state.getOnStopAddress());
|
||||||
assertTrue(state.getIsStopped());
|
assertTrue(state.isStopped());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
|
|
||||||
// Just after first STP_IMD we expect address 0 to be initialValue + increment
|
// Just after first STP_IMD we expect address 0 to be initialValue + increment
|
||||||
long expectedValue = initialValue + increment;
|
long expectedValue = initialValue + increment;
|
||||||
|
@ -18,8 +18,8 @@ public class UserStackOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
|
|
||||||
int expectedUserStackPosition = (state.numUserStackPages - 1) * MachineState.VALUE_SIZE;
|
int expectedUserStackPosition = (state.numUserStackPages - 1) * MachineState.VALUE_SIZE;
|
||||||
assertEquals("User stack pointer incorrect", expectedUserStackPosition, getUserStackPosition());
|
assertEquals("User stack pointer incorrect", expectedUserStackPosition, getUserStackPosition());
|
||||||
@ -36,8 +36,8 @@ public class UserStackOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
|
|
||||||
int expectedUserStackPosition = (state.numUserStackPages - 2) * MachineState.VALUE_SIZE;
|
int expectedUserStackPosition = (state.numUserStackPages - 2) * MachineState.VALUE_SIZE;
|
||||||
assertEquals("User stack pointer incorrect", expectedUserStackPosition, getUserStackPosition());
|
assertEquals("User stack pointer incorrect", expectedUserStackPosition, getUserStackPosition());
|
||||||
@ -55,8 +55,8 @@ public class UserStackOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertTrue(state.getHadFatalError());
|
assertTrue(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -79,8 +79,8 @@ public class UserStackOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
assertEquals("Error flag not set", 1L, getData(1));
|
assertEquals("Error flag not set", 1L, getData(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,8 +93,8 @@ public class UserStackOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
|
|
||||||
int expectedUserStackPosition = (state.numUserStackPages - 1 + 1) * MachineState.VALUE_SIZE;
|
int expectedUserStackPosition = (state.numUserStackPages - 1 + 1) * MachineState.VALUE_SIZE;
|
||||||
assertEquals("User stack pointer incorrect", expectedUserStackPosition, getUserStackPosition());
|
assertEquals("User stack pointer incorrect", expectedUserStackPosition, getUserStackPosition());
|
||||||
@ -115,8 +115,8 @@ public class UserStackOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertFalse(state.getHadFatalError());
|
assertFalse(state.hadFatalError());
|
||||||
|
|
||||||
int expectedUserStackPosition = (state.numUserStackPages - 1 - 1 + 1 + 1) * MachineState.VALUE_SIZE;
|
int expectedUserStackPosition = (state.numUserStackPages - 1 - 1 + 1 + 1) * MachineState.VALUE_SIZE;
|
||||||
assertEquals("User stack pointer incorrect", expectedUserStackPosition, getUserStackPosition());
|
assertEquals("User stack pointer incorrect", expectedUserStackPosition, getUserStackPosition());
|
||||||
@ -131,8 +131,8 @@ public class UserStackOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertTrue(state.getHadFatalError());
|
assertTrue(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -145,8 +145,8 @@ public class UserStackOpCodeTests extends ExecutableTest {
|
|||||||
|
|
||||||
execute(true);
|
execute(true);
|
||||||
|
|
||||||
assertTrue(state.getIsFinished());
|
assertTrue(state.isFinished());
|
||||||
assertTrue(state.getHadFatalError());
|
assertTrue(state.hadFatalError());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -79,18 +79,18 @@ public abstract class ExecutableTest {
|
|||||||
System.out.println(String.format("Stop Address: 0x%04x", state.getOnStopAddress()));
|
System.out.println(String.format("Stop Address: 0x%04x", state.getOnStopAddress()));
|
||||||
System.out.println("Error Address: " + (state.getOnErrorAddress() == null ? "not set" : String.format("0x%04x", state.getOnErrorAddress())));
|
System.out.println("Error Address: " + (state.getOnErrorAddress() == null ? "not set" : String.format("0x%04x", state.getOnErrorAddress())));
|
||||||
|
|
||||||
if (state.getIsSleeping())
|
if (state.isSleeping())
|
||||||
System.out.println("Sleeping until current block height (" + state.getCurrentBlockHeight() + ") reaches " + state.getSleepUntilHeight());
|
System.out.println("Sleeping until current block height (" + state.getCurrentBlockHeight() + ") reaches " + state.getSleepUntilHeight());
|
||||||
else
|
else
|
||||||
System.out.println("Sleeping: " + state.getIsSleeping());
|
System.out.println("Sleeping: " + state.isSleeping());
|
||||||
|
|
||||||
System.out.println("Stopped: " + state.getIsStopped());
|
System.out.println("Stopped: " + state.isStopped());
|
||||||
System.out.println("Finished: " + state.getIsFinished());
|
System.out.println("Finished: " + state.isFinished());
|
||||||
|
|
||||||
if (state.getHadFatalError())
|
if (state.hadFatalError())
|
||||||
System.out.println("Finished due to fatal error!");
|
System.out.println("Finished due to fatal error!");
|
||||||
|
|
||||||
System.out.println("Frozen: " + state.getIsFrozen());
|
System.out.println("Frozen: " + state.isFrozen());
|
||||||
|
|
||||||
long newBalance = state.getCurrentBalance();
|
long newBalance = state.getCurrentBalance();
|
||||||
System.out.println("New balance: " + TestAPI.prettyAmount(newBalance));
|
System.out.println("New balance: " + TestAPI.prettyAmount(newBalance));
|
||||||
@ -101,7 +101,7 @@ public abstract class ExecutableTest {
|
|||||||
|
|
||||||
packedState = state.toBytes();
|
packedState = state.toBytes();
|
||||||
System.out.println("Execution round finished\n");
|
System.out.println("Execution round finished\n");
|
||||||
} while (!onceOnly && !state.getIsFinished());
|
} while (!onceOnly && !state.isFinished());
|
||||||
|
|
||||||
unwrapState(state);
|
unwrapState(state);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user