public static void DoTest() { var list = CatalanNumbers.GetRange(0, 100); var list2 = new List <ulong>(); // TRY CALCULATING FROM Bin.Coeff. for (uint i = 0; i < list.Count; ++i) { var catalanNumber = CatalanNumbers.GetNumberByBinomialCoefficients(i); list2.Add(catalanNumber); Debug.Assert(list[(int)i] == list2[(int)i], "Wrong calculation."); } // PRINT NUMBERS for (uint i = 0; i < list.Count; ++i) { Console.Write(list[(int)i] + ", "); } Console.ReadLine(); }
public static void DoTest() { var list = CatalanNumbers.GetRange(0, 100); var list2 = new List <ulong>(); // TRY CALCULATING FROM Bin.Coeff. for (uint i = 0; i < list.Count; ++i) { var catalanNumber = CatalanNumbers.GetNumberByBinomialCoefficients(i); list2.Add(catalanNumber); Assert.True(list[(int)i] == list2[(int)i], "Wrong calculation."); } }
public void WhenIGetARangeOfCatalanNumbers(uint from, uint to) { _from = Convert.ToInt32(from); _to = Convert.ToInt32(to); if (from <= 26 && to <= 26) { _range = CatalanNumbers.GetRange(from, to); } else { _scenarioContext.Pending(); } }