Last active
January 15, 2016 16:31
-
-
Save junjiah/93e50c3528fb8b4e56be 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 testMaliciousExpressionNFA() { | |
// NFA matching. | |
let re = REAutomata(expr: "(0|00)*1") | |
self.measureBlock { | |
XCTAssertFalse(re.test("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")) | |
} | |
} | |
func testMaliciousExpressionDFA() { | |
// DFA matching. | |
let re = REAutomata(expr: "(0|00)*1", compileToDFA: true) | |
self.measureBlock { | |
XCTAssertFalse(re.test("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment