You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

24 lines
559 B

package bn128
import (
"math/big"
"testing"
"github.com/stretchr/testify/assert"
)
func TestG2(t *testing.T) {
bn128, err := NewBn128()
assert.Nil(t, err)
r1 := big.NewInt(int64(33))
r2 := big.NewInt(int64(44))
gr1 := bn128.G2.Affine(bn128.G2.MulScalar(bn128.G2.G, r1))
gr2 := bn128.G2.Affine(bn128.G2.MulScalar(bn128.G2.G, r2))
grsum1 := bn128.G2.Affine(bn128.G2.Add(gr1, gr2))
r1r2 := bn128.Fq1.Affine(bn128.Fq1.Add(r1, r2))
grsum2 := bn128.G2.Affine(bn128.G2.MulScalar(bn128.G2.G, r1r2))
assert.True(t, bn128.G2.Equal(grsum1, grsum2))
}