Files
sst/Tests/SstCoreTests/TranscriberVocabularyTests.swift

22 lines
830 B
Swift

import Foundation
import Testing
@testable import SstCore
private struct PlainTranscriber: Transcriber {
func transcribe(_ samples: [Float]) async throws -> String { "plain \(samples.count)" }
}
struct TranscriberVocabularyTests {
@Test func vocabularyVariantFallsBackToPlainTranscribe() async throws {
let result = try await PlainTranscriber().transcribe([0, 0, 0], vocabulary: ["Anthropic"])
#expect(result == "plain 3")
}
@Test func appliedCorrectionRoundTripsThroughJSON() throws {
let original = AppliedCorrection(heard: "cloud code", wrote: "Claude Code", rule: "cloud code", start: 12, length: 11)
let data = try JSONEncoder().encode(original)
let decoded = try JSONDecoder().decode(AppliedCorrection.self, from: data)
#expect(decoded == original)
}
}