Example #1
0
 public void BitCountingTest()
 {
     Assert.AreEqual(0, BitCounting.CountBits(0));
     Assert.AreEqual(1, BitCounting.CountBits(4));
     Assert.AreEqual(3, BitCounting.CountBits(7));
     Assert.AreEqual(2, BitCounting.CountBits(9));
     Assert.AreEqual(2, BitCounting.CountBits(10));
 }
 public void ShouldReturnNumberOfOnesInBinaryRepresentationOfInt(int number, int expected)
 {
     Assert.Equal(expected, BitCounting.CountBits(number));
 }
 public void CountBitsTest(int input, int output)
 {
     Assert.Equal(output, BitCounting.CountBits(input));
 }