Fix assert description and move exception

This commit is contained in:
nicksavers 2014-10-15 11:12:55 +02:00
parent 4d4d188def
commit c26bca7d44
4 changed files with 6 additions and 7 deletions

View File

@ -298,7 +298,7 @@ public class TestRunner {
if (!expectedGas.equals(actualGas)) {
String output =
String.format("Gas usage is different. Expected gas usage: [ %s ], actual gas usage: [ %s ]",
String.format("Gas remaining is different. Expected gas remaining: [ %s ], actual gas remaining: [ %s ]",
expectedGas.toString() ,
actualGas.toString());
logger.info(output);

View File

@ -751,6 +751,9 @@ public class Program {
public class OutOfGasException extends RuntimeException {
}
@SuppressWarnings("serial")
public class IllegalOperationException extends RuntimeException {}
@SuppressWarnings("serial")
public class StackTooSmallException extends RuntimeException {
public StackTooSmallException(String message) {

View File

@ -80,7 +80,7 @@ public class VM {
OpCode op = OpCode.code(program.getCurrentOp());
if (op == null)
throw new IllegalOperationException();
throw program.new IllegalOperationException();
program.setLastOp(op.val());
@ -1080,7 +1080,4 @@ public class VM {
gasBefore, gasCost, memWords);
}
}
@SuppressWarnings("serial")
public class IllegalOperationException extends RuntimeException {}
}

View File

@ -5,7 +5,6 @@ import org.ethereum.util.ByteUtil;
import org.ethereum.vm.Program.OutOfGasException;
import org.ethereum.vm.Program.PcOverflowException;
import org.ethereum.vm.Program.StackTooSmallException;
import org.ethereum.vm.VM.IllegalOperationException;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runners.MethodSorters;
@ -3336,7 +3335,7 @@ public class VMTest {
assertEquals(s_expected_1, Hex.toHexString(item1.getData()).toUpperCase());
}
@Test(expected=IllegalOperationException.class) // INVALID OP
@Test(expected=Program.IllegalOperationException.class) // INVALID OP
public void testINVALID_1() {
VM vm = new VM();