feat(admin): 运营后台(登录/查看/审核编辑/补全)+ 写入API + 审计留痕
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package adminstore
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestAgreementFromSources(t *testing.T) {
|
||||
cases := map[int]float64{0: 0.5, 1: 0.5, 2: 0.8, 3: 1.0, 9: 1.0}
|
||||
for n, want := range cases {
|
||||
if got := agreementFromSources(n); got != want {
|
||||
t.Errorf("agreementFromSources(%d) = %v, want %v", n, got, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestFreshnessFromAge(t *testing.T) {
|
||||
mk := func(d float64) *float64 { return &d }
|
||||
if got := freshnessFromAge(nil); got != 0.5 {
|
||||
t.Errorf("nil age = %v, want 0.5", got)
|
||||
}
|
||||
cases := []struct {
|
||||
days float64
|
||||
want float64
|
||||
}{
|
||||
{10, 1.0}, {30, 1.0}, {100, 0.8}, {300, 0.6}, {500, 0.4}, {1000, 0.2},
|
||||
}
|
||||
for _, c := range cases {
|
||||
if got := freshnessFromAge(mk(c.days)); got != c.want {
|
||||
t.Errorf("freshnessFromAge(%v) = %v, want %v", c.days, got, c.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user