コード例 #1
0
        public void TestMetho6()
        {
            Ana   a = new Ana();
            Rando r = new Rando();
            int   x = r.RandomNumLengthofArray(100000);
            int   y = r.RandomNumLengthofWords(10000);
            int   z = r.RandomNumOfAnagrams(40000);

            int fin        = x - z;
            int finalCount = a.anagrams(r.randomGen(x, y, z));

            Assert.AreEqual(finalCount, fin);
        }
コード例 #2
0
        public static double Timer()
        {
            Rando r = new Rando();
            Ana   a = new Ana();



            Stopwatch sw = new Stopwatch();

            double elapsed     = 0;
            long   repetitions = 1;

            int size = 32;

            do
            {
                repetitions *= 2;

                int _x = r.RandomNumLengthofArray(size);
                int _y = r.RandomNumLengthofWords(100);
                int _z = r.RandomNumOfAnagrams(size);

                List <string> Time = r.randomGen(size, _y, _z);

                sw.Restart();
                for (long i = 0; i < repetitions; i++)
                {
                    double time = a.anagrams(Time);
                }
                sw.Stop();
                elapsed = msecs(sw);
                size    = size * 2;
            } while (elapsed < DURATION);


            double totalAverage = elapsed / repetitions;

            return(totalAverage);
        }