Debian Codegraph @

rhino/testsrc/tests/ecma_2/Expressions/StrictEquality-001.js

raw symbols SCIP
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 gTestfile = 'StrictEquality-001.js';
7
8 /**
9 * File Name: StrictEquality-001.js
10 * ECMA Section: 11.9.6.js
11 * Description:
12 *
13 * Author: [email protected]
14 * Date: 4 september 1998
15 */
16 var SECTION = "StrictEquality-001 - 11.9.6";
17 var VERSION = "ECMA_2";
18 var TITLE = "The strict equality operator ( === )";
19
20 startTest();
21 writeHeaderToLog( SECTION + " "+ TITLE);
22
23
24 // 1. If Type(x) is different from Type(y) return false
25
26 StrictEquality( true, new Boolean(true), false );
27 StrictEquality( new Boolean(), false, false );
28 StrictEquality( "", new String(), false );
29 StrictEquality( new String("hi"), "hi", false );
30
31 // 2. If Type(x) is not Number go to step 9.
32
33 // 3. If x is NaN, return false
34 StrictEquality( NaN, NaN, false );
35 StrictEquality( NaN, 0, false );
36
37 // 4. If y is NaN, return false.
38 StrictEquality( 0, NaN, false );
39
40 // 5. if x is the same number value as y, return true
41
42 // 6. If x is +0 and y is -0, return true
43
44 // 7. If x is -0 and y is +0, return true
45
46 // 8. Return false.
47
48
49 // 9. If Type(x) is String, then return true if x and y are exactly
50 // the same sequence of characters ( same length and same characters
51 // in corresponding positions.) Otherwise return false.
52
53 // 10. If Type(x) is Boolean, return true if x and y are both true or
54 // both false. otherwise return false.
55
56
57 // Return true if x and y refer to the same object. Otherwise return
58 // false.
59
60 // Return false.
61
62
63 test();
64
65 function StrictEquality( x, y, expect ) {
66 result = ( x === y );
67
68 new TestCase(
69 SECTION,
70 x +" === " + y,
71 expect,
72 result );
73 }
74