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

Function TestS256

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

Source from the content-addressed store, hash-verified

272}
273
274func TestS256(t *testing.T) {
275 tests := []struct{ x, y *big.Int }{
276 {x: big.NewInt(0), y: big.NewInt(0)},
277 {x: big.NewInt(1), y: big.NewInt(1)},
278 {x: big.NewInt(2), y: big.NewInt(2)},
279 {
280 x: new(big.Int).Sub(BigPow(2, 255), big.NewInt(1)),
281 y: new(big.Int).Sub(BigPow(2, 255), big.NewInt(1)),
282 },
283 {
284 x: BigPow(2, 255),
285 y: new(big.Int).Neg(BigPow(2, 255)),
286 },
287 {
288 x: new(big.Int).Sub(BigPow(2, 256), big.NewInt(1)),
289 y: big.NewInt(-1),
290 },
291 {
292 x: new(big.Int).Sub(BigPow(2, 256), big.NewInt(2)),
293 y: big.NewInt(-2),
294 },
295 }
296 for _, test := range tests {
297 if y := S256(test.x); y.Cmp(test.y) != 0 {
298 t.Errorf("S256(%x) = %x, want %x", test.x, y, test.y)
299 }
300 }
301}
302
303func TestExp(t *testing.T) {
304 tests := []struct{ base, exponent, result *big.Int }{

Callers

nothing calls this directly

Calls 3

BigPowFunction · 0.85
ErrorfMethod · 0.80
S256Function · 0.70

Tested by

no test coverage detected