-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added wordCount method and tests for TreeBank.
- Loading branch information
Olcay Taner YILDIZ
committed
Apr 21, 2022
1 parent
6024fd9
commit 1cd3678
Showing
4 changed files
with
95 additions
and
4 deletions.
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
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,27 @@ | ||
import XCTest | ||
@testable import ParseTree | ||
|
||
final class TreeBankTest: XCTestCase { | ||
|
||
var treeBank1 : TreeBank = TreeBank() | ||
|
||
override func setUp() { | ||
let thisSourceFile = URL(fileURLWithPath: #file) | ||
let thisDirectory = thisSourceFile.deletingLastPathComponent() | ||
treeBank1 = TreeBank(folder: thisDirectory.appendingPathComponent("trees").path) | ||
} | ||
|
||
func testSize() { | ||
XCTAssertEqual(5, treeBank1.size()) | ||
} | ||
|
||
func testWordCount() { | ||
XCTAssertEqual(30, treeBank1.wordCount(excludeStopWords: true)) | ||
XCTAssertEqual(52, treeBank1.wordCount(excludeStopWords: false)) | ||
} | ||
|
||
static var allTests = [ | ||
("testExample1", testSize), | ||
("testExample2", testWordCount), | ||
] | ||
} |