func TestPairDeserializeWrongSize3(t *testing.T) {
	var err error
	wrongSizeArray := [3]byte{0x00, 0x01, 0x02}
	sPair := new(Pair)
	if err = sPair.Deserialize(wrongSizeArray[:]); err == nil {
		t.Errorf("The deserialization for Pair should return an error with raw data with length not equal to 2")
		return
	}
	return
}
TestPairDeserializeWrongSize3 tests whether or not we get an error
when we input an array of size 3
package match
import (
	"crypto/rand"
	"testing"
)
var (
	emptyPair     = &Pair{}
	firstSidePair = &Pair{
		AssetWant: Asset(0x01),
	}
	secondSidePair = &Pair{
		AssetHave: Asset(0x01),
	}
	bothSidesPair = &Pair{
		AssetHave: Asset(0x01),
		AssetWant: Asset(0x01),
	}
	emptyExpectedBuf      = [2]byte{0x00, 0x00}
	firstSideExpectedBuf  = [2]byte{0x01, 0x00}
	secondSideExpectedBuf = [2]byte{0x00, 0x01}
	bothSidesExpectedBuf  = [2]byte{0x01, 0x01}
)
func TestPairEmptySerialize(t *testing.T) {
	serializedPair := emptyPair.Serialize()
	sPairLen := len(serializedPair)
	if sPairLen != 2 {
		t.Errorf("The length of the serialized pair is %d, it should be 2", len(serializedPair))
		return
	}
	sPairArray := [2]byte{serializedPair[0], serializedPair[1]}
	if sPairArray != emptyExpectedBuf {
		t.Errorf("The buffer %8x is not the same as the expected, %8x", sPairArray, emptyExpectedBuf)
		return
	}
	return
}
func TestPairFirstSideSerialize(t *testing.T) {
	serializedPair := firstSidePair.Serialize()
	sPairLen := len(serializedPair)
	if sPairLen != 2 {
		t.Errorf("The length of the serialized pair is %d, it should be 2", len(serializedPair))
		return
	}
	sPairArray := [2]byte{serializedPair[0], serializedPair[1]}
	if sPairArray != firstSideExpectedBuf {
		t.Errorf("The buffer %8x is not the same as the expected, %8x", sPairArray, firstSideExpectedBuf)
		return
	}
	return
}
func TestPairSecondSideSerialize(t *testing.T) {
	serializedPair := secondSidePair.Serialize()
	sPairLen := len(serializedPair)
	if sPairLen != 2 {
		t.Errorf("The length of the serialized pair is %d, it should be 2", len(serializedPair))
		return
	}
	sPairArray := [2]byte{serializedPair[0], serializedPair[1]}
	if sPairArray != secondSideExpectedBuf {
		t.Errorf("The buffer %8x is not the same as the expected, %8x", sPairArray, secondSideExpectedBuf)
		return
	}
	return
}
func TestPairBothSideSerialize(t *testing.T) {
	serializedPair := bothSidesPair.Serialize()
	sPairLen := len(serializedPair)
	if sPairLen != 2 {
		t.Errorf("The length of the serialized pair is %d, it should be 2", len(serializedPair))
		return
	}
	sPairArray := [2]byte{serializedPair[0], serializedPair[1]}
	if sPairArray != bothSidesExpectedBuf {
		t.Errorf("The buffer %8x is not the same as the expected, %8x", sPairArray, bothSidesExpectedBuf)
		return
	}
	return
}
func TestPairEmptyDeserialize(t *testing.T) {
	var err error
	sPair := new(Pair)
	if err = sPair.Deserialize(emptyExpectedBuf[:]); err != nil {
		t.Errorf("Error deserializing empty buffer %8x for pair", emptyExpectedBuf)
		return
	}
	if *sPair != *emptyPair {
		t.Errorf("The empty pair did not deserialize correctly")
		return
	}
	return
}
func TestPairFirstSideDeserialize(t *testing.T) {
	var err error
	sPair := new(Pair)
	if err = sPair.Deserialize(firstSideExpectedBuf[:]); err != nil {
		t.Errorf("Error deserializing first side buffer %8x for pair", firstSideExpectedBuf)
		return
	}
	if *sPair != *firstSidePair {
		t.Errorf("The first side pair did not deserialize correctly")
		return
	}
	return
}
func TestPairSecondSideDeserialize(t *testing.T) {
	var err error
	sPair := new(Pair)
	if err = sPair.Deserialize(secondSideExpectedBuf[:]); err != nil {
		t.Errorf("Error deserializing second side buffer %8x for pair", secondSideExpectedBuf)
		return
	}
	if *sPair != *secondSidePair {
		t.Errorf("The second side pair did not deserialize correctly")
		return
	}
	return
}
func TestPairBothSideDeserialize(t *testing.T) {
	var err error
	sPair := new(Pair)
	if err = sPair.Deserialize(bothSidesExpectedBuf[:]); err != nil {
		t.Errorf("Error deserializing both sides buffer %8x for pair", bothSidesExpectedBuf)
		return
	}
	if *sPair != *bothSidesPair {
		t.Errorf("The both sides pair did not deserialize correctly")
		return
	}
	return
}