update the doc a bit
add more tests for pattern functions according to updated spec