int() test passed

pull/81/head
xyb 2014-01-15 19:58:11 +08:00
rodzic 82e61bdc24
commit 3270fb4be6
2 zmienionych plików z 7 dodań i 9 usunięć

Wyświetl plik

@ -49,16 +49,14 @@ long strtonum(const char *restrict s, int base) {
p -= 2;
}
} else if (base == 8 && c == '0') {
if ((c | 32) == 'o') {
base = 8;
} else {
goto value_error;
c = *(p++);
if ((c | 32) != 'o') {
p -= 2;
}
} else if (base == 2 && c == '0') {
if ((c | 32) == 'b') {
base = 2;
} else {
goto value_error;
c = *(p++);
if ((c | 32) != 'b') {
p -= 2;
}
} else {
if (base == 0) base = 10;

Wyświetl plik

@ -38,7 +38,7 @@ def test(value, base):
test(' 1x', 0)
test(' 1\02 ', 0)
test(' 1' + chr(2) + ' ', 0)
test('', 0)
test(' ', 0)
test(' \t\t ', 0)