tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

S11.11.2_A4_T2.js (1068B)


      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: If ToBoolean(x) is true, return x
      6 es5id: 11.11.2_A4_T2
      7 description: Type(x) and Type(y) vary between primitive number and Number object
      8 ---*/
      9 
     10 //CHECK#1
     11 if ((-1 || 1) !== -1) {
     12  throw new Test262Error('#1: (-1 || 1) === -1');
     13 }
     14 
     15 //CHECK#2
     16 if ((1 || new Number(0)) !== 1) {
     17  throw new Test262Error('#2: (1 || new Number(0)) === 1');
     18 } 
     19 
     20 //CHECK#3
     21 if ((-1 || NaN) !== -1) {
     22  throw new Test262Error('#3: (-1 || NaN) === -1');
     23 }
     24 
     25 //CHECK#4
     26 var x = new Number(-1);
     27 if ((x || new Number(0)) !== x) {
     28  throw new Test262Error('#4: (var x = new Number(-1); (x || new Number(-1)) === x');
     29 }
     30 
     31 //CHECK#5
     32 var x = new Number(NaN);
     33 if ((x || new Number(1)) !== x) {
     34  throw new Test262Error('#5: (var x = new Number(NaN); (x || new Number(1)) === x');
     35 }
     36 
     37 //CHECK#6
     38 var x = new Number(0);
     39 if ((x || new Number(NaN)) !== x) {
     40  throw new Test262Error('#6: (var x = new Number(0); (x || new Number(NaN)) === x');
     41 }
     42 
     43 reportCompare(0, 0);