Add isSquareFree method with test.