31 lines
597 B
Go
31 lines
597 B
Go
package adminuser
|
|
|
|
import "testing"
|
|
|
|
func TestDepositFreeQuotaAmountCent(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
req DepositFreeQuotaRequest
|
|
want int64
|
|
}{
|
|
{
|
|
name: "使用分字段",
|
|
req: DepositFreeQuotaRequest{AmountCent: 1234},
|
|
want: 1234,
|
|
},
|
|
{
|
|
name: "负分拒绝",
|
|
req: DepositFreeQuotaRequest{AmountCent: -1},
|
|
want: -1,
|
|
},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
if got := depositFreeQuotaAmountCent(tt.req); got != tt.want {
|
|
t.Fatalf("depositFreeQuotaAmountCent() = %d, want %d", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|