-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Brian Downs <[email protected]>
- Loading branch information
1 parent
0b96d02
commit 2d75174
Showing
4 changed files
with
59 additions
and
1 deletion.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,3 +28,4 @@ import "repeat.du"; | |
import "title.du"; | ||
import "isUpper.du"; | ||
import "isLower.du"; | ||
import "wordCount.du"; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* wordCount.du | ||
* | ||
* Testing the str.wordCount() method | ||
* | ||
* .wordCount() returns the number of words in the given string. | ||
*/ | ||
from UnitTest import UnitTest; | ||
|
||
class TestStringWordCount < UnitTest { | ||
testStringWordCount() { | ||
this.assertEquals("".wordCount(), 0); | ||
this.assertEquals("This".wordCount(), 1); | ||
this.assertEquals("This is a sentence".wordCount(), 4); | ||
this.assertEquals("This is an even longer sentence".wordCount(), 6); | ||
} | ||
} | ||
|
||
TestStringWordCount().run(); |