public void Returns_top_value_on_not_empty_stack() { var stack = Stack.Empty.Push(3).Push(17); Assert.AreEqual(17, stack.Peek()); StackAssert.AreEqual(stack, 17, 3); }
public void true_adds_1_to_top() { var stack = Stack .Empty .Push(true); StackAssert.AreEqual(stack, 1); }
public void false_adds_0_to_top() { var stack = Stack .Empty .Push(false); StackAssert.AreEqual(stack, 0); }
public void integer_adds_value_to_top() { var stack = Stack .Empty .Push(42); StackAssert.AreEqual(stack, 42); }
public void adds_copy_top_value_to_top() { var stack = Stack .Empty .Push(42) .Duplicate(); StackAssert.AreEqual(stack, 42, 42); }
public void top_value_not_zero_becomes_0() { var stack = Stack .Empty .Push(42) .Not(); StackAssert.AreEqual(stack, 0); }
public void top_value_0_becomes_1() { var stack = Stack .Empty .Push(0) .Not(); StackAssert.AreEqual(stack, 1); }
public void pops_top_values_and_pushes_subtraction() { var stack = Stack .Empty .Push(17) .Push(25) .Subtract(); StackAssert.AreEqual(stack, -8); }
public void with_negative_value_pops_top_values_and_pushes_modulo() { var stack = Stack .Empty .Push(42) .Push(-11) .Modulo(); StackAssert.AreEqual(stack, 9); }
public void with_postive_value_pops_top_values_and_pushes_modulo() { var stack = Stack .Empty .Push(-42) .Push(5) .Modulo(); StackAssert.AreEqual(stack, 3); }
public void pops_top_values_and_pushes_division() { var stack = Stack .Empty .Push(42) .Push(14) .Divide(); StackAssert.AreEqual(stack, 3); }
public void pops_top_values_and_pushes_product() { var stack = Stack .Empty .Push(17) .Push(25) .Multiply(); StackAssert.AreEqual(stack, 425); }
public void pops_top_values_and_pushes_0_as_second_was_not_greater() { var stack = Stack .Empty .Push(42) .Push(42) .Greater(); StackAssert.AreEqual(stack, 0); }
public void pops_top_values_and_pushes_sum() { var stack = Stack .Empty .Push(17) .Push(25) .Add(); StackAssert.AreEqual(stack, 42); }
public void With_zero_rolls_keeps_same_order() { var stack = Stack.Empty .Push(42) .Push(17) .Push(2) .Push(0) .Roll(); StackAssert.AreEqual(stack, 17, 42); }
public void Iterates_from_top_to_bottom() { var stack = Stack.Empty .Push(0) .Push(1) .Push(2) .Push(3) .Push(4) .Push(5); StackAssert.AreEqual(stack, 5, 4, 3, 2, 1, 0); }
public void With_negative_rolls_moves_items_within_depth_range_down() { var stack = Stack .Empty .Push(666) .Push(69) .Push(17) .Push(42) .Push(3) .Push(-1) .Roll(); StackAssert.AreEqual(stack, 69, 42, 17, 666); }
public void Removes_top_item_from_not_empty_stack() { var stack = Stack.Empty.Push(3).Push(17).Pop(); StackAssert.AreEqual(stack, 3); }