Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Number/S15.7.2.1_A3.js

raw
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 The [[Value]] property of the newly constructed object
7 is set to ToNumber(value) if value was supplied, else to +0
8 es5id: 15.7.2.1_A3
9 description: Checking value of the newly created object
10 ---*/
11
12 //CHECK#1
13 var x1 = new Number(1);
14 if (x1.valueOf() !== 1) {
15 $ERROR('#1: var x1 = new Number(1); x1.valueOf() === 1');
16 }
17
18 //CHECK#2
19 var x2 = new Number();
20 if (x2.valueOf() !== 0) {
21 $ERROR('#2.1: var x2 = new Number(); x2.valueOf() === 0');
22 } else if (1 / x2.valueOf() !== Number.POSITIVE_INFINITY) {
23 $ERROR('#2.2: var x2 = new Number(); x2.valueOf() === +0');
24 }