tokenFactory/model/video_flat_clip_hint_markup...

31 lines
973 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package model
import (
"testing"
"github.com/QuantumNous/new-api/setting/ratio_setting"
)
// 模拟库内 GV-3.1-fast渠道 854x480 文生视频 $1/s全局同档 $2/s成本 100%、加价 100%。
func TestBuildVideoFlatClipHint_AppliesMarkupDiscount(t *testing.T) {
channelRules := ratio_setting.VideoPricingRules{
TextToVideoPerSecond: []ratio_setting.VideoResolutionAudioPriceRule{
{Resolution: "854x480", HasAudio: false, Price: 1},
},
}
globalRules := ratio_setting.VideoPricingRules{
TextToVideoPerSecond: []ratio_setting.VideoResolutionAudioPriceRule{
{Resolution: "854x480", HasAudio: false, Price: 2},
},
}
// 直接测档位展示价1*100% + 2*100% = 3
tiers := collectVideoPerSecondTiers(channelRules)
rows := buildSortedTierRows(tiers, globalRules, 100, 100)
if len(rows) != 1 {
t.Fatalf("rows=%d", len(rows))
}
if rows[0].UsdAfterChannelDiscount != 3 {
t.Fatalf("usd=%v want 3", rows[0].UsdAfterChannelDiscount)
}
}