aboutsummaryrefslogtreecommitdiff
path: root/testsuite/sort.tests
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2005-09-02 00:41:53 +0000
committerRob Landley <rob@landley.net>2005-09-02 00:41:53 +0000
commit1689075c992a45a4a50f1aaad8aaf1d2983060c8 (patch)
tree679fa07497ea54120459a76464d3257862537b2e /testsuite/sort.tests
parentbabd3fbba668e04841cbe683ca49097fb871fca8 (diff)
downloadbusybox-w32-1689075c992a45a4a50f1aaad8aaf1d2983060c8.tar.gz
busybox-w32-1689075c992a45a4a50f1aaad8aaf1d2983060c8.tar.bz2
busybox-w32-1689075c992a45a4a50f1aaad8aaf1d2983060c8.zip
Working on a new test harness. Moved the sort tests into it.
Diffstat (limited to 'testsuite/sort.tests')
-rwxr-xr-xtestsuite/sort.tests69
1 files changed, 69 insertions, 0 deletions
diff --git a/testsuite/sort.tests b/testsuite/sort.tests
new file mode 100755
index 000000000..b23cf4312
--- /dev/null
+++ b/testsuite/sort.tests
@@ -0,0 +1,69 @@
1#!/bin/sh
2
3# SUSv3 compliant sort tests.
4# Copyright 2005 by Rob Landley <rob@landley.net>
5# Licensed under GPL v2, see file LICENSE for details.
6
7if [ ${#COMMAND} -eq 0 ]; then COMMAND=sort; fi
8. testing.sh
9
10# The basic tests. These should work even with the small busybox.
11
12testing "sort" "input" "a\nb\nc\n" "c\na\nb\n" ""
13testing "sort #2" "input" "010\n1\n3\n" "3\n1\n010\n" ""
14testing "sort stdin" "" "a\nb\nc\n" "" "b\na\nc\n"
15testing "sort numeric" "-n input" "1\n3\n010\n" "3\n1\n010\n" ""
16testing "sort reverse" "-r input" "wook\nwalrus\npoint\npabst\naargh\n" \
17 "point\nwook\npabst\naargh\nwalrus\n" ""
18
19# These tests require the full option set.
20
21# Longish chunk of data re-used by the next few tests
22
23data="42 1 3 woot
2442 1 010 zoology
25egg 1 2 papyrus
267 3 42 soup
27999 3 0 algebra
28"
29
30# Sorting with keys
31
32testing "sort one key" "-k4,4 input" \
33"999 3 0 algebra
34egg 1 2 papyrus
357 3 42 soup
3642 1 3 woot
3742 1 010 zoology
38" "$data" ""
39
40testing "sort key range with numeric option" "-k2,3n input" \
41"42 1 010 zoology
4242 1 3 woot
43egg 1 2 papyrus
447 3 42 soup
45999 3 0 algebra
46" "$data" ""
47
48# Busybox is definitely doing this one wrong just now...
49
50testing "sort key range with numeric option and global reverse" \
51"-k2,3n -r input" \
52"egg 1 2 papyrus
5342 1 3 woot
5442 1 010 zoology
55999 3 0 algebra
567 3 42 soup
57" "$data" ""
58
59#
60
61testing "sort key range with multiple options" "-k2,3rn input" \
62"7 3 42 soup
63999 3 0 algebra
6442 1 010 zoology
6542 1 3 woot
66egg 1 2 papyrus
67" "$data" ""
68
69exit $FAILCOUNT