初始化 TTS 引擎工程:Android 系统引擎、Go 在线合成服务与测试客户端
- android-engine:TextToSpeechService 引擎,含设置页、语音包导入(SHA-256 校验)与预热 - server:Go CPU 合成服务与部署文件 - test-client:端到端验证客户端 - 模型与语音包不入库,见 models/README.md
This commit is contained in:
commit
1856de97bc
62 files changed
+3787
No files matched your search
@@ -0,0 +1,27 @@
|
||||
package tts
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestCacheRoundTrip(t *testing.T) {
|
||||
c, err := NewCache(t.TempDir())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
key := c.Key("dev-1", "a", 1, 1.2, "你好")
|
||||
if other := c.Key("dev-1", "a", 1, 1.2, "你好 "); other == key {
|
||||
t.Fatal("different text produced the same key")
|
||||
}
|
||||
if other := c.Key("dev-2", "a", 1, 1.2, "你好"); other == key {
|
||||
t.Fatal("version must be part of the key")
|
||||
}
|
||||
if _, ok := c.Get(key); ok {
|
||||
t.Fatal("unexpected cache hit")
|
||||
}
|
||||
if err := c.Put(key, []byte("wav")); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
got, ok := c.Get(key)
|
||||
if !ok || string(got) != "wav" {
|
||||
t.Fatalf("cache get: %q %v", got, ok)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user