mirror of
				https://github.com/tc39/test262.git
				synced 2025-10-31 19:53:50 +01:00 
			
		
		
		
	* [javascriptcore-test262-automation] changes from git@github.com:WebKit/webkit.git at sha 949e26452cfa153a7f4afe593da97e2fe9e1b706 on Tue Jul 03 2018 14:35:15 GMT-0400 (Eastern Daylight Time)
		
			
				
	
	
		
			132 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			132 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| function equalsNull(o) {
 | |
|     return o == null;
 | |
| }
 | |
| 
 | |
| noInline(equalsNull);
 | |
| 
 | |
| function notEqualsNull(o) {
 | |
|     return o != null;
 | |
| }
 | |
| 
 | |
| noInline(notEqualsNull);
 | |
| 
 | |
| function strictEqualsNull(o) {
 | |
|     return o === null;
 | |
| }
 | |
| 
 | |
| noInline(strictEqualsNull);
 | |
| 
 | |
| function strictNotEqualsNull(o) {
 | |
|     return o !== null;
 | |
| }
 | |
| 
 | |
| noInline(strictNotEqualsNull);
 | |
| 
 | |
| function equalsUndefined(o) {
 | |
|     return o == void 0;
 | |
| }
 | |
| 
 | |
| noInline(equalsUndefined);
 | |
| 
 | |
| function notEqualsUndefined(o) {
 | |
|     return o != void 0;
 | |
| }
 | |
| 
 | |
| noInline(notEqualsUndefined);
 | |
| 
 | |
| function strictEqualsUndefined(o) {
 | |
|     return o === void 0;
 | |
| }
 | |
| 
 | |
| noInline(strictEqualsUndefined);
 | |
| 
 | |
| function strictNotEqualsUndefined(o) {
 | |
|     return o !== void 0;
 | |
| }
 | |
| 
 | |
| noInline(strictNotEqualsNull);
 | |
| 
 | |
| function isFalsey(o) {
 | |
|     return !o;
 | |
| }
 | |
| 
 | |
| noInline(isFalsey);
 | |
| 
 | |
| function test(func, iteration, object, outcome) {
 | |
|     var result = func(object);
 | |
|     if (result != outcome)
 | |
|         throw new Error("Bad result: " + result + " on iteration " + iteration);
 | |
| }
 | |
| 
 | |
| for (var i = 0; i < 10000; ++i) {
 | |
|     test(equalsNull, i, null, true);
 | |
|     test(equalsNull, i, undefined, true);
 | |
|     test(equalsNull, i, void 0, true);
 | |
|     test(equalsNull, i, {}, false);
 | |
|     test(equalsNull, i, makeMasquerader(), true);
 | |
| }
 | |
| 
 | |
| for (var i = 0; i < 10000; ++i) {
 | |
|     test(notEqualsNull, i, null, false);
 | |
|     test(notEqualsNull, i, undefined, false);
 | |
|     test(notEqualsNull, i, void 0, false);
 | |
|     test(notEqualsNull, i, {}, true);
 | |
|     test(notEqualsNull, i, makeMasquerader(), false);
 | |
| }
 | |
| 
 | |
| for (var i = 0; i < 10000; ++i) {
 | |
|     test(strictEqualsNull, i, null, true);
 | |
|     test(strictEqualsNull, i, undefined, false);
 | |
|     test(strictEqualsNull, i, void 0, false);
 | |
|     test(strictEqualsNull, i, {}, false);
 | |
|     test(strictEqualsNull, i, makeMasquerader(), false);
 | |
| }
 | |
| 
 | |
| for (var i = 0; i < 10000; ++i) {
 | |
|     test(strictNotEqualsNull, i, null, false);
 | |
|     test(strictNotEqualsNull, i, undefined, true);
 | |
|     test(strictNotEqualsNull, i, void 0, true);
 | |
|     test(strictNotEqualsNull, i, {}, true);
 | |
|     test(strictNotEqualsNull, i, makeMasquerader(), true);
 | |
| }
 | |
| 
 | |
| for (var i = 0; i < 10000; ++i) {
 | |
|     test(equalsUndefined, i, null, true);
 | |
|     test(equalsUndefined, i, undefined, true);
 | |
|     test(equalsUndefined, i, void 0, true);
 | |
|     test(equalsUndefined, i, {}, false);
 | |
|     test(equalsUndefined, i, makeMasquerader(), true);
 | |
| }
 | |
| 
 | |
| for (var i = 0; i < 10000; ++i) {
 | |
|     test(notEqualsUndefined, i, null, false);
 | |
|     test(notEqualsUndefined, i, undefined, false);
 | |
|     test(notEqualsUndefined, i, void 0, false);
 | |
|     test(notEqualsUndefined, i, {}, true);
 | |
|     test(notEqualsUndefined, i, makeMasquerader(), false);
 | |
| }
 | |
| 
 | |
| for (var i = 0; i < 10000; ++i) {
 | |
|     test(strictEqualsUndefined, i, null, false);
 | |
|     test(strictEqualsUndefined, i, undefined, true);
 | |
|     test(strictEqualsUndefined, i, void 0, true);
 | |
|     test(strictEqualsUndefined, i, {}, false);
 | |
|     test(strictEqualsUndefined, i, makeMasquerader(), false);
 | |
| }
 | |
| 
 | |
| for (var i = 0; i < 10000; ++i) {
 | |
|     test(strictNotEqualsUndefined, i, null, true);
 | |
|     test(strictNotEqualsUndefined, i, undefined, false);
 | |
|     test(strictNotEqualsUndefined, i, void 0, false);
 | |
|     test(strictNotEqualsUndefined, i, {}, true);
 | |
|     test(strictNotEqualsUndefined, i, makeMasquerader(), true);
 | |
| }
 | |
| 
 | |
| for (var i = 0; i < 10000; ++i) {
 | |
|     test(isFalsey, i, null, true);
 | |
|     test(isFalsey, i, undefined, true);
 | |
|     test(isFalsey, i, void 0, true);
 | |
|     test(isFalsey, i, {}, false);
 | |
|     test(isFalsey, i, makeMasquerader(), true);
 | |
| }
 |