Skip to content

Commit

Permalink
Move FromBytes/ToBytes test into ed25519_test.go.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
agl committed Aug 30, 2015
1 parent 446061e commit 278e1ec
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 58 deletions.
19 changes: 19 additions & 0 deletions ed25519_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ import (
"bufio"
"bytes"
"compress/gzip"
"crypto/rand"
"encoding/hex"
"io"
"os"
"strings"
"testing"

"github.com/agl/ed25519/edwards25519"
)

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

func TestUnmarshalMarshal(t *testing.T) {
pub, _, _ := GenerateKey(rand.Reader)

var A edwards25519.ExtendedGroupElement
if !A.FromBytes(pub) {
t.Fatalf("ExtendedGroupElement.FromBytes failed")
}

var pub2 [32]byte
A.ToBytes(&pub2)

if *pub != pub2 {
t.Errorf("FromBytes(%v)->ToBytes does not round-trip, got %x\n", *pub, pub2)
}
}

func TestSignVerify(t *testing.T) {
var zero zeroReader
public, private, _ := GenerateKey(zero)
Expand Down
58 changes: 0 additions & 58 deletions marshal_test.go

This file was deleted.

0 comments on commit 278e1ec

Please sign in to comment.