public void TestStackFrameRegisterState_WhenReturningFromAFunctionCall_TheRegistersShouldBeRestoredToTheirPreCallValues() { // Arrange var tacs = new Tacs { Tac.Init(0), Tac.SetRegisterValue(1, 11), Tac.SetRegisterValue(2, 11), Tac.SetRegisterValue(3, 11), Tac.SetRegisterValue(4, 11), Tac.SetRegisterValue(5, 11), Tac.SetRegisterValue(6, 11), Tac.BeginCall("main", 0, "t0"), Tac.Call("main", "t0"), Tac.PrintRegisters(), Tac.Halt(), Tac.BeginFunc("main", 0), Tac.SetRegisterValue(1, 22), Tac.SetRegisterValue(2, 22), Tac.SetRegisterValue(3, 22), Tac.SetRegisterValue(4, 22), Tac.SetRegisterValue(5, 22), // cant mess with r6 because this is the stack pointer Tac.EndFunc("main") }; var output = new CodeGenerator().Generate(tacs); // Act var tinyOut = new TinyMachine(ExePath, TestFilePath).Execute(output); // Assert Assert.That(tinyOut, Is.EqualTo(new[] { "0", "11", "11", "11", "11", "11", "11" }), tinyOut.ToString()); }