PageRenderTime 10ms CodeModel.GetById 2ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/js/src/jit-test/tests/basic/testConvertibleObjectEqUndefined.js

http://github.com/zpao/v8monkey
JavaScript | 30 lines | 26 code | 4 blank | 0 comment | 2 complexity | a07d65b7632652da51acbbae45aa30bd MD5 | raw file
 1function x4(v) { return "" + v + v + v + v; }
 2function testConvertibleObjectEqUndefined()
 3{
 4  var compares =
 5    [
 6     false, false, false, false,
 7     undefined, undefined, undefined, undefined,
 8     false, false, false, false,
 9     undefined, undefined, undefined, undefined,
10     false, false, false, false,
11     undefined, undefined, undefined, undefined,
12     false, false, false, false,
13     undefined, undefined, undefined, undefined,
14     false, false, false, false,
15     undefined, undefined, undefined, undefined,
16    ];
17  var count = 0;
18  var obj = { valueOf: function() { count++; return 1; } };
19  var results = compares.map(function(v) { return "unwritten"; });
20
21  for (var i = 0, sz = compares.length; i < sz; i++)
22    results[i] = compares[i] == obj;
23
24  return results.join("") + count;
25}
26
27assertEq(testConvertibleObjectEqUndefined(),  
28	 x4(false) + x4(false) + x4(false) + x4(false) + x4(false) + x4(false) +
29	 x4(false) + x4(false) + x4(false) + x4(false) + "20");
30