INNER CODE UNIT · Go
TestDirtyUnmarshal
cloudflare/bn256 · bn256_test.go:202
func TestDirtyUnmarshal(t *testing.T) {
_, Ga, err := RandomG2(rand.Reader)
if err != nil {
t.Fatal(err)
}
ma := Ga.Marshal()
if _, err := Ga.Unmarshal(ma); err != nil {
t.Fatal(err)
}
}
// TestPairNegativeG2 tests that e(g1, -g2) + e(-g1, g2) = O.
// It is based on py_ecc:
// https://github.com/ethereum/py_ecc/blob/v8.0.0/tests/core/test_bn128_and_bls12_381.py#L296
func TestPairNegativeG2(t *testing.T) {
g1Inf := new(G1).ScalarBaseMult(Order)
g2Inf := new(G2).ScalarBaseMult(Order)