public void AtomVsVariableBoundToSameAtom() { Assert.IsTrue(EngineInternals.AreEqual( new Variable("X") { BoundTo = new Atom("X") }, new Atom("X"))); }
// ReSharper disable ParameterTypeCanBeEnumerable.Local private static bool AreEqual(List lhs, List rhs) // ReSharper restore ParameterTypeCanBeEnumerable.Local { var e1 = lhs.GetEnumerator(); var e2 = rhs.GetEnumerator(); while (true) { bool more1 = e1.MoveNext(); bool more2 = e2.MoveNext(); if (more1 && more2) { if (!EngineInternals.AreEqual(e1.Current, e2.Current)) { return(false); } } else { return(more1 == more2); // lists are of same length } } }
public void UnboundVariableVsAtom() { Assert.IsFalse(EngineInternals.AreEqual( new Variable("X"), new Atom("X"))); }
public void TwoEmptyLists() { Assert.IsTrue(EngineInternals.AreEqual( new List(new IValue [] {}), new List(new IValue [] {}))); }
public void TwoListsOfLengthTwoThatAreEqual() { Assert.IsTrue(EngineInternals.AreEqual( new List(new IValue [] { new Atom("x"), new Atom("y") }), new List(new IValue [] { new Atom("x"), new Atom("y") }))); }
public void ListVsAtom() { Assert.IsFalse(EngineInternals.AreEqual( new List(new IValue [] { new Atom("x") }), new Atom("y"))); }
public void TwoAtomsThatAreNotEqual() { Assert.IsFalse(EngineInternals.AreEqual(new Atom("x"), new Atom("y"))); }