public void CountFrequencySorted() { const int repetitionCount = 3; var input = new[] { 1, 1, 1, 2, 2, 3, 3, 3 }; const int expected = 2; var actual = MissingNumber.CountFrequency(repetitionCount, input); Assert.AreEqual(expected, actual); }
public void BitwiseUnsorted() { const int repetitionCount = 3; var input = new[] { 1, 2, 3, 1, 2, 3, 1, 3 }; const int expected = 2; var actual = MissingNumber.Bitwise(repetitionCount, input); Assert.AreEqual(expected, actual); }
public void CountFrequencyUnsorted() { const int repetitionCount = 3; var input = new[] { 1, 2, 3, 1, 2, 3, 1, 3 }; const int expected = 2; var actual = MissingNumber.CountFrequency(repetitionCount, input); // Testing 'are not equal' because this algorithm only works when the numbers are sorted by value // It should fail on an unsorted array of numbers Assert.AreNotEqual(expected, actual); }