package adminuser import "testing" func TestDepositFreeQuotaAmountCent(t *testing.T) { tests := []struct { name string req DepositFreeQuotaRequest want int64 }{ { name: "优先使用分字段", req: DepositFreeQuotaRequest{AmountCent: 1234, Amount: 99}, want: 1234, }, { name: "缺少分字段时回退元字段", req: DepositFreeQuotaRequest{Amount: 12.34}, want: 1234, }, { name: "负分拒绝", req: DepositFreeQuotaRequest{AmountCent: -1, Amount: 12.34}, 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) } }) } }