(t *testing.T)
| 116 | } |
| 117 | |
| 118 | func TestPaddedBigBytes(t *testing.T) { |
| 119 | tests := []struct { |
| 120 | num *big.Int |
| 121 | n int |
| 122 | result []byte |
| 123 | }{ |
| 124 | {num: big.NewInt(0), n: 4, result: []byte{0, 0, 0, 0}}, |
| 125 | {num: big.NewInt(1), n: 4, result: []byte{0, 0, 0, 1}}, |
| 126 | {num: big.NewInt(512), n: 4, result: []byte{0, 0, 2, 0}}, |
| 127 | {num: BigPow(2, 32), n: 4, result: []byte{1, 0, 0, 0, 0}}, |
| 128 | } |
| 129 | for _, test := range tests { |
| 130 | if result := PaddedBigBytes(test.num, test.n); !bytes.Equal(result, test.result) { |
| 131 | t.Errorf("PaddedBigBytes(%d, %d) = %v, want %v", test.num, test.n, result, test.result) |
| 132 | } |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | func BenchmarkPaddedBigBytesLargePadding(b *testing.B) { |
| 137 | bigint := MustParseBig256("123456789123456789123456789123456789") |
nothing calls this directly
no test coverage detected