public void Day14_TestReadPolymers_OK() { var lines = Utils.ReadLinesFromFile("Day14Test.txt"); Assert.Equal(18, lines.Length); var sut = new Polymerizer(lines); Assert.Equal("NNCB", sut.Template); sut.PairInsertion(); Assert.Equal("NCNBCHB", sut.Template); sut.PairInsertion(); Assert.Equal("NBCCNBBBCBHCB", sut.Template); sut.PairInsertion(); Assert.Equal("NBBBCNCCNBBNBNBBCHBHHBCHB", sut.Template); sut.PairInsertion(); Assert.Equal("NBBNBNBBCCNBCNCCNBBNBBNBBBNBBNBBCBHCBHHNHCBBCBHCB", sut.Template); for (int i = 0; i < 6; i++) { sut.PairInsertion(); } long actual = sut.QuantityOfElements(); Assert.Equal(1588, actual); }
public void Day14_Puzzle1_OK() { var lines = Utils.ReadLinesFromFile("Day14.txt"); Assert.Equal(102, lines.Length); var sut = new Polymerizer(lines); Assert.Equal("KOKHCCHNKKFHBKVVHNPN", sut.Template); for (int i = 0; i < 10; i++) { sut.PairInsertion(); } long actual = sut.QuantityOfElements(); Assert.Equal(3406, actual); }
public void Day14_Test_OnePair40_OK() { var lines = Utils.ReadLinesFromFile("Day14Test.txt"); Assert.Equal(18, lines.Length); var sut = new Polymerizer(lines); Assert.Equal("NNCB", sut.Template); // reset Template one pair //sut.Template = "NN"; for (int i = 0; i < 40; i++) { sut.PairInsertion(); } long actual = sut.QuantityOfElements(); Assert.Equal(0, actual); }