feat(capability): 转码能力装配进组合根(工具真进注册表、日志带 source)+ design/25 非bit-exact 留痕更正
This commit is contained in:
1 parent
f91a83ff81
commit
c6f5c3fea0
4 files changed
+87
-3
No files matched your search
@@ -0,0 +1,34 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"git.yeij.top/AskaEth/Cyrene_v2/internal/capability/registry"
|
||||
"git.yeij.top/AskaEth/Cyrene_v2/internal/capability/transcode"
|
||||
)
|
||||
|
||||
// TestWireTranscodeRegistersTool 断言 wireTranscode 真的把转码装配起来了:引擎挂到
|
||||
// app 上、`transcode` 工具进了能力注册表、且默认的 amr→wav 路可用。它是「组合根漏接
|
||||
// 转码」这一整类回归的哨兵(design/25 §1.3.2)。
|
||||
func TestWireTranscodeRegistersTool(t *testing.T) {
|
||||
a := &app{log: testLog(), caps: registry.New()}
|
||||
|
||||
a.wireTranscode()
|
||||
|
||||
if a.transcoder == nil {
|
||||
t.Fatal("wireTranscode 之后 a.transcoder 仍为 nil(引擎没被装配)")
|
||||
}
|
||||
cap, err := a.caps.Get(transcode.ToolName)
|
||||
if err != nil {
|
||||
t.Fatalf("transcode 工具没进能力注册表: %v", err)
|
||||
}
|
||||
if cap.Kind != registry.KindTool {
|
||||
t.Fatalf("能力类型 = %q, want %q", cap.Kind, registry.KindTool)
|
||||
}
|
||||
if _, ok := cap.Value.(*transcode.Tool); !ok {
|
||||
t.Fatalf("能力值类型 = %T, want *transcode.Tool", cap.Value)
|
||||
}
|
||||
if !a.transcoder.Supports(transcode.FormatAMR, transcode.FormatWAV) {
|
||||
t.Fatal("装配后 amr->wav 这条路不可用(默认编解码器没进引擎)")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user