Add some regression tests for sortBy to test stability of the sort.

This commit is contained in:
Brian Huffman 2021-05-06 12:03:47 -07:00
parent 3b62788841
commit 9b7e60b9f4
2 changed files with 18 additions and 0 deletions

View File

@ -0,0 +1,4 @@
sortBy (\x y -> x.0 ==> y.0) [(True, 0x1), (False, 0x2), (True, 0x3), (False, 0x4)]
[ ((n * n) % 23 : Integer, n) | n <- [0..22] ]
sortBy (\x y -> x.0 <= y.0) it
sortBy (\x y -> x.1 >= y.1) it

View File

@ -0,0 +1,14 @@
Loading module Cryptol
[(False, 0x2), (False, 0x4), (True, 0x1), (True, 0x3)]
[(0, 0), (1, 1), (4, 2), (9, 3), (16, 4), (2, 5), (13, 6), (3, 7),
(18, 8), (12, 9), (8, 10), (6, 11), (6, 12), (8, 13), (12, 14),
(18, 15), (3, 16), (13, 17), (2, 18), (16, 19), (9, 20), (4, 21),
(1, 22)]
[(0, 0), (1, 1), (1, 22), (2, 5), (2, 18), (3, 7), (3, 16), (4, 2),
(4, 21), (6, 11), (6, 12), (8, 10), (8, 13), (9, 3), (9, 20),
(12, 9), (12, 14), (13, 6), (13, 17), (16, 4), (16, 19), (18, 8),
(18, 15)]
[(1, 22), (4, 21), (9, 20), (16, 19), (2, 18), (13, 17), (3, 16),
(18, 15), (12, 14), (8, 13), (6, 12), (6, 11), (8, 10), (12, 9),
(18, 8), (3, 7), (13, 6), (2, 5), (16, 4), (9, 3), (4, 2), (1, 1),
(0, 0)]