aboutsummaryrefslogtreecommitdiffstats
path: root/ethutil/size_test.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-12-20 09:34:12 +0800
committerobscuren <geffobscura@gmail.com>2014-12-20 09:34:12 +0800
commit3983dd2428137211f84f299f9ce8690c22f50afd (patch)
tree3a2dc53b365e6f377fc82a3514150d1297fe549c /ethutil/size_test.go
parent7daa8c2f6eb25511c6a54ad420709af911fc6748 (diff)
parent0a9dc1536c5d776844d6947a0090ff7e1a7c6ab4 (diff)
downloadgo-tangerine-vv0.7.10.tar.gz
go-tangerine-vv0.7.10.tar.zst
go-tangerine-vv0.7.10.zip
Merge branch 'release/v0.7.10'vv0.7.10
Diffstat (limited to 'ethutil/size_test.go')
-rw-r--r--ethutil/size_test.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/ethutil/size_test.go b/ethutil/size_test.go
new file mode 100644
index 000000000..e0f28abc5
--- /dev/null
+++ b/ethutil/size_test.go
@@ -0,0 +1,23 @@
+package ethutil
+
+import (
+ checker "gopkg.in/check.v1"
+)
+
+type SizeSuite struct{}
+
+var _ = checker.Suite(&SizeSuite{})
+
+func (s *SizeSuite) TestStorageSizeString(c *checker.C) {
+ data1 := 2381273
+ data2 := 2192
+ data3 := 12
+
+ exp1 := "2.38 mB"
+ exp2 := "2.19 kB"
+ exp3 := "12.00 B"
+
+ c.Assert(StorageSize(data1).String(), checker.Equals, exp1)
+ c.Assert(StorageSize(data2).String(), checker.Equals, exp2)
+ c.Assert(StorageSize(data3).String(), checker.Equals, exp3)
+}