(t *testing.T)
| 211 | } |
| 212 | |
| 213 | func TestBigEndianByteAt(t *testing.T) { |
| 214 | tests := []struct { |
| 215 | x string |
| 216 | y int |
| 217 | exp byte |
| 218 | }{ |
| 219 | {"00", 0, 0x00}, |
| 220 | {"01", 1, 0x00}, |
| 221 | {"00", 1, 0x00}, |
| 222 | {"01", 0, 0x01}, |
| 223 | {"0000000000000000000000000000000000000000000000000000000000102030", 0, 0x30}, |
| 224 | {"0000000000000000000000000000000000000000000000000000000000102030", 1, 0x20}, |
| 225 | {"ABCDEF0908070605040302010000000000000000000000000000000000000000", 31, 0xAB}, |
| 226 | {"ABCDEF0908070605040302010000000000000000000000000000000000000000", 32, 0x00}, |
| 227 | {"ABCDEF0908070605040302010000000000000000000000000000000000000000", 500, 0x00}, |
| 228 | } |
| 229 | for _, test := range tests { |
| 230 | b, _ := hex.DecodeString(test.x) |
| 231 | v := new(big.Int).SetBytes(b) |
| 232 | actual := bigEndianByteAt(v, test.y) |
| 233 | if actual != test.exp { |
| 234 | t.Fatalf("expected [%v] %v:th byte to be %v, was %v.", test.x, test.y, test.exp, actual) |
| 235 | } |
| 236 | |
| 237 | } |
| 238 | } |
| 239 | func TestLittleEndianByteAt(t *testing.T) { |
| 240 | tests := []struct { |
| 241 | x string |
nothing calls this directly
no test coverage detected