X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/7d4123813b42d8f6478e239895e62f6f600a1c6f..080c940d7a8134a6e277a53b7e45eb27e2b2c87f:/sdk/go/arvados/byte_size_test.go diff --git a/sdk/go/arvados/byte_size_test.go b/sdk/go/arvados/byte_size_test.go index 857ec7b00e..7c4aff2072 100644 --- a/sdk/go/arvados/byte_size_test.go +++ b/sdk/go/arvados/byte_size_test.go @@ -40,20 +40,31 @@ func (s *ByteSizeSuite) TestUnmarshal(c *check.C) { {"4PiB", 4503599627370496}, {"4EB", 4000000000000000000}, {"4EiB", 4611686018427387904}, + {"4.5EiB", 5188146770730811392}, + {"1.5 GB", 1500000000}, + {"1.5 GiB", 1610612736}, + {"1.234 GiB", 1324997410}, // rounds down from 1324997410.816 + {"1e2 KB", 100000}, + {"20E-1 KiB", 2048}, + {"1E0EB", 1000000000000000000}, + {"1E-1EB", 100000000000000000}, + {"1E-1EiB", 115292150460684704}, + {"4.5E15 K", 4500000000000000000}, } { var n ByteSize err := yaml.Unmarshal([]byte(testcase.in+"\n"), &n) + c.Logf("%v => %v: %v", testcase.in, testcase.out, n) c.Check(err, check.IsNil) c.Check(int64(n), check.Equals, testcase.out) } for _, testcase := range []string{ "B", "K", "KB", "KiB", "4BK", "4iB", "4A", "b", "4b", "4mB", "4m", "4mib", "4KIB", "4K iB", "4Ki B", "BB", "4BB", "400000 EB", // overflows int64 + "4.11e4 EB", // ok as float64, but overflows int64 } { var n ByteSize err := yaml.Unmarshal([]byte(testcase+"\n"), &n) - c.Log(n) - c.Log(err) + c.Logf("%v => error: %v", n, err) c.Check(err, check.NotNil) } }