Skip to content

Commit

Permalink
TestBigAdd
Browse files Browse the repository at this point in the history
  • Loading branch information
david-julien committed Jul 13, 2017
1 parent 997158a commit 4b6db99
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions common/math/big_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,40 @@ func TestBigSub(t *testing.T) {
t.Fail()
}
}

func TestBigAdd(t *testing.T) {
a := big.NewInt(0)
b := BigAdd(big.NewInt(0), big.NewInt(0))

if a.Cmp(b) != 0 {
t.Fail()
}

a = big.NewInt(1)
b = BigAdd(big.NewInt(1), big.NewInt(0))

if a.Cmp(b) != 0 {
t.Fail()
}

a = big.NewInt(1)
b = BigAdd(big.NewInt(0), big.NewInt(1))

if a.Cmp(b) != 0 {
t.Fail()
}

a = big.NewInt(12)
b = BigAdd(big.NewInt(7), big.NewInt(5))

if a.Cmp(b) != 0 {
t.Fail()
}

a = big.NewInt(6)
b = BigAdd(big.NewInt(4), big.NewInt(2))

if a.Cmp(b) != 0 {
t.Fail()
}
}

0 comments on commit 4b6db99

Please sign in to comment.