Add check and testcases for invalid binary digits and octal digits