fixed8: fix Satoshi() and add a test for it
This commit is contained in:
parent
20a4ad99b3
commit
b0af8b306d
2 changed files with 6 additions and 1 deletions
|
@ -116,7 +116,7 @@ func (f Fixed8) MarshalJSON() ([]byte, error) {
|
||||||
|
|
||||||
// Satoshi defines the value of a 'Satoshi'.
|
// Satoshi defines the value of a 'Satoshi'.
|
||||||
func Satoshi() Fixed8 {
|
func Satoshi() Fixed8 {
|
||||||
return NewFixed8(1)
|
return Fixed8(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Div implements Fixd8 division operator.
|
// Div implements Fixd8 division operator.
|
||||||
|
|
|
@ -66,6 +66,11 @@ func TestFixed8DecodeString(t *testing.T) {
|
||||||
assert.Equal(t, Fixed8(90123410000), n)
|
assert.Equal(t, Fixed8(90123410000), n)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestSatoshi(t *testing.T) {
|
||||||
|
satoshif8 := Satoshi()
|
||||||
|
assert.Equal(t, "0.00000001", satoshif8.String())
|
||||||
|
}
|
||||||
|
|
||||||
func TestFixed8UnmarshalJSON(t *testing.T) {
|
func TestFixed8UnmarshalJSON(t *testing.T) {
|
||||||
var testCases = []float64{
|
var testCases = []float64{
|
||||||
123.45,
|
123.45,
|
||||||
|
|
Loading…
Reference in a new issue