MCPcopy
hub / github.com/git-lfs/git-lfs / TestFormatBytesUnit

Function TestFormatBytesUnit

tools/humanize/humanize_test.go:224–247  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

222}
223
224func TestFormatBytesUnit(t *testing.T) {
225 for desc, c := range map[string]*FormatBytesUnitTestCase{
226 "format bytes": {uint64(1 * math.Pow(10, 0)), humanize.Byte, "1"},
227 "format kilobytes": {uint64(1 * math.Pow(10, 3)), humanize.Byte, "1000"},
228 "format megabytes": {uint64(1 * math.Pow(10, 6)), humanize.Byte, "1000000"},
229 "format gigabytes": {uint64(1 * math.Pow(10, 9)), humanize.Byte, "1000000000"},
230 "format petabytes": {uint64(1 * math.Pow(10, 12)), humanize.Byte, "1000000000000"},
231 "format terabytes": {uint64(1 * math.Pow(10, 15)), humanize.Byte, "1000000000000000"},
232
233 "format kilobytes under": {uint64(1.49 * math.Pow(10, 3)), humanize.Byte, "1490"},
234 "format megabytes under": {uint64(1.49 * math.Pow(10, 6)), humanize.Byte, "1490000"},
235 "format gigabytes under": {uint64(1.49 * math.Pow(10, 9)), humanize.Byte, "1490000000"},
236 "format petabytes under": {uint64(1.49 * math.Pow(10, 12)), humanize.Byte, "1490000000000"},
237 "format terabytes under": {uint64(1.49 * math.Pow(10, 15)), humanize.Byte, "1490000000000000"},
238
239 "format kilobytes over": {uint64(1.51 * math.Pow(10, 3)), humanize.Byte, "1510"},
240 "format megabytes over": {uint64(1.51 * math.Pow(10, 6)), humanize.Byte, "1510000"},
241 "format gigabytes over": {uint64(1.51 * math.Pow(10, 9)), humanize.Byte, "1510000000"},
242 "format petabytes over": {uint64(1.51 * math.Pow(10, 12)), humanize.Byte, "1510000000000"},
243 "format terabytes over": {uint64(1.51 * math.Pow(10, 15)), humanize.Byte, "1510000000000000"},
244 } {
245 t.Run(desc, c.Assert)
246 }
247}
248
249func TestFormateByteRate(t *testing.T) {
250 for desc, c := range map[string]*FormatByteRateTestCase{

Callers

nothing calls this directly

Calls 1

RunMethod · 0.65

Tested by

no test coverage detected