GitLab will be upgraded on June 2nd 2020 at 2.00 pm (AEDT) to 3.00 pm (AEDT) due to Critical Security Patch Availability. During the update, GitLab and Mattermost services will not be available. If you have any concerns with this, please talk to local Gitlab admin team.

Commit 6adde28c authored by qinsoon's avatar qinsoon

add some output to quicksort test

parent 4969b45f
......@@ -194,6 +194,9 @@ def test_quicksort():
lst, init_state = rand_list_of(n)
print "original list:"
print lst
with lltype.scoped_alloc(rffi.CArray(rffi.LONGLONG), n) as arr:
for i, k in enumerate(lst):
arr[i] = k
......@@ -201,12 +204,22 @@ def test_quicksort():
fnc(arr, 0, n - 1) # inplace sort
lst_s = sorted(lst)
print "expected list:"
print lst_s
print "result:"
for i in range(n):
print arr[i],
for i in range(n):
assert lst_s[i] == arr[i], "%d != %d" % (lst_s[i], arr[i])
def test_quicksort_partition():
def test_partition_in_quicksort():
# algorithm taken from Wikipedia
def swap(arr, i, j):
t = arr[i]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment