MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / TestU256

Function TestU256

utils/big_test.go:194–211  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

192}
193
194func TestU256(t *testing.T) {
195 tests := []struct{ x, y *big.Int }{
196 {x: big.NewInt(0), y: big.NewInt(0)},
197 {x: big.NewInt(1), y: big.NewInt(1)},
198 {x: BigPow(2, 255), y: BigPow(2, 255)},
199 {x: BigPow(2, 256), y: big.NewInt(0)},
200 {x: new(big.Int).Add(BigPow(2, 256), big.NewInt(1)), y: big.NewInt(1)},
201 // negative values
202 {x: big.NewInt(-1), y: new(big.Int).Sub(BigPow(2, 256), big.NewInt(1))},
203 {x: big.NewInt(-2), y: new(big.Int).Sub(BigPow(2, 256), big.NewInt(2))},
204 {x: BigPow(2, -255), y: big.NewInt(1)},
205 }
206 for _, test := range tests {
207 if y := U256(new(big.Int).Set(test.x)); y.Cmp(test.y) != 0 {
208 t.Errorf("U256(%x) = %x, want %x", test.x, y, test.y)
209 }
210 }
211}
212
213func TestBigEndianByteAt(t *testing.T) {
214 tests := []struct {

Callers

nothing calls this directly

Calls 5

BigPowFunction · 0.85
U256Function · 0.85
ErrorfMethod · 0.80
AddMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected