Skip to content

Instantly share code, notes, and snippets.

@junjiah
Last active January 15, 2016 16:31
Show Gist options
  • Save junjiah/93e50c3528fb8b4e56be to your computer and use it in GitHub Desktop.
Save junjiah/93e50c3528fb8b4e56be to your computer and use it in GitHub Desktop.
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