-
Notifications
You must be signed in to change notification settings - Fork 4
/
find_large_directories.test.pl
173 lines (158 loc) · 3.28 KB
/
find_large_directories.test.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
use warnings;
use strict;
my $out = readpipe ('..\find_large_directories.pl directories');
die "Difference found in first test:
$out
" unless $out eq '
Total size: 352
+--- 352
| +---a 162
| | +---a1 5
| | +---a2 64
| | | +---a2a 45
| | | +---a2b 10
| | | +---a2c 6
| | | | +---a2c1 2
| | | | +---a2c2 2
| | | | +---a2c3 1
| | +---a3 93
| | | +---a3a 60
| | | | +---a3a1 40
| | | | | +---a3a1a 9
| | | | | +---a3a1b 10
| | | +---a3b 26
| +---b 122
| | +---b1 122
| | | +---b1a 122
| | | | +---b1a1 122
| | | | | +---b1a1a 122
| | | | | | +---b1a1a1 122
| | | | | | | +---b1a1a1a 122
| | | | | | | | +---b1a1a1a1 122
| | | | | | | | | +---b1a1a1a1a 122
| +---c 68
| | +---c1 39
| | +---c2 29
| | | +---c2a 9
| | | +---c2b 20
';
$out = readpipe ('..\find_large_directories.pl -l 2 directories');
die "Difference found in second test:
$out
" unless $out eq '
Total size: 352
+--- 352
| +---a 162
| | +---a3 93
| | | +---a3a 60
| | | | +---a3a1 40
| | | | | +---a3a1b 10
| | | | | +---a3a1a 9
| | | +---a3b 26
| | +---a2 64
| | | +---a2a 45
| | | +---a2b 10
| +---b 122
| | +---b1 122
| | | +---b1a 122
| | | | +---b1a1 122
| | | | | +---b1a1a 122
| | | | | | +---b1a1a1 122
| | | | | | | +---b1a1a1a 122
| | | | | | | | +---b1a1a1a1 122
| | | | | | | | | +---b1a1a1a1a 122
';
$out = readpipe ('..\find_large_directories.pl -l 2 -pct directories');
die "Difference found in third test:
$out
" unless $out eq '
Total size: 352
+--- 100.00
| +---a 46.02
| | +---a3 26.42
| | | +---a3a 17.05
| | | | +---a3a1 11.36
| | | | | +---a3a1b 2.84
| | | | | +---a3a1a 2.56
| | | +---a3b 7.39
| | +---a2 18.18
| | | +---a2a 12.78
| | | +---a2b 2.84
| +---b 34.66
| | +---b1 34.66
| | | +---b1a 34.66
| | | | +---b1a1 34.66
| | | | | +---b1a1a 34.66
| | | | | | +---b1a1a1 34.66
| | | | | | | +---b1a1a1a 34.66
| | | | | | | | +---b1a1a1a1 34.66
| | | | | | | | | +---b1a1a1a1a 34.66
';
$out = readpipe ('..\find_large_directories.pl -depth 3 directories');
die "Difference found in fourth test:
$out
" unless $out eq '
Total size: 352
+--- 352
| +---a 162
| | +---a1 5
| | +---a2 64
| | +---a3 93
| +---b 122
| | +---b1 122
| +---c 68
| | +---c1 39
| | +---c2 29
';
$out = readpipe ('..\find_large_directories.pl -depth 5 -largest 3 -curly directories');
die "Difference found in fifth test:
$out
" unless $out eq '
Total size: 352
{ 352
{ a 162
{ a3 93
{ a3a 60
{ a3a1 40
}
}
{ a3b 26
}
}
{ a2 64
{ a2a 45
}
{ a2b 10
}
{ a2c 6
{ a2c1 2
}
{ a2c2 2
}
{ a2c3 1
}
}
}
{ a1 5
}
}
{ b 122
{ b1 122
{ b1a 122
{ b1a1 122
}
}
}
}
{ c 68
{ c1 39
}
{ c2 29
{ c2b 20
}
{ c2a 9
}
}
}
}
';