Ejemplo n.º 1
0
        public void OddNumbers_OddCount_RandomTest()
        {
            Random rnd = new Random();

            for (int i = 0; i < 100; ++i)
            {
                // some very very poor ulong generator
                ulong n = ((ulong)rnd.Next() << rnd.Next(0, 31)) + (ulong)rnd.Next();

                Assert.AreEqual(n / 2, OddNumbers.OddCount(n));
            }
        }
Ejemplo n.º 2
0
 public void OddNumbers_OddCount_Test()
 {
     Assert.AreEqual(7, OddNumbers.OddCount(15));
     Assert.AreEqual(7511, OddNumbers.OddCount(15023));
 }