]>
Commit | Line | Data |
---|---|---|
424d8455 LE |
1 | ## @file |
2 | # Small test script generator for OrderedCollectionTest. | |
3 | # | |
4 | # Usage: | |
5 | # - generate script: sh gentest.sh >input.txt | |
6 | # - run script with tester: OrderedCollectionTest -i input.txt -o output.txt | |
7 | # | |
8 | # Copyright (C) 2014, Red Hat, Inc. | |
9 | # | |
bcb96695 | 10 | # SPDX-License-Identifier: BSD-2-Clause-Patent |
424d8455 LE |
11 | ## |
12 | ||
13 | set -e -u -C | |
14 | ||
15 | RANGE_START=0 | |
16 | RANGE_STOP=9999 | |
17 | ||
18 | gen_rnd_insert() | |
19 | { | |
20 | shuf --input-range=$RANGE_START-$RANGE_STOP | sed 's/^/insert /' | |
21 | } | |
22 | ||
23 | gen_rnd_delete() | |
24 | { | |
25 | shuf --input-range=$RANGE_START-$RANGE_STOP | sed 's/^/delete /' | |
26 | } | |
27 | ||
28 | gen_mon_inc_insert() | |
29 | { | |
30 | seq $RANGE_START $RANGE_STOP | sed 's/^/insert /' | |
31 | } | |
32 | ||
33 | gen_mon_inc_delete() | |
34 | { | |
35 | seq $RANGE_START $RANGE_STOP | sed 's/^/delete /' | |
36 | } | |
37 | ||
38 | gen_mon_dec_delete() | |
39 | { | |
40 | seq $RANGE_START $RANGE_STOP | tac | sed 's/^/delete /' | |
41 | } | |
42 | ||
43 | { | |
44 | echo '# populate the tree in random order and empty it iterating forward' | |
45 | gen_rnd_insert | |
46 | echo forward-empty | |
47 | ||
48 | echo | |
49 | echo '# populate the tree in random order and empty it iterating backward' | |
50 | gen_rnd_insert | |
51 | echo backward-empty | |
52 | ||
53 | echo | |
54 | echo '# populate the tree in random order, list it in increasing and' | |
55 | echo '# decreasing order, then empty it in random order' | |
56 | gen_rnd_insert | |
57 | echo forward-list | |
58 | echo backward-list | |
59 | gen_rnd_delete | |
60 | ||
61 | echo | |
62 | echo '# populate the tree in monotonically increasing order, then undo it' | |
63 | echo '# piecewise in the same order' | |
64 | gen_mon_inc_insert | |
65 | gen_mon_inc_delete | |
66 | ||
67 | echo | |
68 | echo '# populate the tree in monotonically increasing order, then undo it' | |
69 | echo '# piecewise in reverse order' | |
70 | gen_mon_inc_insert | |
71 | gen_mon_dec_delete | |
72 | ||
73 | echo | |
74 | echo '# populate the tree randomly, trigger a run of collisions, then exit' | |
75 | echo '# and let CmdForwardEmpty() empty the tree' | |
76 | gen_rnd_insert | |
77 | gen_mon_inc_insert | |
78 | } \ | |
79 | | unix2dos |