Created
January 17, 2018 07:37
-
-
Save NghiaTranUIT/f8bd4b08346963a02dfa752eb07507f9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func testOrdinaryCase() { | |
let input = "Linearity is the property of a mathematical relationship or function which means that it can be graphically represented as a straight line. Examples are the relationship of voltage and current across a resistor, or the mass and weight of an object." | |
let expected = ["1/6 Linearity is the property of a mathematical", | |
"2/6 relationship or function which means that it", | |
"3/6 can be graphically represented as a straight", | |
"4/6 line. Examples are the relationship of voltage", | |
"5/6 and current across a resistor, or the mass and", | |
"6/6 weight of an object."] | |
let output = Utils.split(input, limit: limit) | |
XCTAssertEqual(output, expected, "The end part of messgae wasn't added to new component") | |
} | |
func testToughCase() { | |
let input = "Apart from counting words and characters, our online editor can help you to improve word choice and writing style, and, optionally, help you to detect grammar mistakes and plagiarism. To check word count, simply place your cursor into the text box above and start typing. You'll see the number of characters and words increase or decrease as you type, delete, and edit them. You can also copy and paste text from another program over into the online editor above. The Auto-Save feature will make sure you won't lose any changes while editing, even if you leave the site and come back later. Tip: Bookmark this page now." | |
let expected = ["1/15 Apart from counting words and characters, our", | |
"2/15 online editor can help you to improve word", | |
"3/15 choice and writing style, and, optionally,", | |
"4/15 help you to detect grammar mistakes and", | |
"5/15 plagiarism. To check word count, simply place", | |
"6/15 your cursor into the text box above and start", | |
"7/15 typing. You\'ll see the number of characters", | |
"8/15 and words increase or decrease as you type,", | |
"9/15 delete, and edit them. You can also copy and", | |
"10/15 paste text from another program over into", | |
"11/15 the online editor above. The Auto-Save", | |
"12/15 feature will make sure you won\'t lose any", | |
"13/15 changes while editing, even if you leave the", | |
"14/15 site and come back later. Tip: Bookmark this", | |
"15/15 page now."] | |
// When | |
let output = Utils.split(input, limit: limit) | |
// Then | |
XCTAssertEqual(output, expected, "The end part of messgae wasn't added to new component") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment