Improve test cases and use the Range class for checking intervals