-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathenumerationAddDelete.js
64 lines (49 loc) · 1.71 KB
/
enumerationAddDelete.js
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
53
54
55
56
57
58
59
60
61
62
63
64
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
//
//NOTE: this may break if enumeration order policy is changed in Chakra but that doesn't mean we have a bug in TTD
//
function makeobj(n)
{
var obj = { };
for(var i = 0; i < n; ++i)
{
obj[i] = 1;
}
return obj;
}
function testdelete(n)
{
for(var propToDelete = 0; propToDelete <= n; ++propToDelete)
{
for(var iterToDelete = 0; iterToDelete <= n; ++iterToDelete)
{
for(var iterToAdd = 0; iterToAdd <= n; ++iterToAdd)
{
telemetryLog(`testing with ${n} properties`, true);
telemetryLog(`deleting property number ${propToDelete} on iteration ${iterToDelete}`, true);
telemetryLog(`adding a property on iteration ${iterToAdd}`, true);
var o = makeobj(n);
var iter = 0;
for(var i in o)
{
if(iter == iterToDelete)
delete o[propToDelete];
if(iter == iterToAdd)
o["xxx"] = 1;
telemetryLog(`${i}`, true);
++iter;
}
}
}
}
}
WScript.SetTimeout(testFunction, 50);
/////////////////
function testFunction()
{
testdelete(2);
emitTTDLog(ttdLogURI);
}