github.com/consensys/gnark-crypto@v0.14.0/ecc/bn254/internal/fptower/e2_bn254_test.go (about)

     1  package fptower
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/leanovate/gopter"
     7  	"github.com/leanovate/gopter/prop"
     8  )
     9  
    10  func TestE2AssemblyOps(t *testing.T) {
    11  
    12  	parameters := gopter.DefaultTestParameters()
    13  	parameters.MinSuccessfulTests = 100
    14  
    15  	properties := gopter.NewProperties(parameters)
    16  
    17  	genA := GenE2()
    18  	genB := GenE2()
    19  
    20  	properties.Property("[BN254] mulAsm & mulGeneric should output same result", prop.ForAll(
    21  		func(a, b *E2) bool {
    22  			var c, d E2
    23  			c.Mul(a, b)
    24  			mulGenericE2(&d, a, b)
    25  			return c.Equal(&d)
    26  		},
    27  		genA,
    28  		genB,
    29  	))
    30  
    31  	properties.Property("[BN254] squareAsm & squareGeneric should output same result", prop.ForAll(
    32  		func(a *E2) bool {
    33  			var c, d E2
    34  			c.Square(a)
    35  			squareGenericE2(&d, a)
    36  			return c.Equal(&d)
    37  		},
    38  		genA,
    39  	))
    40  
    41  	properties.TestingRun(t, gopter.ConsoleReporter(false))
    42  }