public void TestLoadedLifo() { LifoQueue <string> lifoQueue = new LifoQueue <string>(); lifoQueue.Push("element"); Assert.False(lifoQueue.IsEmpty()); }
public void TestClearQueue() { LifoQueue <string> lifoQueue = new LifoQueue <string>(); lifoQueue.Push("One-Elemement"); lifoQueue.Clear(); Assert.True(lifoQueue.IsEmpty()); }
public void EnsureLifoOrder() { string first = "first"; string second = "second"; LifoQueue <string> lifoQueue = new LifoQueue <string>(); lifoQueue.Push(first); lifoQueue.Push(second); Assert.Equal(second, lifoQueue.Pop()); Assert.Equal(first, lifoQueue.Pop()); }
public void BfsWhenFrontierLifoQueue() { IFrontier <Node <String> > frontier = new LifoQueue <Node <string> >(); UninformedSearch <String> bfsSearch = new UninformedSearch <string>(_problem, frontier); SearchResult <String> searchResult = bfsSearch.Search(); List <String> states = searchResult.States.ToList(); List <EdgeAction <String> > actions = searchResult.Actions.Cast <EdgeAction <String> >().ToList(); Assert.Equal(states, new List <String> { "e", "b", "c", "a" }); Assert.Equal(actions, new List <EdgeAction <String> > { new EdgeAction <String>(new Edge <String>("b", "e", 1)), new EdgeAction <String>(new Edge <String>("c", "b", 1)), new EdgeAction <String>(new Edge <String>("a", "c", 1)), null }); Assert.Equal(3, searchResult.Cost); Assert.Equal(4, bfsSearch.ClosedList.Count); Assert.Equal(5, bfsSearch.OpenList.Count); }
public void TestEmptyLifo() { LifoQueue <string> lifoQueue = new LifoQueue <string>(); Assert.True(lifoQueue.IsEmpty()); }