public void Should_Load_Int_Value_On_Stack() { var ldint = InstFactory.Ldc_I4(2); var engine = EngineFactory.CreateFor <int>(new[] { ldint }, "load"); engine.Execute("load"); Assert.AreEqual(2, engine.Process.EvalStack.Pop().Value); }
public void Should_Add_Int_Values_On_Stack() { var insts = new [] { InstFactory.Ldc_I4(2), InstFactory.Ldc_I4(2), InstFactory.Add(), InstFactory.Ret() }; var engine = EngineFactory.CreateFor <int>(insts, "add"); engine.Execute("add"); Assert.AreEqual(0, engine.Process.EvalStack.Count); Assert.AreEqual(4, engine.Process.Result.Value); }