From 84203501a5f084e8d0e34f7344be05cc4e186802 Mon Sep 17 00:00:00 2001 From: "K. Lange" Date: Tue, 5 Mar 2024 14:43:57 +0900 Subject: [PATCH] Add simple reverse sort test --- test/testSortReverse.krk | 13 +++++++++++++ test/testSortReverse.krk.expect | 0 2 files changed, 13 insertions(+) create mode 100644 test/testSortReverse.krk create mode 100644 test/testSortReverse.krk.expect diff --git a/test/testSortReverse.krk b/test/testSortReverse.krk new file mode 100644 index 0000000..600dc5b --- /dev/null +++ b/test/testSortReverse.krk @@ -0,0 +1,13 @@ +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__([]) diff --git a/test/testSortReverse.krk.expect b/test/testSortReverse.krk.expect new file mode 100644 index 0000000..e69de29