From 4e51bef1ad7d185363d479de0a80658726aec56c Mon Sep 17 00:00:00 2001 From: Henry de Valence Date: Fri, 19 Apr 2019 13:22:02 -0700 Subject: [PATCH] Add test that the computed value encodes correctly --- ristretto255_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ristretto255_test.go b/ristretto255_test.go index 60a0a7d..17e55b4 100644 --- a/ristretto255_test.go +++ b/ristretto255_test.go @@ -153,6 +153,11 @@ func TestRistrettoSmallMultiplesTestVectors(t *testing.T) { if basepointMultiple.Equal(&decodedPoint) != 1 { t.Errorf("decoded small multiple %d * B is not %d * B", i, i) } + computedEncoding := basepointMultiple.Encode(nil) + if !bytes.Equal(encoding, computedEncoding) { + t.Errorf("#%d: encoding computed value did not match", i) + } + // Ensure basepointMultiple = i * B in the next iteration basepointMultiple.Add(&basepointMultiple, &ristrettoBasepoint) }