public void Pop_an_empty_heap() { AMHeap heap = new AMHeap(); object top = heap.Pop(); Assert.IsNull(top); }
public void SetVoid() { AbstractMachineState state = SetupMachine(); AMHeap heap = (AMHeap)state.DataArea; object[] args = { "3" }; SetVoidInstruction i = new SetVoidInstruction(); i.Process(args); i.Execute(state); Assert.AreEqual("set_void", i.Name()); Assert.AreEqual(1, i.NumberOfArguments()); Assert.IsTrue(((AbstractTerm)heap.Pop()).IsReference); Assert.IsTrue(((AbstractTerm)heap.Pop()).IsReference); Assert.IsTrue(((AbstractTerm)heap.Pop()).IsReference); }
public void Pop_one_item() { AMHeap heap = new AMHeap(); ConstantTerm con = new ConstantTerm("ali"); heap.Push(con); heap.Pop(); Assert.IsNull(heap.Top()); }
public void Pop_two_items() { AMHeap heap = new AMHeap(); ConstantTerm con = new ConstantTerm("ali"); ConstantTerm first = new ConstantTerm("foo"); heap.Push(first); heap.Push(con); heap.Pop(); Assert.AreSame(first, heap.Top()); }