WARNING! Access to this system is limited to authorised users only.
Unauthorised users may be subject to prosecution.
Unauthorised access to this system is a criminal offence under Australian law (Federal Crimes Act 1914 Part VIA)
It is a criminal offence to:
(1) Obtain access to data without authority. -Penalty 2 years imprisonment.
(2) Damage, delete, alter or insert data without authority. -Penalty 10 years imprisonment.
User activity is monitored and recorded. Anyone using this system expressly consents to such monitoring and recording.

Commit 6adde28c authored by qinsoon's avatar qinsoon
Browse files

add some output to quicksort test

parent 4969b45f
......@@ -194,6 +194,9 @@ def test_quicksort():
setstate(init_state)
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],
else:
print
for i in range(n):
assert lst_s[i] == arr[i], "%d != %d" % (lst_s[i], arr[i])
@may_spawn_proc
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