test: Long text character counting.

This commit is contained in:
Shibo Lyu 2022-05-20 18:32:49 +08:00
parent 532dc89868
commit 5f0d996c91

View file

@ -31,4 +31,21 @@ final class CommonMetrics: XCTestCase {
.avgWordsPerSentence: 2.0 .avgWordsPerSentence: 2.0
]) ])
} }
func testLongTextCharCount() throws {
let calc = RACommonMetricsCalculator(metrics: [
.characterCount,
])
let text =
"""
The best things in an artists work are so much a matter of intuition, that there is much to be said for the point of view that would altogether discourage intellectual inquiry into artistic phenomena on the part of the artist. Intuitions are shy things and apt to disappear if looked into too closely. And there is undoubtedly a danger that too much knowledge and training may supplant the natural intuitive feeling of a student, leaving only a cold knowledge of the means of expression in its place. For the artist, if he has the right stuff in him
"""
let results = calc.calculate(on: text)
XCTAssertEqual(results, [
.characterCount: 446.0,
])
}
} }