aboutsummaryrefslogtreecommitdiffstats
path: root/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.5_The_if_Statement/S12.5_A1.1_T1.js
blob: ff85fa84f3cea87b156550974b99f7c8e0fcbaba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright 2009 the Sputnik authors.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/**
* @name: S12.5_A1.1_T1;
* @section: 12.5;
* @assertion: 0, null, undefined, false, empty string, NaN in expression is evaluated to false;
* @description: Using "if" without "else" construction;
*/

//////////////////////////////////////////////////////////////////////////////
//CHECK#1

if(0)
	$ERROR('#1: 0 in expression is evaluated to false ');
//
//////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////
//CHECK#2
if(false)
    $ERROR('#2: false in expression is evaluated to false ');
//
//////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////
//CHECK#3
if(null)
	$ERROR('#3: null in expression is evaluated to false ');
//
//////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////
//CHECK#4
if(undefined)
	$ERROR('#4: undefined in expression is evaluated to false ');
//
//////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////
//CHECK#5
if("")
    $ERROR('#5: empty string in expression is evaluated to false ');
//
//////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////
//CHECK#6
if(NaN)
    $ERROR('#5: NaN in expression is evaluated to false ');
//
//////////////////////////////////////////////////////////////////////////////