Skip to content

Commit 278e1ec

Browse files
committed
Move FromBytes/ToBytes test into ed25519_test.go.
The two other tests weren't actually testing anything more than this one and, with them gone, we didn't need a separate file for single remaining test.
1 parent 446061e commit 278e1ec

File tree

2 files changed

+19
-58
lines changed

2 files changed

+19
-58
lines changed

ed25519_test.go

+19
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,14 @@ import (
88
"bufio"
99
"bytes"
1010
"compress/gzip"
11+
"crypto/rand"
1112
"encoding/hex"
1213
"io"
1314
"os"
1415
"strings"
1516
"testing"
17+
18+
"github.com/agl/ed25519/edwards25519"
1619
)
1720

1821
type zeroReader struct{}
@@ -24,6 +27,22 @@ func (zeroReader) Read(buf []byte) (int, error) {
2427
return len(buf), nil
2528
}
2629

30+
func TestUnmarshalMarshal(t *testing.T) {
31+
pub, _, _ := GenerateKey(rand.Reader)
32+
33+
var A edwards25519.ExtendedGroupElement
34+
if !A.FromBytes(pub) {
35+
t.Fatalf("ExtendedGroupElement.FromBytes failed")
36+
}
37+
38+
var pub2 [32]byte
39+
A.ToBytes(&pub2)
40+
41+
if *pub != pub2 {
42+
t.Errorf("FromBytes(%v)->ToBytes does not round-trip, got %x\n", *pub, pub2)
43+
}
44+
}
45+
2746
func TestSignVerify(t *testing.T) {
2847
var zero zeroReader
2948
public, private, _ := GenerateKey(zero)

marshal_test.go

-58
This file was deleted.

0 commit comments

Comments
 (0)