6
6
)
7
7
8
8
func TestQuotient (t * testing.T ) {
9
- var tests = []struct {
9
+ tests : = []struct {
10
10
Input [2 ]int64
11
11
Output int64
12
12
}{
@@ -23,7 +23,7 @@ func TestQuotient(t *testing.T) {
23
23
}
24
24
25
25
func TestRemainder (t * testing.T ) {
26
- var tests = []struct {
26
+ tests : = []struct {
27
27
Input [2 ]int64
28
28
Output [2 ]int64
29
29
}{
@@ -41,7 +41,7 @@ func TestRemainder(t *testing.T) {
41
41
}
42
42
43
43
func TestInvert (t * testing.T ) {
44
- var tests = []struct {
44
+ tests : = []struct {
45
45
Input [2 ]int64
46
46
Output [2 ]int64
47
47
}{
@@ -56,7 +56,7 @@ func TestInvert(t *testing.T) {
56
56
}
57
57
58
58
func TestAdd (t * testing.T ) {
59
- var tests = []struct {
59
+ tests : = []struct {
60
60
Input [4 ]int64
61
61
Output [2 ]int64
62
62
}{
@@ -75,7 +75,7 @@ func TestAdd(t *testing.T) {
75
75
}
76
76
77
77
func TestSubtract (t * testing.T ) {
78
- var tests = []struct {
78
+ tests : = []struct {
79
79
Input [4 ]int64
80
80
Output [2 ]int64
81
81
}{
@@ -94,7 +94,7 @@ func TestSubtract(t *testing.T) {
94
94
}
95
95
96
96
func TestLessThan (t * testing.T ) {
97
- var tests = []struct {
97
+ tests : = []struct {
98
98
Input [4 ]int64
99
99
Output bool
100
100
}{
@@ -112,7 +112,7 @@ func TestLessThan(t *testing.T) {
112
112
}
113
113
114
114
func TestEqualTo (t * testing.T ) {
115
- var tests = []struct {
115
+ tests : = []struct {
116
116
Input [4 ]int64
117
117
Output bool
118
118
}{
@@ -131,7 +131,7 @@ func TestEqualTo(t *testing.T) {
131
131
}
132
132
133
133
func TestGreaterThan (t * testing.T ) {
134
- var tests = []struct {
134
+ tests : = []struct {
135
135
Input [4 ]int64
136
136
Output bool
137
137
}{
@@ -151,7 +151,7 @@ func TestGreaterThan(t *testing.T) {
151
151
}
152
152
153
153
func TestMultiply (t * testing.T ) {
154
- var tests = []struct {
154
+ tests : = []struct {
155
155
Input [4 ]int64
156
156
Output [2 ]int64
157
157
}{
@@ -171,7 +171,7 @@ func TestMultiply(t *testing.T) {
171
171
}
172
172
173
173
func TestDivide (t * testing.T ) {
174
- var tests = []struct {
174
+ tests : = []struct {
175
175
Input [4 ]int64
176
176
Output [2 ]int64
177
177
}{
@@ -192,7 +192,7 @@ func TestDivide(t *testing.T) {
192
192
}
193
193
194
194
func TestToSignificant (t * testing.T ) {
195
- var tests = []struct {
195
+ tests : = []struct {
196
196
Input [2 ]int64
197
197
Output string
198
198
Format uint
@@ -203,6 +203,7 @@ func TestToSignificant(t *testing.T) {
203
203
{[2 ]int64 {126 , 100 }, "1.26" , 2 },
204
204
{[2 ]int64 {124 , 100 }, "1.2" , 1 },
205
205
{[2 ]int64 {124 , 100 }, "1.24" , 2 },
206
+ {[2 ]int64 {125 , 1000000000 }, "0.00000013" , 2 },
206
207
}
207
208
for i , test := range tests {
208
209
output := NewFraction (big .NewInt (test .Input [0 ]), big .NewInt (test .Input [1 ])).ToSignificant (test .Format )
0 commit comments