Wed, 31 Dec 2014 13:27:57 +0100
Ignore runtime configuration files generated during quality assurance.
1 // Copyright 2009 the Sputnik authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
4 /**
5 * 0, null, undefined, false, empty string, NaN in expression is evaluated to false
6 *
7 * @path ch12/12.5/S12.5_A1.1_T2.js
8 * @description Using "if/else" construction
9 */
11 var c=0;
12 //////////////////////////////////////////////////////////////////////////////
13 //CHECK#1
14 if(0)
15 $ERROR('#1.1: 0 in expression is evaluated to false ');
16 else
17 c++;
18 if (c!=1) $ERROR('#1.2: else branch don`t execute');
19 //
20 //////////////////////////////////////////////////////////////////////////////
22 //////////////////////////////////////////////////////////////////////////////
23 //CHECK#2
24 if(false)
25 $ERROR('#2.1: false in expression is evaluated to false ');
26 else
27 c++;
28 if (c!=2) $ERROR('#2.2: else branch don`t execute');
29 //
30 //////////////////////////////////////////////////////////////////////////////
32 //////////////////////////////////////////////////////////////////////////////
33 //CHECK#3
34 if(null)
35 $ERROR('#3.1: null in expression is evaluated to false ');
36 else
37 c++;
38 if (c!=3) $ERROR('#3.2: else branch don`t execute');
39 //
40 //////////////////////////////////////////////////////////////////////////////
42 //////////////////////////////////////////////////////////////////////////////
43 //CHECK#4
44 if(undefined)
45 $ERROR('#4.1: undefined in expression is evaluated to false ');
46 else
47 c++;
48 if (c!=4) $ERROR('#4.2: else branch don`t execute');
49 //
50 //////////////////////////////////////////////////////////////////////////////
52 //////////////////////////////////////////////////////////////////////////////
53 //CHECK#5
54 if("")
55 $ERROR('#5.1: empty string in expression is evaluated to false ');
56 else
57 c++;
58 if (c!=5) $ERROR('#5.2: else branch don`t execute');
59 //
60 //////////////////////////////////////////////////////////////////////////////
62 //////////////////////////////////////////////////////////////////////////////
63 //CHECK#6
64 if(NaN)
65 $ERROR('#6.1: NaN in expression is evaluated to false ');
66 else
67 c++;
68 if (c!=6) $ERROR('#6.2: else branch don`t execute');
69 //
70 //////////////////////////////////////////////////////////////////////////////