Esempio n. 1
0
        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();
        }
Esempio n. 2
0
        public void WhenIGetCatalanNumberUsingBinomCoefficients(uint rank)
        {
            _rank = Convert.ToInt32(rank);

            if (rank <= 26)
            {
                _catalanNumber = CatalanNumbers.GetNumberByBinomialCoefficients(rank);
            }
            else
            {
                _scenarioContext.Pending();
            }
        }
        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.");
            }
        }