# Copyright (c) 2025 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
=== Test 1: Basic Function Call ===
42
8
10
10
29
=== Test 2: Function Call with Default Parameters ===
15
20
30
26
18
6
95
85
70
50
15
24
42
69
105
150
hellodefault1003
helloworld1003
=== Test 3: Function Call with Rest Parameters ===
0
1
2
3
10
1
2
3
10
10
1
3
6
15
11
3
4
5
24
120
first|m1,m2,m3
start|a,b,c,d,e
{"a":1,"b":2,"c":3,"rest":[4,5,6,7,8]}
{"a":"a","b":"b","c":"c","rest":[]}
=== Test 4: Method Call ===
10
20
20
25
Hello, test
Hi, test
20
15
[2,4,6,8,10]
[11,12,13,14,15]
=== Test 5: Constructor Call ===
100
8
John is 30 years old
true
24
=== Test 6: Call with this binding ===
42
18
context3
=== Test 7: Call with call() method ===
6
6
Alice:25
1015
=== Test 8: Call with apply() method ===
206
6
Bob|x,y,z
515
=== Test 9: Call with bind() method ===
308
PREFIX-abc
10
315
320
=== Test 10: Nested Function Calls ===
8
5
13
120
5040
32
81
=== Test 11: Array Method Calls ===
[2,4,6,8,10]
[3,4,5]
15
4
3
true
true
[11,21,31,41,51]
[30,40,50]
12000000
40
3
true
true
45
=== Test 12: String Method Calls ===
HELLO WORLD
hello world
11
H
W
6
2
["Hello","World"]
Hello
World
JAVASCRIPT
javascript
10
4
Java
TypeScript
Test String JavaScript
=== Test 13: Object Method Calls ===
["a","b","c","getKeys","getValues","getEntries"]
[1,2,3,null,null,null]
[["a",1],["b",2],["c",3],["getKeys",null],["getValues",null],["getEntries",null]]
{"name":"TestObject","count":100,"enabled":true,"metadata":{"version":1,"author":"test"}}
TestObject:100
=== Test 14: Function Call with arguments ===
3
15
60
a=5, b=10, length=2
a=x, b=y, length=3
{"max":45,"min":5,"count":5}
{"max":600,"min":100,"count":6}
24
120
=== Test 15: Closure Calls ===
1
2
3
1
2
20
30
50
15
25
150
200
{"type":"user","name":"John","age":30}
{"type":"product","id":123,"price":99.99}
=== Test 16: Callback Function Calls ===
Result: 10
Doubled: 20
Async result: 12
[2,3,4,5,6]
Success: 10
Error: Invalid data
=== Test 17: Arrow Function Calls ===
10
10
6
42
5
[2,4,6,8,10]
[30,40,50]
15
=== Test 18: Function Call with new.target ===
called without new
called without new
8
30
200
Invalid call
=== Test 19: Function Call with spread operator ===
6
36
55
3840
{"a":1,"b":2,"c":3,"d":4,"e":5}
=== Test 20: Generator Function Calls ===
1
2
3
true
1
2
3
4
5
true
1
2
3
a
b
c
true
=== Test 21: Async Function Calls ===
Async 1: 42
Async 2: 42
Async 3: 30
Async 4: 15
=== Test 22: Recursive Function Calls ===
55
210
olleh
dlrow
Index of 7: 3
Index of 10: -1
120
5040
=== Test 23: High-Order Function Calls ===
16
22
25
24
64
=== Test 24: Method Chaining Calls ===
4.5
4.5
24
=== Test 25: Conditional Function Calls ===
20
HELLO
null
15
Empty array
Not an array
20
No value property
No object
15
50
2
Unknown operation
=== Test 26: Looping with Function Calls ===
55
5050
120
720
55
610
{"a":2,"b":4,"c":6}
=== Test 27: Exception Handling in Function Calls ===
4
Error: Negative value
10
15
Error: Empty array
Error: Not an array
10
Infinity
20
Cleanup completed
42
Cleanup completed
Error: Null object
=== Test 28: Complex Function Composition ===
12
19
7.75
=== Test 29: Function Memoization ===
120
120
720
720
55
55
21081692.74615191
21081692.74615191
=== Test 30: Partial Application ===
10
35
30
60
Prefix: Hello {0}!
Hello World!
=== Test 31: Currying ===
6
6
6
6
24
24
24
24
=== Test 32: Proxy and Function Calls ===
Calling function with args: 5,3
Result: 8
8
Calling method: method
30
=== Test 33: Symbol and Function Calls ===
100
150
260
=== Test 34: Map and Set Operations ===
1
2
3
true
true
10
8
12
3
=== Test 35: WeakMap and WeakSet ===
value1
value2
true
true
true
=== Test 36: Promise Chain Calls ===
First then: 10
Second then: 20
Third then: 30
Final result: 40
=== Test 37: ArrayBuffer and TypedArray ===
120
86
4660
305419896
5
1.5
5.5
=== Test 38: DataView Operations ===
64
9
8697
4028335726
3.14159
=== Test 40: Regular Expression ===
true
false
true
false
true
false
true
123,456
=== Test 41: JSON Operations ===
{"name":"Test","value":42,"nested":{"array":[1,2,3],"boolean":true,"nullValue":null}}
Test
1
{
"name": "Test",
"value": 42,
"nested": {
"array": [
1,
2,
3
],
"boolean": true,
"nullValue": null
}
}
=== Test 42: Error Handling ===
Finally block executed
Infinity
Error: Custom error
10
Caught error: Invalid value
=== Test 43: Math Operations ===
10
4
3
4
5
1
4
8
0
1
0
2
=== Test 44: Number Operations ===
42
3
3.14
42
true
false
true
false
true
false
42
3.14
3.1416
=== Test 45: String Operations ===
11
H
W
6
2
9
Hello
World
HELLO WORLD
hello world
["Hello","World"]
Hello JavaScript
Hello World!
Hello World
=== Test 46: Array Operations ===
10
4
true
11
11
1
10
[3,4,5]
[3,4,5]
0,2,6,7,8,9,10
0,2,6,7,8,9,10
[10,9,8,7,6,2,0]
=== Test 47: Object Operations ===
5
5
5
true
false
{"a":1,"b":2,"c":3,"d":4,"e":5,"f":6}
true
false
[object Object]
=== Test 48: Class Operations ===
42
100
10
20
=== Test 49: Template Literals ===
Hello World
Value: 42
Result: 10
Name: John, Age: 30
Multi
line
template
User: Alice, Age: 25
=== Test 50: Destructuring ===
1
2
3
1
2
3,4,5
10
20
30
10
20
=== Test 51: Spread Operator ===
1,2,3,4,5,6,7,8,9
{"a":1,"b":2,"c":3,"d":4,"e":5}
1
2
3
4
5
=== Test 52: For...Of Loop ===
Sum: 15
String: Hello
Set Sum: 15
=== Test 53: For...In Loop ===
Keys: a,b,c,d
Indices: 0,1,2,3,4
=== Test 54: Import/Export Operations ===
Module system check completed
=== Test 55: Dynamic Property Names ===
1
2
3
{"static":1,"dynamic":2,"computedProp":3}
=== Test 56: Optional Chaining ===
Value: 42
Undefined: undefined
=== Test 57: Nullish Coalescing ===
Null coalesce: default
Undefined coalesce: default
Zero coalesce: 0
Empty string coalesce:
=== Test 58: BigInt ===
BigInt support available
1111111110111111111011111111100
246913578024691357802469135780
=== Test 59: Static Methods ===
Static method called
Static property
8
=== Test 60: Private Fields ===
42
=== Test Suite Completed ===
Total tests executed: 60
Comprehensive Call operations test completed successfully