feat: 增加在线语音 SDK 和音色管理后台,完善引擎适配
This commit is contained in:
1 parent
1856de97bc
commit
a532ba4e0f
71 files changed
+3189
-472
No files matched your search
@@ -24,4 +24,28 @@ func TestCacheRoundTrip(t *testing.T) {
|
||||
if !ok || string(got) != "wav" {
|
||||
t.Fatalf("cache get: %q %v", got, ok)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestCacheEvictsWithinBudget(t *testing.T) {
|
||||
c, err := NewCache(t.TempDir())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
c.maxBytes = 6
|
||||
first, second := c.Key("v", "a", 1, 1, "first"), c.Key("v", "a", 1, 1, "second")
|
||||
if err := c.Put(first, []byte("1234")); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := c.Put(second, []byte("5678")); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, ok := c.Get(first); ok {
|
||||
t.Fatal("old cache retained beyond budget")
|
||||
}
|
||||
if data, ok := c.Get(second); !ok || string(data) != "5678" {
|
||||
t.Fatal("new cache missing")
|
||||
}
|
||||
if err := c.Put(first, make([]byte, 7)); err == nil {
|
||||
t.Fatal("oversized cache accepted")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user