localhost1978's picture
download
raw
1.82 kB
import SSK_Abstractions
@testable import SSK_Foundation
import XCTest
@available(macOS 27.0, iOS 27.0, *)
final class AudioTelemetryProjectionTests: XCTestCase {
func testProjectionIsBoundedAndKeepsElevenSummaries() throws {
let frames = (0..<500).map { index in
PersistedAudioTelemetryFrame(
timestamp: Double(index),
gaps: (0..<11).map { Double($0 + index) },
tauChord: (0..<11).map { Double($0) / 10 }
)
}
let projection = try AudioTelemetryProjector.project(frames: frames)
XCTAssertEqual(
projection.chartSeries.count,
AudioIngestionWidgetModel.maximumSeriesCount
)
XCTAssertTrue(projection.chartSeries.allSatisfy {
$0.points.count == AudioIngestionWidgetModel.maximumPointsPerSeries
})
XCTAssertEqual(projection.chartSeries[0].points.first?.time, 0)
XCTAssertEqual(projection.chartSeries[0].points.last?.time, 499)
XCTAssertEqual(projection.summaries.count, 11)
}
func testProjectionRejectsWrongFrameShape() throws {
let frame = PersistedAudioTelemetryFrame(
timestamp: 0,
gaps: [0],
tauChord: Array(repeating: 0, count: 11)
)
XCTAssertThrowsError(try AudioTelemetryProjector.project(frames: [frame])) { error in
XCTAssertEqual(
error as? AudioTelemetryProjectionError,
.invalidDimensions(frame: 0, gaps: 1, tauChord: 11)
)
}
}
func testEmptyProjectionHasTextFallbackInputs() throws {
let projection = try AudioTelemetryProjector.project(frames: [])
XCTAssertTrue(projection.chartSeries.isEmpty)
XCTAssertTrue(projection.summaries.isEmpty)
}
}

Xet Storage Details

Size:
1.82 kB
·
Xet hash:
16a89b7acaa71dd86ddf51105bac7a33a52b687d0e2474e467d9cbe0ec73a9cc

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.