public void Constructor_GivenProgramWithInvalidOpcode_ThrowsException() { var program = new IOperation[] { OpCodeUtility.MockOperation(OpCode.debug, 0) }; var exception = Assert.Throws <ArgumentException>(() => new JumpmanCPU(program)); Assert.StartsWith("The Opcodes: \"debug\" are not supported.", exception.Message); }
public void LoadNewProgram_GivenInvalidProgram_ThrowsException() { var sut = new JumpmanCPU(new IOperation[] { }); var program = new IOperation[] { OpCodeUtility.MockOperation(OpCode.debug, 0) }; var exception = Assert.Throws <ArgumentException>(() => sut.LoadNewProgram(program)); Assert.StartsWith("The Opcodes: \"debug\" are not supported.", exception.Message); }
public static ICPUState MockCPUState(int programCounter, int accumulator, bool halt, OpCode lastOpCode, int lastArgument) { var lastOp = OpCodeUtility.MockOperation(lastOpCode, lastArgument); return(MockCPUState(programCounter, accumulator, halt, lastOp)); }