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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
//! Unit tests for `format_bytes` and `format_signed_bytes` functions.
use ;
/// What: Test `format_bytes` with zero bytes.
///
/// Inputs:
/// - `value`: 0 bytes
///
/// Output:
/// - Returns "0 B"
///
/// Details:
/// - Verifies that zero bytes are formatted correctly without decimal places.
/// What: Test `format_bytes` with single byte.
///
/// Inputs:
/// - `value`: 1 byte
///
/// Output:
/// - Returns "1 B"
///
/// Details:
/// - Verifies that single bytes are formatted without decimal places.
/// What: Test `format_bytes` with bytes less than 1 KiB.
///
/// Inputs:
/// - `value`: 1023 bytes
///
/// Output:
/// - Returns "1023 B"
///
/// Details:
/// - Verifies that bytes less than 1024 are formatted in bytes without decimal places.
/// What: Test `format_bytes` with exactly 1 KiB.
///
/// Inputs:
/// - `value`: 1024 bytes
///
/// Output:
/// - Returns "1.0 KiB"
///
/// Details:
/// - Verifies that exactly 1024 bytes converts to 1.0 KiB with one decimal place.
/// What: Test `format_bytes` with values between KiB and MiB.
///
/// Inputs:
/// - `value`: 1536 bytes (1.5 KiB)
///
/// Output:
/// - Returns "1.5 KiB"
///
/// Details:
/// - Verifies that fractional KiB values are formatted with one decimal place.
/// What: Test `format_bytes` with exactly 1 MiB.
///
/// Inputs:
/// - `value`: 1048576 bytes (1024 * 1024)
///
/// Output:
/// - Returns "1.0 MiB"
///
/// Details:
/// - Verifies that exactly 1 MiB is formatted correctly.
/// What: Test `format_bytes` with values between MiB and GiB.
///
/// Inputs:
/// - `value`: 15728640 bytes (15 MiB)
///
/// Output:
/// - Returns "15.0 MiB"
///
/// Details:
/// - Verifies that MiB values are formatted with one decimal place.
/// What: Test `format_bytes` with exactly 1 GiB.
///
/// Inputs:
/// - `value`: 1073741824 bytes (1024 * 1024 * 1024)
///
/// Output:
/// - Returns "1.0 GiB"
///
/// Details:
/// - Verifies that exactly 1 GiB is formatted correctly.
/// What: Test `format_bytes` with large values (TiB).
///
/// Inputs:
/// - `value`: 1099511627776 bytes (1 TiB)
///
/// Output:
/// - Returns "1.0 TiB"
///
/// Details:
/// - Verifies that TiB values are formatted correctly.
/// What: Test `format_bytes` with very large values (PiB).
///
/// Inputs:
/// - `value`: 1125899906842624 bytes (1 PiB)
///
/// Output:
/// - Returns "1.0 PiB"
///
/// Details:
/// - Verifies that PiB values are formatted correctly.
/// What: Test `format_bytes` with fractional values.
///
/// Inputs:
/// - `value`: 2621440 bytes (2.5 MiB)
///
/// Output:
/// - Returns "2.5 MiB"
///
/// Details:
/// - Verifies that fractional values are rounded to one decimal place.
/// What: Test `format_signed_bytes` with zero.
///
/// Inputs:
/// - `value`: 0
///
/// Output:
/// - Returns "0 B"
///
/// Details:
/// - Verifies that zero is formatted without a sign prefix.
/// What: Test `format_signed_bytes` with positive value.
///
/// Inputs:
/// - `value`: 1024
///
/// Output:
/// - Returns "+1.0 KiB"
///
/// Details:
/// - Verifies that positive values get a "+" prefix.
/// What: Test `format_signed_bytes` with negative value.
///
/// Inputs:
/// - `value`: -1024
///
/// Output:
/// - Returns "-1.0 KiB"
///
/// Details:
/// - Verifies that negative values get a "-" prefix.
/// What: Test `format_signed_bytes` with large positive value.
///
/// Inputs:
/// - `value`: 1048576 (1 MiB)
///
/// Output:
/// - Returns "+1.0 MiB"
///
/// Details:
/// - Verifies that large positive values are formatted correctly with sign.
/// What: Test `format_signed_bytes` with large negative value.
///
/// Inputs:
/// - `value`: -1048576 (-1 MiB)
///
/// Output:
/// - Returns "-1.0 MiB"
///
/// Details:
/// - Verifies that large negative values are formatted correctly with sign.
/// What: Test `format_signed_bytes` with fractional positive value.
///
/// Inputs:
/// - `value`: 1536 (1.5 KiB)
///
/// Output:
/// - Returns "+1.5 KiB"
///
/// Details:
/// - Verifies that fractional positive values are formatted correctly.
/// What: Test `format_signed_bytes` with fractional negative value.
///
/// Inputs:
/// - `value`: -1536 (-1.5 KiB)
///
/// Output:
/// - Returns "-1.5 KiB"
///
/// Details:
/// - Verifies that fractional negative values are formatted correctly.