1 // Copyright 2014 The go-ethereum Authors
2 // This file is part of the go-ethereum library.
4 // The go-ethereum library is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Lesser General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
9 // The go-ethereum library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public License
15 // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
22 checker "gopkg.in/check.v1"
25 type SizeSuite struct{}
27 var _ = checker.Suite(&SizeSuite{})
29 func (s *SizeSuite) TestStorageSizeString(c *checker.C) {
38 c.Assert(StorageSize(data1).String(), checker.Equals, exp1)
39 c.Assert(StorageSize(data2).String(), checker.Equals, exp2)
40 c.Assert(StorageSize(data3).String(), checker.Equals, exp3)
43 func (s *SizeSuite) TestCommon(c *checker.C) {
44 ether := CurrencyToString(BigPow(10, 19))
45 finney := CurrencyToString(BigPow(10, 16))
46 szabo := CurrencyToString(BigPow(10, 13))
47 shannon := CurrencyToString(BigPow(10, 10))
48 babbage := CurrencyToString(BigPow(10, 7))
49 ada := CurrencyToString(BigPow(10, 4))
50 wei := CurrencyToString(big.NewInt(10))
52 c.Assert(ether, checker.Equals, "10 Ether")
53 c.Assert(finney, checker.Equals, "10 Finney")
54 c.Assert(szabo, checker.Equals, "10 Szabo")
55 c.Assert(shannon, checker.Equals, "10 Shannon")
56 c.Assert(babbage, checker.Equals, "10 Babbage")
57 c.Assert(ada, checker.Equals, "10 Ada")
58 c.Assert(wei, checker.Equals, "10 Wei")