public void LLConfEmptyDiffLabelsNotEqualTest() { var ll1 = new LlConfiguration <CharSymbol>(new CharSymbol('A')); var ll2 = new LlConfiguration <CharSymbol>(new CharSymbol('B')); Assert.AreNotEqual(ll1, ll2); }
public void LLConfEmptyCountTest() { CharSymbol chSym = new CharSymbol('A'); var ll = new LlConfiguration <CharSymbol>(chSym); Assert.AreEqual(ll.Count(), 0); }
public void LLConfEmptyPushPeekTest() { CharSymbol chSym = new CharSymbol('A'); var ll = new LlConfiguration <CharSymbol>(chSym); Assert.AreEqual(ll.Push(states["A1"]).Peek(), states["A1"]); }
public void LLConfEmptyPushTest() { CharSymbol chSym = new CharSymbol('A'); var imList = ImmutableList.Create(states["A1"]); var ll = new LlConfiguration <CharSymbol>(chSym); Assert.AreEqual(ll.Push(states["A1"]).stack, imList); }
public void LLConfPeekTest() { CharSymbol chSym = new CharSymbol('A'); var imList = ImmutableList.Create(states["A3"]); var ll = new LlConfiguration <CharSymbol>(chSym, imList); Assert.AreEqual(states["A3"], ll.Peek()); }
public void LLConfPopPeekTest() { CharSymbol chSym = new CharSymbol('A'); var imList = ImmutableList.Create(states["A1"], states["A2"]); var begLL = new LlConfiguration <CharSymbol>(chSym, imList); Assert.AreEqual(begLL.Pop().Peek(), states["A1"]); }
public void LLConfSymbolConstructorStackTest() { CharSymbol chSym = new CharSymbol('A'); var stack = new Stack <DfaState <CharSymbol> >(); var ll = new LlConfiguration <CharSymbol>(chSym); Assert.AreEqual(stack, ll.copyOfStack()); }
public void LLConfThreePopToEmptyTest() { CharSymbol chSym = new CharSymbol('A'); var imList = ImmutableList.Create(states["A1"], states["B2"], states["A3"]); var ll1 = new LlConfiguration <CharSymbol>(chSym); var ll2 = new LlConfiguration <CharSymbol>(chSym, imList); Assert.AreEqual(ll1, ll2.Pop().Pop().Pop()); }
public void LLConfSymbolConstructorTest() { CharSymbol chSym = new CharSymbol('A'); var ll = new LlConfiguration <CharSymbol>(chSym); Console.WriteLine("LL -> " + ll); Assert.AreEqual(chSym, ll.label); Assert.IsEmpty(ll.stack); }
public void LLConfPopToEmptyTest() { CharSymbol chSym = new CharSymbol('A'); var imList = ImmutableList.Create(states["A1"]); var begLL = new LlConfiguration <CharSymbol>(chSym, imList); var resLL = new LlConfiguration <CharSymbol>(chSym); Assert.AreEqual(begLL.Pop(), resLL); }
public void LLConfThreePushEqualTest() { CharSymbol chSym = new CharSymbol('A'); var targetList = ImmutableList.Create(states["A1"], states["B2"], states["A3"]); var ll1 = new LlConfiguration <CharSymbol>(chSym); var ll2 = new LlConfiguration <CharSymbol>(chSym, targetList); Assert.AreEqual(ll1.Push(states["A1"]).Push(states["B2"]).Push(states["A3"]), ll2); }
public void LLConfEmptyPushEqualTest() { CharSymbol chSym = new CharSymbol('A'); var imList = ImmutableList.Create(states["A3"]); var ll1 = new LlConfiguration <CharSymbol>(chSym); var ll2 = new LlConfiguration <CharSymbol>(chSym, imList); Assert.AreEqual(ll1.Push(states["A3"]), ll2); }
public void LLConfOnePopEqualTest() { CharSymbol chSym = new CharSymbol('A'); var imList1 = ImmutableList.Create(states["A1"], states["A2"]); var imList2 = ImmutableList.Create(states["A1"], states["A2"], states["A3"]); var ll1 = new LlConfiguration <CharSymbol>(chSym, imList1); var ll2 = new LlConfiguration <CharSymbol>(chSym, imList2); Assert.AreEqual(ll1, ll2.Pop()); }
public void LLConfSameListDiffLabelNotEqualTest() { CharSymbol chSym1 = new CharSymbol('A'); CharSymbol chSym2 = new CharSymbol('B'); var imList = ImmutableList.Create(states["A1"], states["A2"], states["A3"]); var ll1 = new LlConfiguration <CharSymbol>(chSym1, imList); var ll2 = new LlConfiguration <CharSymbol>(chSym2, imList); Assert.AreNotEqual(ll1, ll2); }
public void LLConfListConstructorTest() { CharSymbol chSym = new CharSymbol('A'); var imList = ImmutableList.Create(states["A1"], states["A2"], states["A3"]); var ll = new LlConfiguration <CharSymbol>(chSym, imList); Console.WriteLine("LL -> " + ll); Assert.AreEqual(chSym, ll.label); Assert.AreEqual(imList, ll.stack); }
public void LLConfPopCountTest() { CharSymbol chSym = new CharSymbol('A'); var stack = new Stack <DfaState <CharSymbol> >(); stack.Push(states["A1"]); stack.Push(states["A2"]); var ll = new LlConfiguration <CharSymbol>(chSym, stack); Assert.AreEqual(ll.Pop().Count(), 1); }
public void LLConfDiffCountNotEqualTest() { CharSymbol chSym = new CharSymbol('A'); var aaaList = ImmutableList.Create(states["A1"], states["A2"], states["A3"]); var aaList = ImmutableList.Create(states["A1"], states["A2"]); var ll1 = new LlConfiguration <CharSymbol>(chSym, aaaList); var ll2 = new LlConfiguration <CharSymbol>(chSym, aaList); Assert.AreNotEqual(ll1, ll2); }
public void LLConfThreeCountTest() { CharSymbol chSym = new CharSymbol('A'); var stack = new Stack <DfaState <CharSymbol> >(); stack.Push(new DfaState <CharSymbol>("A1")); stack.Push(new DfaState <CharSymbol>("A2")); stack.Push(new DfaState <CharSymbol>("A3")); var ll = new LlConfiguration <CharSymbol>(chSym, stack); Assert.AreEqual(ll.Count(), 3); }
public void LLConfSubsumesEqualLabelTest() { CharSymbol chSymA = new CharSymbol('A'); var llA = new LlConfiguration <CharSymbol>(chSymA); CharSymbol chSymB = new CharSymbol('A'); var llB = new LlConfiguration <CharSymbol>(chSymB); bool result = llA.Subsumes(llB); Assert.AreEqual(true, result); }
public void LLConfListConstructorStackTest() { CharSymbol chSym = new CharSymbol('A'); var stack = new Stack <DfaState <CharSymbol> >(); stack.Push(states["A1"]); stack.Push(states["A2"]); stack.Push(states["A3"]); var imList = ImmutableList.Create(states["A1"], states["A2"], states["A3"]); var ll = new LlConfiguration <CharSymbol>(chSym, imList); Assert.AreEqual(stack, ll.copyOfStack()); }
public void LLConfSubsumesFalseTest() { CharSymbol chSym = new CharSymbol('A'); var llA = new LlConfiguration <CharSymbol>(chSym); var llB = new LlConfiguration <CharSymbol>(chSym); llA = llA.Push(states["B2"]).Push(states["A3"]); llB = llB.Push(states ["A1"]).Push(states ["A2"]).Push(states ["A3"]); bool result = llA.Subsumes(llB); Assert.AreEqual(false, result); }