Add more unit tests for rule matching