public void CanPushPopItem() { var queue = new QueueValue(); Assert.IsNotNull(queue); var length = InvokeDelegate(queue, "LENGTH"); Assert.AreEqual(ScalarIntValue.Zero, length); InvokeDelegate(queue, "PUSH", new StringValue("value1")); InvokeDelegate(queue, "PUSH", new StringValue("value2")); length = InvokeDelegate(queue, "LENGTH"); Assert.AreEqual(ScalarIntValue.Two, length); object popped = InvokeDelegate(queue, "POP"); Assert.AreEqual(new StringValue("value1"), popped); popped = InvokeDelegate(queue, "POP"); Assert.AreEqual(new StringValue("value2"), popped); length = InvokeDelegate(queue, "LENGTH"); Assert.AreEqual(ScalarIntValue.Zero, length); }
public void CopyIsACopy() { var queue = new QueueValue(); var zedObject = new object(); InvokeDelegate(queue, "PUSH", zedObject); var firstObject = new object(); InvokeDelegate(queue, "PUSH", firstObject); var secondObject = new object(); InvokeDelegate(queue, "PUSH", secondObject); var thirdObject = new object(); InvokeDelegate(queue, "PUSH", thirdObject); var length = InvokeDelegate(queue, "LENGTH"); Assert.AreEqual(4,length); var copy = InvokeDelegate(queue, "COPY") as QueueValue; Assert.AreNotSame(queue, copy); var copyLength = InvokeDelegate(copy, "LENGTH"); Assert.AreEqual(4,copyLength); InvokeDelegate(copy, "CLEAR"); copyLength = InvokeDelegate(copy, "LENGTH"); Assert.AreEqual(0,copyLength); length = InvokeDelegate(queue, "LENGTH"); Assert.AreEqual(4,length); }
public void CanPushPopItem() { var queue = new QueueValue(); Assert.IsNotNull(queue); var length = InvokeDelegate(queue, "LENGTH"); Assert.AreEqual(0, length); InvokeDelegate(queue, "PUSH", "value1"); InvokeDelegate(queue, "PUSH", "value2"); length = InvokeDelegate(queue, "LENGTH"); Assert.AreEqual(2, length); object popped = InvokeDelegate(queue, "POP"); Assert.AreEqual("value1", popped); popped = InvokeDelegate(queue, "POP"); Assert.AreEqual("value2", popped); length = InvokeDelegate(queue, "LENGTH"); Assert.AreEqual(0, length); }
public override void Execute(SharedObjects shared) { Structure[] argArray = new Structure[CountRemainingArgs(shared)]; for (int i = argArray.Length - 1; i >= 0; --i) { argArray[i] = PopStructureAssertEncapsulated(shared); // fill array in reverse order because .. stack args. } AssertArgBottomAndConsume(shared); var queueValue = new QueueValue(argArray.ToList()); ReturnValue = queueValue; }
public void CanClear() { var queue = new QueueValue(); InvokeDelegate(queue, "PUSH", 1); InvokeDelegate(queue, "PUSH", new object()); var length = InvokeDelegate(queue, "LENGTH"); Assert.AreEqual(2,length); InvokeDelegate(queue, "CLEAR"); length = InvokeDelegate(queue, "LENGTH"); Assert.AreEqual(0,length); }
public void CanClear() { var queue = new QueueValue(); InvokeDelegate(queue, "PUSH", ScalarIntValue.One); InvokeDelegate(queue, "PUSH", ScalarIntValue.Two); var length = InvokeDelegate(queue, "LENGTH"); Assert.AreEqual(ScalarIntValue.Two, length); InvokeDelegate(queue, "CLEAR"); length = InvokeDelegate(queue, "LENGTH"); Assert.AreEqual(ScalarIntValue.Zero, length); }
public void CanClear() { var queue = new QueueValue(); InvokeDelegate(queue, "PUSH", 1); InvokeDelegate(queue, "PUSH", new object()); var length = InvokeDelegate(queue, "LENGTH"); Assert.AreEqual(2, length); InvokeDelegate(queue, "CLEAR"); length = InvokeDelegate(queue, "LENGTH"); Assert.AreEqual(0, length); }
public void CanClear() { var queue = new QueueValue(); InvokeDelegate(queue, "PUSH", ScalarIntValue.One); InvokeDelegate(queue, "PUSH", ScalarIntValue.Two); var length = InvokeDelegate(queue, "LENGTH"); Assert.AreEqual(ScalarIntValue.Two, length); InvokeDelegate(queue, "CLEAR"); length = InvokeDelegate(queue, "LENGTH"); Assert.AreEqual(ScalarIntValue.Zero, length); }
public void CanSerializeQueues() { var queue = new QueueValue(); var nested = new QueueValue(); queue.Push(new StringValue("item1")); queue.Push(new ScalarIntValue(2)); queue.Push(nested); nested.Push(new StringValue("nested1")); QueueValue deserialized = Deserialize(Serialize(queue)) as QueueValue; Assert.AreEqual(new StringValue("item1"), deserialized.Pop()); Assert.AreEqual(new ScalarIntValue(2), deserialized.Pop()); Assert.IsTrue(deserialized.Pop() is QueueValue); }
public void CanSerializeQueues() { var queue = new QueueValue(); var nested = new QueueValue(); queue.Push(new StringValue("item1")); queue.Push(new ScalarIntValue(2)); queue.Push(nested); nested.Push(new StringValue("nested1")); QueueValue deserialized = Deserialize(Serialize(queue)) as QueueValue; Assert.AreEqual(new StringValue("item1"), deserialized.Pop()); Assert.AreEqual(new ScalarIntValue(2), deserialized.Pop()); Assert.IsTrue(deserialized.Pop() is QueueValue); }
public void CanTestContains() { var queue = new QueueValue(); var zedObject = new StringValue("abc"); InvokeDelegate(queue, "PUSH", zedObject); var firstObject = new StringValue("def"); InvokeDelegate(queue, "PUSH", firstObject); var secondObject = new StringValue("xyz"); var thirdObject = ScalarIntValue.Zero; var length = InvokeDelegate(queue, "LENGTH"); Assert.AreEqual(ScalarIntValue.Two, length); Assert.IsTrue((BooleanValue)InvokeDelegate(queue, "CONTAINS", zedObject)); Assert.IsTrue((BooleanValue)InvokeDelegate(queue, "CONTAINS", firstObject)); Assert.IsFalse((BooleanValue)InvokeDelegate(queue, "CONTAINS", secondObject)); Assert.IsFalse((BooleanValue)InvokeDelegate(queue, "CONTAINS", thirdObject)); }
public void CanPushPopItem() { var queue = new QueueValue(); Assert.IsNotNull(queue); var length = InvokeDelegate(queue, "LENGTH"); Assert.AreEqual(0,length); InvokeDelegate(queue, "PUSH", "value1"); InvokeDelegate(queue, "PUSH", "value2"); length = InvokeDelegate(queue, "LENGTH"); Assert.AreEqual(2,length); object popped = InvokeDelegate(queue, "POP"); Assert.AreEqual("value1", popped); popped = InvokeDelegate(queue, "POP"); Assert.AreEqual("value2", popped); length = InvokeDelegate(queue, "LENGTH"); Assert.AreEqual(0, length); }
public void CanPushPopItem() { var queue = new QueueValue(); Assert.IsNotNull(queue); var length = InvokeDelegate(queue, "LENGTH"); Assert.AreEqual(ScalarIntValue.Zero, length); InvokeDelegate(queue, "PUSH", new StringValue("value1")); InvokeDelegate(queue, "PUSH", new StringValue("value2")); length = InvokeDelegate(queue, "LENGTH"); Assert.AreEqual(ScalarIntValue.Two, length); object popped = InvokeDelegate(queue, "POP"); Assert.AreEqual(new StringValue("value1"), popped); popped = InvokeDelegate(queue, "POP"); Assert.AreEqual(new StringValue("value2"), popped); length = InvokeDelegate(queue, "LENGTH"); Assert.AreEqual(ScalarIntValue.Zero, length); }
public void CanTestContains() { var queue = new QueueValue(); var zedObject = new StringValue("abc"); InvokeDelegate(queue, "PUSH", zedObject); var firstObject = new StringValue("def"); InvokeDelegate(queue, "PUSH", firstObject); var secondObject = new StringValue("xyz"); var thirdObject = ScalarIntValue.Zero; var length = InvokeDelegate(queue, "LENGTH"); Assert.AreEqual(ScalarIntValue.Two, length); Assert.IsTrue((BooleanValue)InvokeDelegate(queue, "CONTAINS", zedObject)); Assert.IsTrue((BooleanValue)InvokeDelegate(queue, "CONTAINS", firstObject)); Assert.IsFalse((BooleanValue)InvokeDelegate(queue, "CONTAINS", secondObject)); Assert.IsFalse((BooleanValue)InvokeDelegate(queue, "CONTAINS", thirdObject)); }
public void CanTestContains() { var queue = new QueueValue(); var zedObject = new object(); InvokeDelegate(queue, "PUSH", zedObject); var firstObject = new object(); InvokeDelegate(queue, "PUSH", firstObject); var secondObject = new object(); var thirdObject = new object(); var length = InvokeDelegate(queue, "LENGTH"); Assert.AreEqual(2, length); Assert.IsTrue((bool)InvokeDelegate(queue, "CONTAINS", zedObject)); Assert.IsTrue((bool)InvokeDelegate(queue, "CONTAINS", firstObject)); Assert.IsFalse((bool)InvokeDelegate(queue, "CONTAINS", secondObject)); Assert.IsFalse((bool)InvokeDelegate(queue, "CONTAINS", thirdObject)); }
public void CopyIsACopy() { var queue = new QueueValue(); var zedObject = new object(); InvokeDelegate(queue, "PUSH", zedObject); var firstObject = new object(); InvokeDelegate(queue, "PUSH", firstObject); var secondObject = new object(); InvokeDelegate(queue, "PUSH", secondObject); var thirdObject = new object(); InvokeDelegate(queue, "PUSH", thirdObject); var length = InvokeDelegate(queue, "LENGTH"); Assert.AreEqual(4, length); var copy = InvokeDelegate(queue, "COPY") as QueueValue; Assert.AreNotSame(queue, copy); var copyLength = InvokeDelegate(copy, "LENGTH"); Assert.AreEqual(4, copyLength); InvokeDelegate(copy, "CLEAR"); copyLength = InvokeDelegate(copy, "LENGTH"); Assert.AreEqual(0, copyLength); length = InvokeDelegate(queue, "LENGTH"); Assert.AreEqual(4, length); }
public void CopyIsACopy() { var queue = new QueueValue(); var zedObject = ScalarIntValue.Zero; InvokeDelegate(queue, "PUSH", zedObject); var firstObject = ScalarIntValue.One; InvokeDelegate(queue, "PUSH", firstObject); var secondObject = ScalarIntValue.Two; InvokeDelegate(queue, "PUSH", secondObject); var thirdObject = new ScalarIntValue(4); InvokeDelegate(queue, "PUSH", thirdObject); var length = InvokeDelegate(queue, "LENGTH"); Assert.AreEqual(new ScalarIntValue(4), length); var copy = InvokeDelegate(queue, "COPY") as QueueValue; Assert.AreNotSame(queue, copy); var copyLength = InvokeDelegate(copy, "LENGTH"); Assert.AreEqual(new ScalarIntValue(4), copyLength); InvokeDelegate(copy, "CLEAR"); copyLength = InvokeDelegate(copy, "LENGTH"); Assert.AreEqual(ScalarIntValue.Zero, copyLength); length = InvokeDelegate(queue, "LENGTH"); Assert.AreEqual(new ScalarIntValue(4), length); }
public override void Execute(SharedObjects shared) { Structure[] argArray = new Structure[CountRemainingArgs(shared)]; for (int i = argArray.Length - 1 ; i >= 0 ; --i) argArray[i] = PopStructureAssertEncapsulated(shared); // fill array in reverse order because .. stack args. AssertArgBottomAndConsume(shared); var queueValue = new QueueValue(argArray.ToList()); ReturnValue = queueValue; }
public void CanTestContains() { var queue = new QueueValue(); var zedObject = new object(); InvokeDelegate(queue, "PUSH", zedObject); var firstObject = new object(); InvokeDelegate(queue, "PUSH", firstObject); var secondObject = new object(); var thirdObject = new object(); var length = InvokeDelegate(queue, "LENGTH"); Assert.AreEqual(2,length); Assert.IsTrue((bool)InvokeDelegate(queue, "CONTAINS", zedObject)); Assert.IsTrue((bool)InvokeDelegate(queue, "CONTAINS", firstObject)); Assert.IsFalse((bool)InvokeDelegate(queue, "CONTAINS", secondObject)); Assert.IsFalse((bool)InvokeDelegate(queue, "CONTAINS", thirdObject)); }
public void CanCreate() { var queue = new QueueValue(); Assert.IsNotNull(queue); }
public void CanCreate() { var queue = new QueueValue(); Assert.IsNotNull(queue); }
public void CopyIsACopy() { var queue = new QueueValue(); var zedObject = ScalarIntValue.Zero; InvokeDelegate(queue, "PUSH", zedObject); var firstObject = ScalarIntValue.One; InvokeDelegate(queue, "PUSH", firstObject); var secondObject = ScalarIntValue.Two; InvokeDelegate(queue, "PUSH", secondObject); var thirdObject = new ScalarIntValue(4); InvokeDelegate(queue, "PUSH", thirdObject); var length = InvokeDelegate(queue, "LENGTH"); Assert.AreEqual(new ScalarIntValue(4), length); var copy = InvokeDelegate(queue, "COPY") as QueueValue; Assert.AreNotSame(queue, copy); var copyLength = InvokeDelegate(copy, "LENGTH"); Assert.AreEqual(new ScalarIntValue(4), copyLength); InvokeDelegate(copy, "CLEAR"); copyLength = InvokeDelegate(copy, "LENGTH"); Assert.AreEqual(ScalarIntValue.Zero, copyLength); length = InvokeDelegate(queue, "LENGTH"); Assert.AreEqual(new ScalarIntValue(4), length); }