Commit 3270fb4b authored by xyb's avatar xyb
Browse files

int() test passed

parent 82e61bdc
......@@ -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;
......
......@@ -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)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment