Change shorthands

This commit is contained in:
Maran 2014-05-20 14:53:34 +02:00
parent f5d4414734
commit 31e44c2ab9
2 changed files with 16 additions and 16 deletions

View File

@ -10,9 +10,9 @@ var (
Ether = BigPow(10, 18)
Finney = BigPow(10, 15)
Szabo = BigPow(10, 12)
Vita = BigPow(10, 9)
Turing = BigPow(10, 6)
Eins = BigPow(10, 3)
Shannon = BigPow(10, 9)
Babbage = BigPow(10, 6)
Ada = BigPow(10, 3)
Wei = big.NewInt(1)
)
@ -27,12 +27,12 @@ func CurrencyToString(num *big.Int) string {
return fmt.Sprintf("%v Finney", new(big.Int).Div(num, Finney))
case num.Cmp(Szabo) >= 0:
return fmt.Sprintf("%v Szabo", new(big.Int).Div(num, Szabo))
case num.Cmp(Vita) >= 0:
return fmt.Sprintf("%v Vita", new(big.Int).Div(num, Vita))
case num.Cmp(Turing) >= 0:
return fmt.Sprintf("%v Turing", new(big.Int).Div(num, Turing))
case num.Cmp(Eins) >= 0:
return fmt.Sprintf("%v Eins", new(big.Int).Div(num, Eins))
case num.Cmp(Shannon) >= 0:
return fmt.Sprintf("%v Shannon", new(big.Int).Div(num, Shannon))
case num.Cmp(Babbage) >= 0:
return fmt.Sprintf("%v Babbage", new(big.Int).Div(num, Babbage))
case num.Cmp(Ada) >= 0:
return fmt.Sprintf("%v Ada", new(big.Int).Div(num, Ada))
}
return fmt.Sprintf("%v Wei", num)

View File

@ -26,15 +26,15 @@ func TestCommon(t *testing.T) {
t.Error("Got", szabo)
}
if vito != "10 Vita" {
if vito != "10 Shannon" {
t.Error("Got", vito)
}
if turing != "10 Turing" {
if turing != "10 Babbage" {
t.Error("Got", turing)
}
if eins != "10 Eins" {
if eins != "10 Ada" {
t.Error("Got", eins)
}