1/* Copyright JS Foundation and other contributors, http://js.foundation 2 * 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16assert(+"0b1101001" === 105); 17assert(+"0B1101001" === 105); 18assert(+"0o767" === 503); 19assert(+"0O767" === 503); 20 21function assertNaN(str) { 22 assert(isNaN(+str)); 23} 24 25assertNaN("0b"); 26assertNaN("0b12"); 27assertNaN("0b10101100103"); 28assertNaN("0b101foo"); 29assertNaN("0bfoo101"); 30assertNaN("0b12345"); 31 32assertNaN("0B"); 33assertNaN("0B12"); 34assertNaN("0B10101100103"); 35assertNaN("0B101foo"); 36assertNaN("0Bfoo101"); 37assertNaN("0B12345"); 38 39assertNaN("0o"); 40assertNaN("0o1289"); 41assertNaN("0o88888"); 42assertNaN("0o12345foo"); 43assertNaN("0ofoo12345"); 44 45assertNaN("0O"); 46assertNaN("0O1289"); 47assertNaN("0O88888"); 48assertNaN("0O12345foo"); 49assertNaN("0Ofoo12345"); 50