Add tests for nested grain/pillar matching

Also added tests for traditional grain matching when target grain is a
list.