CPU { public void run() { while (!halted) { step(); } } CPU(int... instructions); int getInstructionAddress(); Collection<Integer> getStack(); boolean isHalted(); void run(); void step(); Frame getCurrentFrame();  }
@Test(expected = InvalidProgramException.class) public void testIsEqualsNeedsTwoItemsOnTheStack() { CPU cpu = new CPU(ISEQ, HALT); cpu.run(); }
@Test(expected = InvalidProgramException.class) public void testIsGreaterEqualsNeedsTwoItemsOnTheStack() { CPU cpu = new CPU(ISGE, HALT); cpu.run(); }
@Test(expected = InvalidProgramException.class) public void testIsGreaterNeedsTwoItemsOnTheStack() { CPU cpu = new CPU(ISGT, HALT); cpu.run(); }
@Test(expected = InvalidProgramException.class) public void testJumpNeedsOneArgument() { CPU cpu = new CPU(JMP); cpu.run(); }
@Test(expected = InvalidProgramException.class) public void testConditionalJumpNeedsOneArgument() { CPU cpu = new CPU(PUSH, 1, JIF); cpu.run(); }
@Test(expected = InvalidProgramException.class) public void testJumpNeedsOneItemOnTheStack() { CPU cpu = new CPU(JIF, 0, HALT); cpu.run(); }
@Test(expected = InvalidProgramException.class) public void testLoadNeedsOneArgument() { CPU cpu = new CPU(LOAD); cpu.run(); }
@Test(expected = InvalidProgramException.class) public void testStoreNeedsOneArgument() { CPU cpu = new CPU(STORE); cpu.run(); }
@Test(expected = InvalidProgramException.class) public void testStoreNeedsOneItemOnTheStack() { CPU cpu = new CPU(STORE, 0, HALT); cpu.run(); }
@Test(expected = InvalidProgramException.class) public void testAddNeedsTwoItemsOnTheStack() { CPU cpu = new CPU(ADD, HALT); cpu.run(); }
@Test(expected = InvalidProgramException.class) public void testSubNeedsTwoItemsOnTheStack() { CPU cpu = new CPU(SUB, HALT); cpu.run(); }
@Test(expected = InvalidProgramException.class) public void testMulNeedsTwoItemsOnTheStack() { CPU cpu = new CPU(MUL, HALT); cpu.run(); }
@Test(expected = InvalidProgramException.class) public void testDivNeedsTwoItemsOnTheStack() { CPU cpu = new CPU(DIV, HALT); cpu.run(); }
@Test(expected = InvalidProgramException.class) public void testNotNeedsOneItemOnTheStack() { CPU cpu = new CPU(NOT, HALT); cpu.run(); }
@Test(expected = InvalidProgramException.class) public void testAndNeedsTwoItemsOnTheStack() { CPU cpu = new CPU(AND, HALT); cpu.run(); }
@Test(expected = InvalidProgramException.class) public void testOrNeedsTwoItemsOnTheStack() { CPU cpu = new CPU(OR, HALT); cpu.run(); }