Added test for legality checking.