func TestAuctionIDMarshalBinaryOnes(t *testing.T) {
	var err error
	onesID := new(AuctionID)
	*onesID = AuctionID([32]byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff})
	var binaryAnswer []byte
	if binaryAnswer, err = onesID.MarshalBinary(); err != nil {
		t.Errorf("Marshalling auction ID's should not return errors: %s", err)
		return
	}
	if len(binaryAnswer) != 32 {
		t.Errorf("AuctionID marshalling should return a byte slice of length 32, not %d", len(binaryAnswer))
		return
	}
	var ansArray [32]byte
	copy(ansArray[:], binaryAnswer)
	if ansArray != onesAuctionIDExpected {
		t.Errorf("Serialized auction ID\n was: %8x\nexpected: %8x\n", ansArray, onesAuctionIDExpected)
		return
	}
	return
}
TestAuctionIDMarshalBinaryOnes tests that a non empty auction ID
has the correct length and returns no errors when marshalled to
binary
package match
import (
	"crypto/rand"
	"fmt"
	"testing"
)
var (
	emptyAuctionIDExpected = [32]byte{}
	onesAuctionIDExpected  = [32]byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}
)
func TestAuctionIDMarshalBinaryEmpty(t *testing.T) {
	var err error
	emptyID := new(AuctionID)
	*emptyID = AuctionID([32]byte{})
	var binaryAnswer []byte
	if binaryAnswer, err = emptyID.MarshalBinary(); err != nil {
		t.Errorf("Marshalling auction ID's should not return errors: %s", err)
		return
	}
	if len(binaryAnswer) != 32 {
		t.Errorf("AuctionID marshalling should return a byte slice of length 32, not %d", len(binaryAnswer))
		return
	}
	var ansArray [32]byte
	copy(ansArray[:], binaryAnswer)
	if ansArray != emptyAuctionIDExpected {
		t.Errorf("Serialized auction ID\n was: %8x\nexpected: %8x\n", ansArray, emptyAuctionIDExpected)
		return
	}
	return
}