| | |
| | | "os" |
| | | "path/filepath" |
| | | "testing" |
| | | "time" |
| | | |
| | | "voicesnap/internal/model" |
| | | ) |
| | |
| | | } |
| | | } |
| | | |
| | | func TestRememberNonEmptyTextKeepsLastPartial(t *testing.T) { |
| | | got := rememberNonEmptyText("最后一句", " ") |
| | | if got != "最后一句" { |
| | | t.Fatalf("rememberNonEmptyText() = %q, want last non-empty text", got) |
| | | } |
| | | |
| | | got = rememberNonEmptyText("旧内容", "新内容") |
| | | if got != "新内容" { |
| | | t.Fatalf("rememberNonEmptyText() = %q, want new non-empty text", got) |
| | | } |
| | | } |
| | | |
| | | func TestXASRTailPaddingMatchesFlushWindow(t *testing.T) { |
| | | if xasrTailPaddingSamples != 24000 { |
| | | t.Fatalf("tail padding samples = %d, want 24000", xasrTailPaddingSamples) |
| | | } |
| | | if len(xasrTailPadding) != xasrTailPaddingSamples { |
| | | t.Fatalf("tail padding len = %d, want %d", len(xasrTailPadding), xasrTailPaddingSamples) |
| | | } |
| | | } |
| | | |
| | | func TestXASRRequestsReleaseTailCaptureDelay(t *testing.T) { |
| | | got := (&xasrStreamingEngine{}).ReleaseTailCaptureDelay() |
| | | if got != 300*time.Millisecond { |
| | | t.Fatalf("ReleaseTailCaptureDelay() = %v, want 300ms", got) |
| | | } |
| | | } |
| | | |
| | | func TestOfflineSherpaDoesNotRequestReleaseTailCapture(t *testing.T) { |
| | | if _, ok := any(&sherpaEngine{}).(ReleaseTailCaptureEngine); ok { |
| | | t.Fatal("offline sherpa engine should not request release tail capture") |
| | | } |
| | | } |
| | | |
| | | func TestXASRRealModelSmoke(t *testing.T) { |
| | | if os.Getenv("PRIVATEVOICE_XASR_SMOKE") != "1" { |
| | | t.Skip("set PRIVATEVOICE_XASR_SMOKE=1 to run the real X-ASR model smoke test") |