Пример #1
0
        public void FindLongestSequenceTest(int testNumber, int expectedLength)
        {
            // Act
            int resultLength1 = Question_5_3.FindLongestSequence(testNumber);
            int resultLength2 = Question_5_3.FindLongestSequenceOptimal(testNumber);

            // Assert
            Assert.AreEqual(expectedLength, resultLength1, $"Failed to find the longest sequence of 1s for {testNumber}.");
            Assert.AreEqual(expectedLength, resultLength2, $"Failed to find the longest sequence of 1s for {testNumber} - Optimal.");
        }
Пример #2
0
        public void Validate(int expected, int n)
        {
            var result = Question_5_3.FlipBit(n);

            Assert.AreEqual(expected, result);
        }