package factory import "testing" func TestCashNormal_AcceptCash(t *testing.T) { accept := CreateCashAccept(1) if accept == nil { t.Error("testing failed") } money := 300.0 ret := accept.AcceptCash(money) t.Log("\t应付: ", money) t.Log("\t实付: ", ret) } func TestCashRebate_AcceptCash(t *testing.T) { accept := CreateCashAccept(2) if accept == nil { t.Error("testing failed") } money := 300.0 ret := accept.AcceptCash(money) t.Log("\t应付: ", money) t.Log("\t实付: ", ret) } func TestCashReturn_AcceptCash(t *testing.T) { accept := CreateCashAccept(3) if accept == nil { t.Error("testing failed") } money := 300.0 ret := accept.AcceptCash(money) t.Log("\t应付: ", money) t.Log("\t实付: ", ret) } func TestCash(t *testing.T) { accept := CreateCashAccept(4) if accept == nil { t.Fatal("testing failed") } money := 300.0 ret := accept.AcceptCash(money) t.Log("\t应付: ", money) t.Log("\t实付: ", ret) }