forked from linhbkhn95/int256
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathint_64_test.go
48 lines (45 loc) · 1.09 KB
/
int_64_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package int256
import (
"testing"
"github.com/holiman/uint256"
)
func TestInt_Int64(t *testing.T) {
type fields struct {
abs *uint256.Int
neg bool
}
tests := []struct {
name string
fields fields
want int64
}{
// TODO: Add test cases.
{
name: "Should return correct value when parsing positive number",
fields: fields{
abs: uint256.NewInt(10),
neg: false,
},
want: 10,
},
{
name: "Should return correct value when parsing negative number",
fields: fields{
abs: uint256.NewInt(10),
neg: true,
},
want: -10,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
z := &Int{
abs: tt.fields.abs,
neg: tt.fields.neg,
}
if got := z.Int64(); got != tt.want {
t.Errorf("Int.Int64() = %v, want %v", got, tt.want)
}
})
}
}