public override void Visit(Decr decr) { Visit(new Ass(decr.Id, new AddOp { Add = Add.Minus, Lhs = new ID { Id = decr.Id }, Rhs = new Int { Value = 1 } })); }
public void SML_Instruction_Decr_Bad_Stack() { Mock <IVirtualMachine> mock = new Mock <IVirtualMachine>(MockBehavior.Strict); Decr decr = new Decr { VirtualMachine = mock.Object }; mock.Setup(m => m.Stack).Returns(new Stack()); decr.Run(); }
public void SML_Instruction_Decr_Bad_Item() { string inputOne = "2"; Stack stack = new Stack(); Mock <IVirtualMachine> mock = new Mock <IVirtualMachine>(MockBehavior.Strict); Decr decr = new Decr { VirtualMachine = mock.Object }; mock.Setup(m => m.Stack).Returns(stack); stack.Push(inputOne); decr.Run(); }
public void SML_Instruction_Decr_Good() { int inputOne = 2; int expected = inputOne - 1; Stack stack = new Stack(); Mock <IVirtualMachine> mock = new Mock <IVirtualMachine>(MockBehavior.Strict); Decr decr = new Decr { VirtualMachine = mock.Object }; mock.Setup(m => m.Stack).Returns(stack); stack.Push(inputOne); decr.Run(); Assert.AreEqual(mock.Object.Stack.Pop(), expected); }
public virtual void Visit(Decr decr) { }