]>
Commit | Line | Data |
---|---|---|
564e94e6 RS |
1 | #!/bin/sh |
2 | ||
3 | test_description='Basic sort performance tests' | |
4 | . ./perf-lib.sh | |
5 | ||
6 | test_perf_default_repo | |
7 | ||
8 | test_expect_success 'setup' ' | |
9 | git ls-files --stage "*.[ch]" "*.sh" | | |
10 | cut -f2 -d" " | | |
11 | git cat-file --batch >unsorted | |
12 | ' | |
13 | ||
84edc406 RS |
14 | test_perf 'sort(1) unsorted' ' |
15 | sort <unsorted >sorted | |
564e94e6 RS |
16 | ' |
17 | ||
84edc406 RS |
18 | test_expect_success 'reverse' ' |
19 | sort -r <unsorted >reversed | |
564e94e6 RS |
20 | ' |
21 | ||
84edc406 RS |
22 | for file in sorted reversed |
23 | do | |
24 | test_perf "sort(1) $file" " | |
25 | sort <$file >actual | |
26 | " | |
27 | done | |
28 | ||
29 | for file in unsorted sorted reversed | |
30 | do | |
31 | ||
32 | test_perf "string_list_sort() $file" " | |
33 | test-tool string-list sort <$file >actual | |
34 | " | |
35 | ||
36 | test_expect_success "string_list_sort() $file sorts like sort(1)" " | |
37 | test_cmp_bin sorted actual | |
38 | " | |
39 | done | |
564e94e6 | 40 | |
40bc872a RS |
41 | for file in unsorted sorted reversed |
42 | do | |
b378c2ff | 43 | test_perf "DEFINE_LIST_SORT $file" " |
40bc872a RS |
44 | test-tool mergesort sort <$file >actual |
45 | " | |
46 | ||
b378c2ff | 47 | test_expect_success "DEFINE_LIST_SORT $file sorts like sort(1)" " |
40bc872a RS |
48 | test_cmp_bin sorted actual |
49 | " | |
50 | done | |
51 | ||
564e94e6 | 52 | test_done |