ci / verify (pull_request) Successful in 15m34s
新增图片矢量化、视频超分、每日用量、计价与任务隔离能力,并通过环境变量解析平台凭据。 已通过 Go 全量门禁、迁移检查、镜像构建以及 Vectorizer 五格式和 Topaz 3 秒视频真实 DEV 验收。
30 lines
1.2 KiB
Go
30 lines
1.2 KiB
Go
package store
|
|
|
|
import "testing"
|
|
|
|
func TestValidateEffectivePricingRuleShape(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
resource string
|
|
unit string
|
|
calculator string
|
|
valid bool
|
|
}{
|
|
{name: "text", resource: "text_input", unit: "1k_tokens", calculator: "token_usage", valid: true},
|
|
{name: "image", resource: "image", unit: "image", calculator: "unit_weight", valid: true},
|
|
{name: "video", resource: "video", unit: "5s", calculator: "duration_weight", valid: true},
|
|
{name: "video enhance", resource: "video_enhance", unit: "5s", calculator: "transition_matrix", valid: true},
|
|
{name: "image vectorize", resource: "image_vectorize", unit: "conversion", calculator: "unit_weight", valid: true},
|
|
{name: "wrong video unit", resource: "video", unit: "second", calculator: "duration_weight"},
|
|
{name: "wrong image calculator", resource: "image", unit: "image", calculator: "token_usage"},
|
|
}
|
|
for _, test := range tests {
|
|
t.Run(test.name, func(t *testing.T) {
|
|
err := ValidateEffectivePricingRuleShape(test.resource, test.unit, test.calculator)
|
|
if (err == nil) != test.valid {
|
|
t.Fatalf("valid=%v err=%v", test.valid, err)
|
|
}
|
|
})
|
|
}
|
|
}
|