Skip to content

Commit 5a940a1

Browse files
committed
goldilocks: Test for IsEqual must fail with Z=0
1 parent 48c3b6a commit 5a940a1

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

ecc/goldilocks/point_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,19 @@ func randomPoint() *goldilocks.Point {
1515
return goldilocks.Curve{}.ScalarBaseMult(&k)
1616
}
1717

18+
func TestPoint(t *testing.T) {
19+
c := goldilocks.Curve{}
20+
t.Run("IsOnCurve(ok)", func(t *testing.T) {
21+
goodGen := c.Generator()
22+
test.CheckOk(c.IsOnCurve(goodGen), "valid point should pass", t)
23+
})
24+
25+
t.Run("IsOnCurve(zero)", func(t *testing.T) {
26+
var allZeros goldilocks.Point
27+
test.CheckOk(!c.IsOnCurve(&allZeros), "invalid point should be detected", t)
28+
})
29+
}
30+
1831
func TestPointAdd(t *testing.T) {
1932
const testTimes = 1 << 10
2033
var e goldilocks.Curve

0 commit comments

Comments
 (0)