Debian Codegraph @

js/src/tests/test262/language/statements/if/S12.5_A1_T2.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: 1, true, non-empty string in expression is evaluated to true
6 es5id: 12.5_A1_T2
7 description: Using "if/else" construction
8 ---*/
9
10 var c=0;
11 //////////////////////////////////////////////////////////////////////////////
12 //CHECK#1
13 if(!(1))
14 throw new Test262Error('#1.1: 1 in expression is evaluated to true');
15 else
16 c++;
17 if (c!=1) throw new Test262Error('#1.2: else branch don`t execute');
18 //
19 //////////////////////////////////////////////////////////////////////////////
20
21 //////////////////////////////////////////////////////////////////////////////
22 //CHECK#2
23 if(!(true))
24 throw new Test262Error('#2.1: true in expression is evaluated to true');
25 else
26 c++;
27 if (c!=2) throw new Test262Error('#2.2: else branch don`t execute');
28 //
29 //////////////////////////////////////////////////////////////////////////////
30
31 //////////////////////////////////////////////////////////////////////////////
32 //CHECK#3
33 if(!("1"))
34 throw new Test262Error('#3.1: "1" in expression is evaluated to true');
35 else
36 c++;
37 if (c!=3) throw new Test262Error('#3.2: else branch don`t execute');
38 //
39 //////////////////////////////////////////////////////////////////////////////
40
41 //////////////////////////////////////////////////////////////////////////////
42 //CHECK#4
43 if(!("A"))
44 throw new Test262Error('#4.1: "A" in expression is evaluated to true');
45 else
46 c++;
47 if (c!=4) throw new Test262Error('#4.2: else branch don`t execute');
48 //
49 //////////////////////////////////////////////////////////////////////////////
50
51 reportCompare(0, 0);