summaryrefslogtreecommitdiff
path: root/libstd/test/sort.myr
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-08-26 12:20:58 -0700
committerOri Bernstein <ori@eigenstate.org>2015-08-26 12:20:58 -0700
commit2bc852bda98762d3bc01548bf972e3f1b137fbfb (patch)
tree74831deed3c9057c5fe0cbb8790d220e855bc792 /libstd/test/sort.myr
parent3de952510eb2a23350d24ed926f19c0cf72a12f2 (diff)
downloadmc-2bc852bda98762d3bc01548bf972e3f1b137fbfb.tar.gz
Move Myrddin libs to lib/ subdirectory.
Diffstat (limited to 'libstd/test/sort.myr')
-rw-r--r--libstd/test/sort.myr38
1 files changed, 0 insertions, 38 deletions
diff --git a/libstd/test/sort.myr b/libstd/test/sort.myr
deleted file mode 100644
index e814623..0000000
--- a/libstd/test/sort.myr
+++ /dev/null
@@ -1,38 +0,0 @@
-use std
-
-const main = {
- var i
-
- var a = [ 3, 5, 4, 9, 7, 2, 6, 0, 1, 8, ]
- var a_sorted = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
- var b = [3, 4, 5, 1, 2, 6, 7, 8, 9, 10]
- var b_sorted = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
- var c = ["a", "aa", "b", "C", "Cc", "cC", "d", "f", "fuckit", "go",]
- var c_sorted = ["C", "Cc", "a", "aa", "b", "cC", "d", "f", "fuckit", "go"]
-
- /* with custom intcmp */
- std.sort(a[:], intcmp)
- std.assert(std.sleq(a[:], a_sorted[:]), "a was missorted")
-
- /* with libstd generic numcmp */
- std.sort(b[:], std.numcmp)
- std.assert(std.sleq(b[:], b_sorted[:]), "b was missorted")
-
- /* string sorting */
- std.sort(c[:], std.strcmp)
- for i = 0; i < c.len; i++
- std.assert(std.sleq(c[i], c_sorted[i]), "c was missorted")
- ;;
-}
-
-const intcmp = {a, b
- if a < b
- -> `std.Before
- elif a == b
- -> `std.Equal
- else
- -> `std.After
- ;;
-}
-
-