public void NoMatchWithDifferentTails() { List list = new List(1, 0); List list2 = new List(1, 2); Context context = new Context(); Assert.IsFalse(list.Match(list2, context)); Assert.IsFalse(list2.Match(list, context)); }
public void NoMatchNullList() { List list = new List(1, 2); Context context = new Context(); Assert.IsFalse(list.Match(null, context)); }
public void NoMatchTwoListsWithDifferentLength() { List list = new List(1, 2); List list2 = new List(1, new List(2, 3)); Context context = new Context(); Assert.IsFalse(list.Match(list2, context)); Assert.IsFalse(list2.Match(list, context)); }
public void MatchWithAVariable() { List list = new List(1, new Variable("X")); List list2 = new List(1, new List(2, 3)); Context context = new Context(); Assert.IsTrue(list.Match(list2, context)); Assert.AreEqual(list2.Tail, context.GetValue("X")); Assert.IsTrue(list2.Match(list, context)); Assert.AreEqual(list2.Tail, context.GetValue("X")); }
public void MatchTwoListsWithThreeElements() { List list = new List(1, new List(2, 3)); List list2 = new List(1, new List(2, 3)); Context context = new Context(); Assert.IsTrue(list.Match(list2, context)); Assert.IsTrue(list2.Match(list, context)); }
public void MatchTwoLists() { List list = new List(1, 2); List list2 = new List(1, 2); Context context = new Context(); Assert.IsTrue(list.Match(list2, context)); Assert.IsTrue(list2.Match(list, context)); }
public void MatchSameList() { List list = new List(1, 2); Context context = new Context(); Assert.IsTrue(list.Match(list, context)); }
public void MatchHeadAndTailWithVariables() { List list = new List(new Variable("H"), new Variable("T")); List list2 = new List(1, new List(2, 3)); Context context = new Context(); Assert.IsTrue(list.Match(list2, context)); Assert.AreEqual(list2.Head, context.GetValue("H")); Assert.AreEqual(list2.Tail, context.GetValue("T")); Assert.IsTrue(list2.Match(list, context)); Assert.AreEqual(list2.Head, context.GetValue("H")); Assert.AreEqual(list2.Tail, context.GetValue("T")); }