aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2014-11-06 05:16:44 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2014-11-06 05:16:44 +0800
commita1d62abca4b07f35f7f80702c9f58bb40e703504 (patch)
treecc98fb1c45568d20566296293383a69422e638a6
parentbe96da179a50735ef0ed72d66c5672d89c1a5b66 (diff)
downloadgo-tangerine-a1d62abca4b07f35f7f80702c9f58bb40e703504.tar.gz
go-tangerine-a1d62abca4b07f35f7f80702c9f58bb40e703504.tar.zst
go-tangerine-a1d62abca4b07f35f7f80702c9f58bb40e703504.zip
Restructure StorageSize string test
-rw-r--r--ethutil/size_test.go29
1 files changed, 24 insertions, 5 deletions
diff --git a/ethutil/size_test.go b/ethutil/size_test.go
index 82aa1c653..9127521cb 100644
--- a/ethutil/size_test.go
+++ b/ethutil/size_test.go
@@ -1,12 +1,31 @@
package ethutil
import (
- "fmt"
"testing"
)
-func TestSize(t *testing.T) {
- fmt.Println(StorageSize(2381273))
- fmt.Println(StorageSize(2192))
- fmt.Println(StorageSize(12))
+func TestStorageSizeString(t *testing.T) {
+ data1 := 2381273
+ data2 := 2192
+ data3 := 12
+
+ exp1 := "2.38 mB"
+ exp2 := "2.19 kB"
+ exp3 := "12.00 B"
+
+ res1 := StorageSize(data1).String()
+ res2 := StorageSize(data2).String()
+ res3 := StorageSize(data3).String()
+
+ if res1 != exp1 {
+ t.Errorf("Expected %s got %s", exp1, res1)
+ }
+
+ if res2 != exp2 {
+ t.Errorf("Expected %s got %s", exp2, res2)
+ }
+
+ if res3 != exp3 {
+ t.Errorf("Expected %s got %s", exp3, res3)
+ }
}