Example #1
0
 def test_3(self):
     '''should return 7'''
     A = 0
     B = 24
     K = 4
     self.assertEqual(7, solution(A, B, K))
Example #2
0
 def test_1(self):
     '''should return 1'''
     A = [3, 1, 2, 4, 3]
     self.assertEqual(1, solution(A))
Example #3
0
    def test_1(self):
        '''should return 5'''

        A = [1, 3, 6, 4, 1, 2]
        self.assertEqual(5, solution(A))
Example #4
0
 def test_1(self):
     '''should return 6'''
     X = 5
     A = [1, 3, 1, 4, 2, 3, 5, 4]
     self.assertEqual(6, solution(X, A))
Example #5
0
 def test_2(self):
     '''should return 0'''
     A = [4, 1, 3]
     self.assertEqual(0, solution(A))
Example #6
0
 def test_1(self):
     '''should return 1'''
     A = [4, 1, 3, 2]
     self.assertEqual(1, solution(A))
Example #7
0
 def test_15(self):
     """should return 0 for binary 15 (1111)"""
     self.assertEqual(solution(15), 0)
Example #8
0
 def test_array_big_k(self):
     '''should return  [3, 5, 1, 1, 2]'''
     k = 12
     a = [1, 1, 2, 3, 5]
     self.assertEqual([3, 5, 1, 1, 2], solution(a, k))
Example #9
0
 def test_529(self):
     """should return 4 for binary 529 (1000010001)"""
     self.assertEqual(solution(529), 4)
Example #10
0
 def test_20(self):
     """should return 1 for binary 20 (10100)"""
     self.assertEqual(solution(20), 1)
Example #11
0
 def test_1041(self):
     """should return 5 for binary 1041 (10000010001)"""
     self.assertEqual(solution(1041), 5)
Example #12
0
 def test_1(self):
     '''should return 3'''
     X = 10
     Y = 85
     D = 30
     self.assertEqual(3, solution(X, Y, D))
Example #13
0
 def test_2(self):
     '''should return 3'''
     X = 1
     Y = 5
     D = 2
     self.assertEqual(2, solution(X, Y, D))
Example #14
0
 def test_K_gt_A(self):
     '''should return [7, 6, 3, 8, 9]'''
     k = 7
     a = [3, 8, 9, 7, 6]
     self.assertEqual([7, 6, 3, 8, 9], solution(a, k))
Example #15
0
 def test_1(self):
     '''should return 5'''
     A = [0, 1, 0, 1, 1]
     self.assertEqual(5, solution(A))
Example #16
0
 def test_array_small_k(self):
     '''should return  [6, 7, 1, 2, 3, 4, 5]'''
     k = 2
     a = [1, 2, 3, 4, 5, 6, 7]
     self.assertEqual([6, 7, 1, 2, 3, 4, 5], solution(a, k))
Example #17
0
 def test_2(self):
     '''should return 3'''
     A = [2, 1, 5, 4]
     self.assertEqual(3, solution(A))
Example #18
0
 def test_empty_array(self):
     '''should return []'''
     k = 3
     a = []
     self.assertEqual([], solution(a, k))
Example #19
0
 def test_3(self):
     '''should return 3'''
     A = [2, 1, 5, 4, 8, 6, 3]
     self.assertEqual(7, solution(A))
Example #20
0
 def test_3(self):
     '''should return 0'''
     A = [1, 1]
     self.assertEqual(0, solution(A))
Example #21
0
 def test_empty(self):
     '''should return 1'''
     A = []
     self.assertEqual(1, solution(A))
Example #22
0
    def test_2(self):
        '''should return 2'''

        A = [1]
        self.assertEqual(2, solution(A))
Example #23
0
 def test_1(self):
     '''should return 4'''
     A = [2, 3, 1, 5]
     self.assertEqual(4, solution(A))
Example #24
0
 def test_2(self):
     '''should return -1'''
     X = 5
     A = [3]
     self.assertEqual(-1, solution(X, A))
Example #25
0
 def test_K_e_zero(self):
     '''should return [3, 8, 9, 7, 6]'''
     k = 0
     a = [3, 8, 9, 7, 6]
     self.assertEqual([3, 8, 9, 7, 6], solution(a, k))
Example #26
0
 def test_2(self):
     '''should return 4'''
     A = 6
     B = 12
     K = 2
     self.assertEqual(4, solution(A, B, K))
Example #27
0
 def test_K_lt_A(self):
     '''should return [9, 7, 6, 3, 8]'''
     k = 3
     a = [3, 8, 9, 7, 6]
     self.assertEqual([9, 7, 6, 3, 8], solution(a, k))
Example #28
0
 def test_1(self):
     '''should return 3'''
     A = 6
     B = 11
     K = 2
     self.assertEqual(3, solution(A, B, K))
Example #29
0
 def test_2(self):
     '''should return 2000'''
     A = [-1000, 1000]
     self.assertEqual(2000, solution(A))