@@ -21,8 +21,6 @@ import (
21
21
"encoding/hex"
22
22
"math/big"
23
23
"testing"
24
-
25
- "github.com/ethereum/go-ethereum/common"
26
24
)
27
25
28
26
func TestHexOrDecimal256 (t * testing.T ) {
@@ -100,23 +98,6 @@ func TestBigMin(t *testing.T) {
100
98
}
101
99
}
102
100
103
- func TestFirstBigSet (t * testing.T ) {
104
- tests := []struct {
105
- num * big.Int
106
- ix int
107
- }{
108
- {big .NewInt (0 ), 0 },
109
- {big .NewInt (1 ), 0 },
110
- {big .NewInt (2 ), 1 },
111
- {big .NewInt (0x100 ), 8 },
112
- }
113
- for _ , test := range tests {
114
- if ix := FirstBitSet (test .num ); ix != test .ix {
115
- t .Errorf ("FirstBitSet(b%b) = %d, want %d" , test .num , ix , test .ix )
116
- }
117
- }
118
- }
119
-
120
101
func TestPaddedBigBytes (t * testing.T ) {
121
102
tests := []struct {
122
103
num * big.Int
@@ -220,60 +201,3 @@ func TestU256Bytes(t *testing.T) {
220
201
t .Errorf ("expected %x got %x" , ubytes , unsigned )
221
202
}
222
203
}
223
-
224
- func TestBigEndianByteAt (t * testing.T ) {
225
- tests := []struct {
226
- x string
227
- y int
228
- exp byte
229
- }{
230
- {"00" , 0 , 0x00 },
231
- {"01" , 1 , 0x00 },
232
- {"00" , 1 , 0x00 },
233
- {"01" , 0 , 0x01 },
234
- {"0000000000000000000000000000000000000000000000000000000000102030" , 0 , 0x30 },
235
- {"0000000000000000000000000000000000000000000000000000000000102030" , 1 , 0x20 },
236
- {"ABCDEF0908070605040302010000000000000000000000000000000000000000" , 31 , 0xAB },
237
- {"ABCDEF0908070605040302010000000000000000000000000000000000000000" , 32 , 0x00 },
238
- {"ABCDEF0908070605040302010000000000000000000000000000000000000000" , 500 , 0x00 },
239
- }
240
- for _ , test := range tests {
241
- v := new (big.Int ).SetBytes (common .Hex2Bytes (test .x ))
242
- actual := bigEndianByteAt (v , test .y )
243
- if actual != test .exp {
244
- t .Fatalf ("Expected [%v] %v:th byte to be %v, was %v." , test .x , test .y , test .exp , actual )
245
- }
246
- }
247
- }
248
- func TestLittleEndianByteAt (t * testing.T ) {
249
- tests := []struct {
250
- x string
251
- y int
252
- exp byte
253
- }{
254
- {"00" , 0 , 0x00 },
255
- {"01" , 1 , 0x00 },
256
- {"00" , 1 , 0x00 },
257
- {"01" , 0 , 0x00 },
258
- {"0000000000000000000000000000000000000000000000000000000000102030" , 0 , 0x00 },
259
- {"0000000000000000000000000000000000000000000000000000000000102030" , 1 , 0x00 },
260
- {"ABCDEF0908070605040302010000000000000000000000000000000000000000" , 31 , 0x00 },
261
- {"ABCDEF0908070605040302010000000000000000000000000000000000000000" , 32 , 0x00 },
262
- {"ABCDEF0908070605040302010000000000000000000000000000000000000000" , 0 , 0xAB },
263
- {"ABCDEF0908070605040302010000000000000000000000000000000000000000" , 1 , 0xCD },
264
- {"00CDEF090807060504030201ffffffffffffffffffffffffffffffffffffffff" , 0 , 0x00 },
265
- {"00CDEF090807060504030201ffffffffffffffffffffffffffffffffffffffff" , 1 , 0xCD },
266
- {"0000000000000000000000000000000000000000000000000000000000102030" , 31 , 0x30 },
267
- {"0000000000000000000000000000000000000000000000000000000000102030" , 30 , 0x20 },
268
- {"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" , 32 , 0x0 },
269
- {"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" , 31 , 0xFF },
270
- {"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" , 0xFFFF , 0x0 },
271
- }
272
- for _ , test := range tests {
273
- v := new (big.Int ).SetBytes (common .Hex2Bytes (test .x ))
274
- actual := Byte (v , 32 , test .y )
275
- if actual != test .exp {
276
- t .Fatalf ("Expected [%v] %v:th byte to be %v, was %v." , test .x , test .y , test .exp , actual )
277
- }
278
- }
279
- }
0 commit comments