// tests that a list with nodes were created by finding nodes in a created list public void ShouldCreateListAndNodes(int arrIdx, string cerVal) { CerealList testList = Program.CreateInitialList(); string[] testArr = testList.ListToArr(5); Assert.Equal(cerVal, testArr[arrIdx]); }
// tests that an LL with only one node just gets returned public void ShouldReturnSingleEntryList() { CerealList testList = new CerealList(new Cereal("Raisin Bran")); Program.ReverseLL(testList); string[] testArr = testList.ListToArr(1); Assert.Equal("Raisin Bran", testArr[0]); }
// tests that the test LL is being reversed public void ShouldReverseTheLL(string cereal, int index) { CerealList testList = Program.generateListForTesting(); Program.ReverseLL(testList); string[] testArr = testList.ListToArr(4); Assert.Equal(cereal, testArr[index]); }
public void ShouldMergeWhenListBIsLonger(int index, string expectedOutput) { CerealList Post = Program.genListThree(); CerealList Kellogs = Program.genListTwo(); CerealList CombinedList = Program.Merge(Post, Kellogs); string[] CombinedArr = CombinedList.ListToArr(6); Assert.Equal(expectedOutput, CombinedArr[index]); }
public void ShouldMergeWhenListAIsLonger(int index, string expectedOutput) { CerealList GeneralMills = Program.genListOne(); CerealList Post = Program.genListThree(); CerealList CombinedList = Program.Merge(GeneralMills, Post); string[] CombinedArr = CombinedList.ListToArr(6); Assert.Equal(expectedOutput, CombinedArr[index]); }
public void ShouldMergeEqualLengthLists(int index, string expectedOutput) { CerealList GeneralMills = Program.genListOne(); CerealList Kellogs = Program.genListTwo(); CerealList CombinedList = Program.Merge(GeneralMills, Kellogs); string[] CombinedArr = CombinedList.ListToArr(8); Assert.Equal(expectedOutput, CombinedArr[index]); }
public void ShouldAddCerealToListEnd() { CerealList testList = Program.CreateInitialList(); Cereal frostedFlakes = new Cereal("Frosted Flakes"); testList.AppendCereal(frostedFlakes); string[] testArr = testList.ListToArr(6); Assert.Equal("Frosted Flakes", testArr[5]); }
public void ShouldAddCerealAfterFruitLoops() { CerealList testList = Program.CreateInitialList(); Cereal frostedFlakes = new Cereal("Frosted Flakes"); testList.AddAfter(frostedFlakes, "Fruit Loops"); string[] testArr = testList.ListToArr(6); Assert.Equal("Frosted Flakes", testArr[2]); Assert.Equal("Fruit Loops", testArr[1]); }
// tests that the method can reverse a longer LL with an odd number of nodes public void ShouldReverseOddNumberLL(string cereal, int index) { CerealList testList = Program.generateListForTesting(); testList.AddCereal(new Cereal("Fruity Yummy Mummy")); testList.AddCereal(new Cereal("Cap'n Crunch")); testList.AddCereal(new Cereal("Golden Grahams")); Program.ReverseLL(testList); string[] testArr = testList.ListToArr(7); Assert.Equal(cereal, testArr[index]); }