S15.7.1.1_A1.js (1127B)
1 // Copyright 2009 the Sputnik authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 info: | 6 Number([value]) returns a number value (not a Number object) computed by 7 ToNumber(value) if value was supplied 8 es5id: 15.7.1.1_A1 9 description: Used values "10", 10, new String("10"), new Object(10) and "abc" 10 ---*/ 11 assert.sameValue(typeof Number("10"), "number", 'The value of `typeof Number("10")` is expected to be "number"'); 12 assert.sameValue(typeof Number(10), "number", 'The value of `typeof Number(10)` is expected to be "number"'); 13 14 assert.sameValue( 15 typeof Number(new String("10")), 16 "number", 17 'The value of `typeof Number(new String("10"))` is expected to be "number"' 18 ); 19 20 assert.sameValue( 21 typeof Number(new Object(10)), 22 "number", 23 'The value of `typeof Number(new Object(10))` is expected to be "number"' 24 ); 25 26 assert.sameValue(Number("abc"), NaN, 'Number("abc") returns NaN'); 27 assert.sameValue(Number("INFINITY"), NaN, 'Number("INFINITY") returns NaN'); 28 assert.sameValue(Number("infinity"), NaN, 'Number("infinity") returns NaN'); 29 30 reportCompare(0, 0);