]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/ecma_2/Expressions/StrictEquality-001.js
c3ac50735cf08c38ef1fd59a7ec83c94af9d8457
2 * File Name: StrictEquality-001.js
3 * ECMA Section: 11.9.6.js
6 * Author: christine@netscape.com
7 * Date: 4 september 1998
9 var SECTION
= "StrictEquality-001 - 11.9.6";
10 var VERSION
= "ECMA_2";
11 var TITLE
= "The strict equality operator ( === )";
14 writeHeaderToLog( SECTION
+ " "+ TITLE
);
17 var testcases
= new Array();
20 // 1. If Type(x) is different from Type(y) return false
22 StrictEquality( true, new Boolean(true), false );
23 StrictEquality( new Boolean(), false, false );
24 StrictEquality( "", new String(), false );
25 StrictEquality( new String("hi"), "hi", false );
27 // 2. If Type(x) is not Number go to step 9.
29 // 3. If x is NaN, return false
30 StrictEquality( NaN
, NaN
, false );
31 StrictEquality( NaN
, 0, false );
33 // 4. If y is NaN, return false.
34 StrictEquality( 0, NaN
, false );
36 // 5. if x is the same number value as y, return true
38 // 6. If x is +0 and y is -0, return true
40 // 7. If x is -0 and y is +0, return true
45 // 9. If Type(x) is String, then return true if x and y are exactly
46 // the same sequence of characters ( same length and same characters
47 // in corresponding positions.) Otherwise return false.
49 // 10. If Type(x) is Boolean, return true if x and y are both true or
50 // both false. otherwise return false.
53 // Return true if x and y refer to the same object. Otherwise return
61 function StrictEquality( x
, y
, expect
) {
64 testcases
[tc
++] = new TestCase(