-
Notifications
You must be signed in to change notification settings - Fork 12
Exptest
feuerbach edited this page Jul 17, 2011
·
2 revisions
This is a test from [Regular Expression Matching Can Be Simple And Fast ](http://swtch.com/~rsc/regexp/regexp1.html). A lot of regexp implementations in different languages fail this test.
Here’s the evidence that regexp-applicative passes the test. Tested with v0.1.3
import Text.Regex.Applicative import Data.Traversable
rep n r = sequenceA $ replicate n r
r n = (,) <$> rep n (sym 'a' <|> pure 'b') <*> rep n (sym 'a')
<!-- A hack to separate two blocks :( -→
*Main> replicate 30 'a' =~ r 30 Just ("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb","aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") (0.08 secs, 8400496 bytes)