コード例 #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
ファイル: Test_5_3.cs プロジェクト: jkrez/Interview
        public void Validate(int expected, int n)
        {
            var result = Question_5_3.FlipBit(n);

            Assert.AreEqual(expected, result);
        }