public void DecodeWaysTests_Iterative_Success() { var expectedResult = 3; //(2,2,6), (22,6), (2,26) string encodedText = "226"; var result = new DecodeWays().DecodeWaysIterativeSolver(encodedText); Assert.AreEqual(result, expectedResult); }
public static void AssertAndLog(string s, int expectation) { var solution = new DecodeWays(); var output = solution.NumDecodings(s); if (output != expectation) { Console.WriteLine($"{s} -> expected={expectation} output={output}"); } }
public void NumDecodingsTests() { DecodeWays obj = new DecodeWays(); var s = "12"; var x = obj.NumDecodings(s);//2 s = "226"; x = obj.NumDecodings(s); //3 s = "121"; x = obj.NumDecodings(s);//3 s = "1234"; x = obj.NumDecodings(s);//3 s = "100"; x = obj.NumDecodings(s);//0 s = "30"; x = obj.NumDecodings(s);//0 s = "29"; x = obj.NumDecodings(s);//1 s = "309"; x = obj.NumDecodings(s);//0 s = "10"; x = obj.NumDecodings(s);//1 s = "1001"; x = obj.NumDecodings(s);//0 s = "110"; x = obj.NumDecodings(s);//0 }