c7ee891a90
- Add FlowUtteranceEndCoordinator with 350ms silence drain and 150ms post-roll - Extend FinalChunkRecovery for short/empty final chunks in chunked pipeline - Snapshot partial at mic stop and guard final transcript in FlowSessionManager - Unify tail drain presets (iosFlow/macMLX) and expand diagnostics Co-authored-by: Rocky <hkgood@users.noreply.github.com>
33 lines
1.1 KiB
Swift
33 lines
1.1 KiB
Swift
// UtteranceTranscriptGuardTests.swift
|
|
// OSGKeyboardTests
|
|
|
|
import XCTest
|
|
@testable import OSGKeyboardShared
|
|
|
|
final class UtteranceTranscriptGuardTests: XCTestCase {
|
|
|
|
func testResolvePrefersPartialWhenClearlyLonger() {
|
|
let resolved = UtteranceTranscriptGuard.resolve(
|
|
stitchedFinal: "今天天气很好",
|
|
partialSnapshot: "今天天气很好,我们一起去公园吧"
|
|
)
|
|
XCTAssertEqual(resolved, "今天天气很好,我们一起去公园吧")
|
|
}
|
|
|
|
func testResolveKeepsFinalWhenPartialIsNotLonger() {
|
|
let resolved = UtteranceTranscriptGuard.resolve(
|
|
stitchedFinal: "今天天气很好,我们一起去公园吧",
|
|
partialSnapshot: "今天天气很好"
|
|
)
|
|
XCTAssertEqual(resolved, "今天天气很好,我们一起去公园吧")
|
|
}
|
|
|
|
func testResolveUsesPartialWhenFinalEmpty() {
|
|
let resolved = UtteranceTranscriptGuard.resolve(
|
|
stitchedFinal: "",
|
|
partialSnapshot: "最后一段 partial"
|
|
)
|
|
XCTAssertEqual(resolved, "最后一段 partial")
|
|
}
|
|
}
|