Skip to content

Commit f52c9be

Browse files
committed
test for InvModOrder
Signed-off-by: Angelo De Caro <adc@zurich.ibm.com>
1 parent 2bc955c commit f52c9be

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

math_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,18 @@ func runGtTest(t *testing.T, c *Curve) {
425425
assert.True(t, gengt.Equals(c.GenGt))
426426
}
427427

428+
func runInvModOrderTest(t *testing.T, c *Curve) {
429+
rng, err := c.Rand()
430+
assert.NoError(t, err)
431+
r := c.NewRandomZr(rng)
432+
r1 := c.NewZrFromUint64(0)
433+
r1.Clone(r)
434+
435+
r.InvModP(c.GroupOrder)
436+
r1.InvModOrder()
437+
assert.True(t, r.Equals(r1))
438+
}
439+
428440
func runRndTest(t *testing.T, c *Curve) {
429441
rng, err := c.Rand()
430442
assert.NoError(t, err)
@@ -774,6 +786,7 @@ func TestCurves(t *testing.T) {
774786
runPairingTest(t, curve)
775787
runGtTest(t, curve)
776788
runRndTest(t, curve)
789+
runInvModOrderTest(t, curve)
777790
runHashTest(t, curve)
778791
runToFroBytesTest(t, curve)
779792
runToFroCompressedTest(t, curve)

0 commit comments

Comments
 (0)