Пример #1
0
        public void sumIsReachable_Test_FailsDueTo6s()
        {
            // Arrange
            int[] arr      = new int[] { 5, 6, 8, 6, 9, 2 };
            int   target   = 11;
            bool  expected = false;

            // Act
            bool result = Crypto_ArrayProblems.sumIsReachable(0, arr, target);

            // Assert
            Assert.AreEqual(expected, result);
        }
Пример #2
0
        public void sumIsReachable_Test_WithNegatives()
        {
            // Arrange
            int[] arr      = new int[] { -5, 6, 8, 6, 8, 2 };
            int   target   = 9;
            bool  expected = true;

            // Act
            bool result = Crypto_ArrayProblems.sumIsReachable(0, arr, target);

            // Assert
            Assert.AreEqual(expected, result);
        }
Пример #3
0
        public void sumIsReachable_Test_NeedAll()
        {
            // Arrange
            int[] arr      = new int[] { 5, 6, 8, 6, 9, 2 }; // 11 + 14 + 11 = 22 + 14 = 30 + 6 = 36
            int   target   = 36;
            bool  expected = true;

            // Act
            bool result = Crypto_ArrayProblems.sumIsReachable(0, arr, target);

            // Assert
            Assert.AreEqual(expected, result);
        }