kuroko/test/testSortReverse.krk

14 lines
314 B
Python
Raw Permalink Normal View History

2024-03-05 08:43:57 +03:00
import random
def __main__(a,n=50000):
for j in range(n):
a.append(random.random())
a.append(42) # Forces heterogynous sorting in CPython
a.sort()
for j in range(n):
assert(a[j] <= a[j+1])
a.sort(reverse=True)
for j in range(n):
assert(a[j] >= a[j+1])
__main__([])