Skip to content

Commit

Permalink
tests for big
Browse files Browse the repository at this point in the history
  • Loading branch information
borispovod committed Apr 30, 2020
1 parent ca5cc24 commit 1135a00
Show file tree
Hide file tree
Showing 4 changed files with 661 additions and 623 deletions.
38 changes: 38 additions & 0 deletions big_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package lcs

import (
"math/big"
"testing"

"github.com/stretchr/testify/require"
)

func TestBigNumbers(t *testing.T) {
type MyStruct struct {
A *big.Int
B *big.Int
}

a := &MyStruct{
A: big.NewInt(10),
B: big.NewInt(100500),
}

bytes, err := Marshal(a)

if err != nil {
t.Fatal(err)
}

b := &MyStruct{}
err = Unmarshal(bytes, &b)
if err != nil {
t.Fatal(err)
}

t.Logf("Print: %d %d", a.A, b.A)

require.True(t, a.A.String() == b.A.String())
require.True(t, a.B.String() == b.B.String())
require.Equal(t, a, b)
}
Loading

0 comments on commit 1135a00

Please sign in to comment.