From b0af8b306d74972702f6948bcabf25bb1c2f8120 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Fri, 23 Aug 2019 15:37:01 +0300 Subject: [PATCH] fixed8: fix Satoshi() and add a test for it --- pkg/util/fixed8.go | 2 +- pkg/util/fixed8_test.go | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/util/fixed8.go b/pkg/util/fixed8.go index 80216edef..21317a2aa 100644 --- a/pkg/util/fixed8.go +++ b/pkg/util/fixed8.go @@ -116,7 +116,7 @@ func (f Fixed8) MarshalJSON() ([]byte, error) { // Satoshi defines the value of a 'Satoshi'. func Satoshi() Fixed8 { - return NewFixed8(1) + return Fixed8(1) } // Div implements Fixd8 division operator. diff --git a/pkg/util/fixed8_test.go b/pkg/util/fixed8_test.go index 7bb4aa9d0..352b75250 100644 --- a/pkg/util/fixed8_test.go +++ b/pkg/util/fixed8_test.go @@ -66,6 +66,11 @@ func TestFixed8DecodeString(t *testing.T) { 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) { var testCases = []float64{ 123.45,