Exemple #1
0
        public void Pop_with_param_decrements_StackPointer_by_same_value()
        {
            var uut = new ThreadStack();

            uut.Push(Variable.One);
            uut.Push(2);
            uut.Pop(2);
            uut.StackPointer.Should().Be(0);
        }
Exemple #2
0
        public void Peek_returns_the_top_item()
        {
            var uut = new ThreadStack();

            uut.Push(Variable.One);
            uut.Push(2);
            var result = uut.Peek();

            result.Should().BeNull();
        }
Exemple #3
0
        public void Peek_with_param_returns_the_item_offset_from_StackPointer()
        {
            var uut = new ThreadStack();

            uut.Push(Variable.One);
            uut.Push(2);
            var result = uut.Peek(-2);

            result.Should().Be(Variable.One);
        }
Exemple #4
0
        public void Pop_with_param_returns_the_correct_item()
        {
            var uut = new ThreadStack();

            uut.Push(Variable.One);
            uut.Push(2);
            var result = uut.Pop(2);

            result.Should().Be(Variable.One);
        }
Exemple #5
0
        public void PeekAbsreturns_the_item_at_offset()
        {
            var uut = new ThreadStack();

            uut.Push(Variable.One);
            uut.Push(2);
            var result = uut.PeekAbs(0);

            result.Should().Be(Variable.One);
        }
Exemple #6
0
        public void PeekBase_with_zero_returns_the_item_at_BasePointer()
        {
            var uut = new ThreadStack();

            uut.Push(Variable.One);
            uut.Push(2);
            uut.BasePointer = 1;
            var result = uut.PeekBase(0);

            result.GetInteger().Should().Be(2);
        }
Exemple #7
0
        public void PeekBase_returns_the_item_at_offset_from_BasePointer()
        {
            var uut = new ThreadStack();

            uut.Push(Variable.One);
            uut.Push(2);
            uut.BasePointer = 1;
            var result = uut.PeekBase(-1);

            result.Should().Be(Variable.One);
        }
Exemple #8
0
        public void PokeAbs_modifies_the_item_at_offset()
        {
            var uut = new ThreadStack();

            uut.Push(Variable.One);
            uut.Push(2);
            uut.PokeAbs(1, 15);
            var result = uut.PeekAbs(1);

            result.GetInteger().Should().Be(15);
        }
Exemple #9
0
        public void Poke_with_param_modifies_the_item_offset_from_StackPointer()
        {
            var uut = new ThreadStack();

            uut.Push(Variable.One);
            uut.Push(2);
            uut.Poke(-2, 15);
            var result = uut.Peek(-2);

            result.GetInteger().Should().Be(15);
        }
Exemple #10
0
        public void PokeBase_modifes_the_item_at_offset_from_BasePointer()
        {
            var uut = new ThreadStack();

            uut.Push(Variable.One);
            uut.Push(2);
            uut.BasePointer = 1;
            uut.PokeBase(-1, 5);
            var result = uut.PeekBase(-1);

            result.GetInteger().Should().Be(5);
        }
Exemple #11
0
        public void Push_Increments_StackPointer()
        {
            var uut = new ThreadStack();

            uut.Push(Variable.Null);
            uut.StackPointer.Should().Be(1);
        }
Exemple #12
0
        public void Pop_decrements_StackPointer()
        {
            var uut = new ThreadStack();

            uut.Push(Variable.One);
            uut.Pop();
            uut.StackPointer.Should().Be(0);
        }
Exemple #13
0
        public void Can_Pop_a_pushed_item()
        {
            var uut = new ThreadStack();

            uut.Push(Variable.One);
            var result = uut.Pop();

            result.Should().Be(Variable.One);
        }