BOOST_CHECK_CLOSE((c.*test_int)("-1e7"), -1e7, 1e-5);
BOOST_CHECK_CLOSE((c.*test_int)("2E07"), 2e07, 1e-5);
- BOOST_CHECK_EQUAL((c.*test_int)("0755"), 0755);
- BOOST_CHECK_EQUAL((c.*test_int)("0055"), 055);
- BOOST_CHECK_EQUAL((c.*test_int)("-0155"), -0155);
+ BOOST_CHECK_EQUAL((c.*test_int)("0755"), 755);
+ BOOST_CHECK_EQUAL((c.*test_int)("0055"), 55);
+ BOOST_CHECK_EQUAL((c.*test_int)("-0155"), -155);
+
+ BOOST_CHECK_EQUAL((c.*test_int)("0o755"), 0755);
+ BOOST_CHECK_EQUAL((c.*test_int)("0o055"), 055);
+ BOOST_CHECK_EQUAL((c.*test_int)("-0o155"), -0155);
BOOST_CHECK_EQUAL((c.*test_int)("0x755"), 0x755);
BOOST_CHECK_EQUAL((c.*test_int)("0x055"), 0x55);
unsigned char* buf = (unsigned char*)p->buf;
double d;
- if(buf[i] == '0') {
- if(i+2<len && buf[i+1] == 'x' && ISHEX(buf[i+2]))
+ if( buf[i] == '0' && i + 2 < len ) {
+ if( buf[i+1] == 'x' && ISHEX(buf[i+2]) )
return lexIntLiteral(p, index+2, 16);
- if(i+1<len && ISNUM(buf[i+1]) )
- return lexIntLiteral(p, index+1, 8);
+ if( buf[i+1] == 'o' && ISNUM(buf[i+2]) )
+ return lexIntLiteral(p, index+2, 8);
}
while(i<len && ISNUM(buf[i])) i++;
if(i >= len) { *v = 0; return len; }
if(s[i] == '+') { i++; }
else if(s[i] == '-') { i++; sgn = -1; }
- if(s[i] == '0') {
- i++; base = 8;
- if( i < len && s[i] == 'x' ) { i++; base = 16; }
+ if(s[i] == '0' && ++i < len) {
+ if( s[i] == 'x' ) { i++; base = 16; }
+ if( s[i] == 'o' ) { i++; base = 8; }
}
i2 = readint(s, len, i, &val, base);
if(i0 == i && i2 == i) {