Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Check for boost-graph
[simgrid.git] / tools / tesh / set-output-sort.tesh
1 #! ./tesh
2
3 p This tests whether TESH correctly sorts command output
4
5 < p Test sorting and filtering of output
6
7 < $ true
8
9 < ! output sort
10 < $ true
11
12 < $ printf 'profiling: foo\\n'
13
14 < $ printf 'profiling: foo'
15
16 < ! output sort
17 < $ printf 'profiling: foo\\n'
18
19 < ! output sort
20 < $ printf 'profiling: foo'
21
22 < $ printf 'a\\nb\\nc\\nd\\n'
23 < > a
24 < > b
25 < > c
26 < > d
27
28 < $ printf 'a\\nb\\nc\\nd'
29 < > a
30 < > b
31 < > c
32 < > d
33
34 < ! output sort
35 < $ printf 'c\\nd\\nb\\na\\n'
36 < > a
37 < > b
38 < > c
39 < > d
40
41 < ! output sort
42 < $ printf 'c\\nd\\nb\\na'
43 < > a
44 < > b
45 < > c
46 < > d
47
48 < $ printf 'a\\nprofiling: foo\\nprofiling: bar\\nb\\nc\\nd\\nprofiling: baz\\n'
49 < > a
50 < > b
51 < > c
52 < > d
53
54 < $ printf 'a\\nprofiling: foo\\nprofiling: bar\\nb\\nc\\nd\\nprofiling: baz'
55 < > a
56 < > b
57 < > c
58 < > d
59
60 < ! output sort
61 < $ printf 'c\\nprofiling: foo\\nprofiling: bar\\nd\\nb\\na\\nprofiling: baz\\n'
62 < > a
63 < > b
64 < > c
65 < > d
66
67 < ! output sort
68 < $ printf 'c\\nprofiling: foo\\nprofiling: bar\\nd\\nb\\na\\nprofiling: baz'
69 < > a
70 < > b
71 < > c
72 < > d
73 $ perl ${bindir:=.}/tesh --enable-coverage
74 > Enable coverage
75 > Test suite from stdin
76 > [(stdin):1] Test sorting and filtering of output
77 > [(stdin):3] true
78 > [(stdin):6] true
79 > [(stdin):8] printf 'profiling: foo\\n'
80 > [(stdin):10] printf 'profiling: foo'
81 > [(stdin):13] printf 'profiling: foo\\n'
82 > [(stdin):16] printf 'profiling: foo'
83 > [(stdin):18] printf 'a\\nb\\nc\\nd\\n'
84 > [(stdin):24] printf 'a\\nb\\nc\\nd'
85 > [(stdin):31] printf 'c\\nd\\nb\\na\\n'
86 > [(stdin):38] printf 'c\\nd\\nb\\na'
87 > [(stdin):44] printf 'a\\nprofiling: foo\\nprofiling: bar\\nb\\nc\\nd\\nprofiling: baz\\n'
88 > [(stdin):50] printf 'a\\nprofiling: foo\\nprofiling: bar\\nb\\nc\\nd\\nprofiling: baz'
89 > [(stdin):57] printf 'c\\nprofiling: foo\\nprofiling: bar\\nd\\nb\\na\\nprofiling: baz\\n'
90 > [(stdin):64] printf 'c\\nprofiling: foo\\nprofiling: bar\\nd\\nb\\na\\nprofiling: baz'
91 > Test suite from stdin OK
92
93 p Check the Right Prefix Length (19) for "output sort"
94 ! output sort 19
95 < 12345678901234567 B line
96 < 12345678901234567 A line
97 $ cat
98 > 12345678901234567 A line
99 > 12345678901234567 B line
100
101 ! output sort 19
102 < 123456789012345678 B line
103 < 123456789012345678 A line
104 $ cat
105 > 123456789012345678 B line
106 > 123456789012345678 A line
107
108 ! expect return 2
109 ! output ignore
110 < ! output sort 19
111 < < 123456789012345678 B line
112 < < 123456789012345678 A line
113 < $ cat
114 < > 123456789012345678 A line
115 < > 123456789012345678 B line
116 $ perl ${bindir:=.}/tesh 
117
118 p Check user-defined prefix length for "output sort"
119 ! output sort 5
120 < 000 B line
121 < 000 A line
122 $ cat
123 > 000 A line
124 > 000 B line
125
126 ! output sort 4
127 < 000 B line
128 < 000 A line
129 $ cat
130 > 000 B line
131 > 000 A line
132
133 ! expect return 2
134 ! output ignore
135 < ! output sort 4
136 < < 000 B line
137 < < 000 A line
138 < $ cat
139 < > 000 A line
140 < > 000 B line
141 $ perl ${bindir:=.}/tesh