From 78186b90c0c631622507124c12929b3c1c135a36 Mon Sep 17 00:00:00 2001 From: Casey Marshall Date: Mon, 23 Mar 2015 17:14:19 -0500 Subject: [PATCH] Add Equals test. --- decimal_test.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/decimal_test.go b/decimal_test.go index f073031..a34c7db 100644 --- a/decimal_test.go +++ b/decimal_test.go @@ -477,6 +477,23 @@ func TestDecimal_Abs2(t *testing.T) { } } +func TestDecimal_Equal(t *testing.T) { + a := New(1234, 3) + b := New(1234, 3) + + if !a.Equals(b) { + t.Errorf("Error") + } +} + +func TestDecimal_ScalesNotEqual(t *testing.T) { + a := New(1234, 2) + b := New(1234, 3) + if a.Equals(b) { + t.Errorf("Error") + } +} + func TestDecimal_Cmp1(t *testing.T) { a := New(123, 3) b := New(-1234, 2)