func TestAuctionIDUnmarshalBinaryShort(t *testing.T) {
	var err error
	shortBytes := []byte{0xde, 0xad, 0xde, 0xad, 0xbe, 0xef, 0xbe, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}
	ansPtr := new(AuctionID)
	if err = ansPtr.UnmarshalBinary(shortBytes); err == nil {
		t.Errorf("Unmarshalling a short byte array should return an error, instead the error was nil")
		return
	}
	return
}
TestAuctionIDUnmarshalBinaryShort tests unmarshalling of a short
AuctionID from binary, checking that an error is actually returned
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
}
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
}
func TestAuctionIDUnmarshalBinaryValid(t *testing.T) {
	var err error
	onesAuctionID := 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})
	onesBytes := []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}
	ansPtr := new(AuctionID)
	if err = ansPtr.UnmarshalBinary(onesBytes); err != nil {
		t.Errorf("Unmarshalling valid byte array for auctionid should not return an error: %s", err)
		return
	}
	if *ansPtr != onesAuctionID {
		t.Errorf("The AuctionID after unmarshalling %v did not equal the expected value of %v", *ansPtr, onesAuctionID)
		return
	}
	return
}