Esempio n. 1
0
 def test1(self):
     A = [1, 2, 3, 7, 3, 2, 5]
     res = suffle_array(A)
     print res
     for i in range(1, len(res)):
         remainder = i % 2
         if remainder == 0:
             if res[i] > res[i - 1]:
                 self.fail(res)
         else:
             if res[i] < res[i - 1]:
                 self.fail(res)
Esempio n. 2
0
 def test2(self):
     N = 10
     LEFT = 1
     RIGHT = 100
     A = []
     for i in range(N):
         A.append(random.randint(LEFT, RIGHT))
     res = suffle_array(A)
     print res
     for i in range(1, len(res)):
         remainder = i % 2
         if remainder == 0:
             if res[i] > res[i - 1]:
                 self.fail(res)
         else:
             if res[i] < res[i - 1]:
                 self.fail(res)