import Testing @testable import 康康 struct RetrievalSummaryTests { @Test func groupsAndCountsPreservingOrder() { let chips = HealthExportService.RetrievalSummary.groupedChips( ["血压", "血糖", "血压", "血压", "体重"], cap: 8) #expect(chips == ["血压 ×3", "血糖", "体重"]) } @Test func capsAndAppendsOverflow() { let names = (1...12).map { "指标\($0)" } let chips = HealthExportService.RetrievalSummary.groupedChips(names, cap: 8) #expect(chips.count == 9) #expect(chips.last == "+4") } @Test func emptyInputGivesEmptyChips() { #expect(HealthExportService.RetrievalSummary.groupedChips([], cap: 8).isEmpty) } }