func TestPriceCompareInverse(t *testing.T) {
	normalPrice := &Price{
		AmountWant: uint64(505763),
		AmountHave: uint64(37049),
	}
	inversePrice := &Price{
		AmountWant: uint64(37049),
		AmountHave: uint64(505763),
	}
	if leftSide := normalPrice.Cmp(inversePrice); leftSide != 1 {
		t.Errorf("A price that is greater than 1 should not be less than or equal to its inverse")
		return
	}
	if rightSide := inversePrice.Cmp(normalPrice); rightSide != -1 {
		t.Errorf("The inverse of a price greater than 1 should not be greater than or equal to the original price")
		return
	}
	return
}
TestPriceCompareInverse tests two prices, one is the inverse of the
other
package match
import (
	"testing"
)
func TestPriceDivideByZeroError(t *testing.T) {
	var err error
	divZeroPrice := &Price{
		AmountWant: uint64(12345),
		AmountHave: 0,
	}
	if _, err = divZeroPrice.ToFloat(); err == nil {
		t.Errorf("Should have an error when dividing by zero, AmountHave should not be zero")
		return
	}
	return
}
func TestPriceDivideByZeroValue(t *testing.T) {
	var retPrice float64
	divZeroPrice := &Price{
		AmountWant: uint64(12345),
		AmountHave: 0,
	}
	retPrice, _ = divZeroPrice.ToFloat()
	if retPrice != float64(0) {
		t.Errorf("The price returned by ToFloat should be zero when AmountHave is zero, and there should be an error")
		return
	}
	return
}
func TestPriceZeroZeroError(t *testing.T) {
	var err error
	divZeroPrice := &Price{
		AmountWant: 0,
		AmountHave: 0,
	}
	if _, err = divZeroPrice.ToFloat(); err == nil {
		t.Errorf("Should have an error when dividing zero by zero, AmountHave should not be zero")
		return
	}
	return
}
func TestPriceZeroZeroValue(t *testing.T) {
	var retPrice float64
	divZeroPrice := &Price{
		AmountWant: 0,
		AmountHave: 0,
	}
	retPrice, _ = divZeroPrice.ToFloat()
	if retPrice != float64(0) {
		t.Errorf("The price returned by ToFloat should be zero when both fields are zero, and there should be an error")
		return
	}
	return
}
func TestPriceCompareInfZero(t *testing.T) {
	infPrice := &Price{
		AmountWant: uint64(1),
		AmountHave: 0,
	}
	zeroPrice := &Price{
		AmountWant: 0,
		AmountHave: uint64(1),
	}
	if leftSide := infPrice.Cmp(zeroPrice); leftSide != 1 {
		t.Errorf("Error, infinite price when compared to zero should be greater")
		return
	}
	if rightSide := zeroPrice.Cmp(infPrice); rightSide != -1 {
		t.Errorf("Error, zero price when compared to infinite should be greater")
		return
	}
	return
}
func TestPriceCompareInfReflexive(t *testing.T) {
	infPrice := &Price{
		AmountHave: uint64(1),
		AmountWant: 0,
	}
	secondInfPrice := &Price{
		AmountHave: uint64(2),
		AmountWant: 0,
	}
	if leftSide := infPrice.Cmp(secondInfPrice); leftSide != 0 {
		t.Errorf("Error, two infinite prices should be equal, even if right side is initialized with a greater AmountHave")
		return
	}
	if rightSide := secondInfPrice.Cmp(infPrice); rightSide != 0 {
		t.Errorf("Error, two infinite prices should be equal, even if left side is initialized with a greater AmountHave")
		return
	}
	return
}