public void Push_Pointer_IsCorrect(int index, string segment)
        {
            var actual = MemoryCommand.Push("", "pointer", index).HackInstructions;

            var expected = new[]
            {
                segment,
                "D=M",
                "@SP",
                "M=M+1",
                "A=M-1",
                "M=D"
            };

            Assert.Equal(expected, actual);
        }
        public void Push_Temp_IsCorrect(int index)
        {
            var actual = MemoryCommand.Push("", "temp", index).HackInstructions;

            var expected = new[]
            {
                $"@{index + 5}",
                "D=M",
                "@SP",
                "M=M+1",
                "A=M-1",
                "M=D"
            };

            Assert.Equal(expected, actual);
        }
        public void Push_StaticSegment_IsCorrect()
        {
            var actual = MemoryCommand.Push("Foo", "static", 2).HackInstructions;

            var expected = new[]
            {
                "@Foo.2",
                "D=M",
                "@SP",
                "M=M+1",
                "A=M-1",
                "M=D",
            };

            Assert.Equal(expected, actual);
        }
        public void Push_Constant_IsCorrect(int i)
        {
            var actual = MemoryCommand.Push("", "constant", i).HackInstructions;

            var expected = new[]
            {
                $"@{i}",
                "D=A",
                "@SP",
                "M=M+1",
                "A=M-1",
                "M=D",
            };

            Assert.Equal(expected, actual);
        }
        public void Push_ConstantLocalArgumentThisThat_IsCorrect(
            string segment, string segmentBase, int index)
        {
            var actual = MemoryCommand.Push("", segment, index).HackInstructions;

            var expected = new[]
            {
                segmentBase,
                "D=M",
                $"@{index}",
                "A=D+A",
                "D=M",
                "@SP",
                "M=M+1",
                "A=M-1",
                "M=D",
            };

            Assert.Equal(expected, actual);
        }