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) { ...@@ -49,16 +49,14 @@ long strtonum(const char *restrict s, int base) {
p -= 2; p -= 2;
} }
} else if (base == 8 && c == '0') { } else if (base == 8 && c == '0') {
if ((c | 32) == 'o') { c = *(p++);
base = 8; if ((c | 32) != 'o') {
} else { p -= 2;
goto value_error;
} }
} else if (base == 2 && c == '0') { } else if (base == 2 && c == '0') {
if ((c | 32) == 'b') { c = *(p++);
base = 2; if ((c | 32) != 'b') {
} else { p -= 2;
goto value_error;
} }
} else { } else {
if (base == 0) base = 10; if (base == 0) base = 10;
......
...@@ -38,7 +38,7 @@ def test(value, base): ...@@ -38,7 +38,7 @@ def test(value, base):
test(' 1x', 0) test(' 1x', 0)
test(' 1\02 ', 0) test(' 1' + chr(2) + ' ', 0)
test('', 0) test('', 0)
test(' ', 0) test(' ', 0)
test(' \t\t ', 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