Introduce utility methods to test for unknowns and OTP keywords

This commit is contained in:
Danny Moesch 2018-12-08 00:56:22 +01:00 committed by Bob Sun
parent bb6e44950f
commit 68dd60fb8e
3 changed files with 25 additions and 3 deletions

View file

@ -19,6 +19,20 @@ class ConstantsTest: XCTestCase {
XCTAssertFalse(Constants.isOtpRelated(line: "otp"))
}
func testIsOtpKeyword() {
XCTAssertTrue(Constants.isOtpKeyword("otpauth"))
XCTAssertTrue(Constants.isOtpKeyword("oTP_DigITS"))
XCTAssertFalse(Constants.isOtpKeyword("otp"))
XCTAssertFalse(Constants.isOtpKeyword("no keyword"))
}
func testIsUnknown() {
XCTAssertTrue(Constants.isUnknown("unknown"))
XCTAssertTrue(Constants.isUnknown("unknown string"))
XCTAssertFalse(Constants.isUnknown("otp"))
XCTAssertFalse(Constants.isUnknown("Unknown"))
}
func testUnknown() {
XCTAssertEqual(Constants.unknown(0), "unknown 0")
XCTAssertEqual(Constants.unknown(10), "unknown 10")