mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-11-23 10:09:54 +00:00
aottest关于assert_equal还原(6277 6327 6380)
Signed-off-by: shiminnan@huawei.com <shiminnan@huawei.com>
This commit is contained in:
parent
57c44e44e6
commit
d45758536e
@ -58,6 +58,9 @@ group("ark_aot_js_assert_test") {
|
||||
group("ark_aot_ts_test") {
|
||||
testonly = true
|
||||
test_list = [
|
||||
"array",
|
||||
"array_foreach_inline",
|
||||
"ashr",
|
||||
"asyncgenerator",
|
||||
"asyncgeneratormultiloop",
|
||||
"asyncgeneratorrest",
|
||||
@ -65,6 +68,38 @@ group("ark_aot_ts_test") {
|
||||
"async_env",
|
||||
"await",
|
||||
"await_loop",
|
||||
"bc_builder",
|
||||
"bind",
|
||||
"binaryop_special_value",
|
||||
"builtinmath",
|
||||
"call_same_bytecode_func",
|
||||
"callithisrange",
|
||||
"calls",
|
||||
"classstatic",
|
||||
"class_method_signature",
|
||||
"closeiterator",
|
||||
"compiler_test",
|
||||
"constpool",
|
||||
"continue_from_finally",
|
||||
"copyrestargs",
|
||||
"createarray_meta_data",
|
||||
"createarrayimm16",
|
||||
"createarraywithbuffer",
|
||||
"createemptyarray",
|
||||
"createemptyobject",
|
||||
"creategeneratorobj",
|
||||
"createiterresultobj",
|
||||
"createobjecthavingmethod",
|
||||
"createobjectwithbuffer",
|
||||
"createobjectwithexcludedkeys",
|
||||
"createregexpwithliteral",
|
||||
"dec",
|
||||
"default_supers",
|
||||
"defineasyncfunc",
|
||||
"defineclasswithbuffer",
|
||||
"defineclass",
|
||||
"definefunc",
|
||||
"definefunc_variable_args",
|
||||
"definegeneratorfunc",
|
||||
"definegettersetterbyvalue",
|
||||
"definemethod",
|
||||
@ -308,41 +343,6 @@ group("ark_aot_ts_assert_test") {
|
||||
"add",
|
||||
"and",
|
||||
"array_bounds_check_elimination",
|
||||
"array",
|
||||
"array_foreach_inline",
|
||||
"ashr",
|
||||
"bind",
|
||||
"binaryop_special_value",
|
||||
"bc_builder",
|
||||
"builtinmath",
|
||||
"call_same_bytecode_func",
|
||||
"callithisrange",
|
||||
"calls",
|
||||
"classstatic",
|
||||
"class_method_signature",
|
||||
"closeiterator",
|
||||
"compiler_test",
|
||||
"constpool",
|
||||
"continue_from_finally",
|
||||
"copyrestargs",
|
||||
"createarray_meta_data",
|
||||
"createarrayimm16",
|
||||
"createarraywithbuffer",
|
||||
"createemptyarray",
|
||||
"createemptyobject",
|
||||
"creategeneratorobj",
|
||||
"createiterresultobj",
|
||||
"createobjecthavingmethod",
|
||||
"createobjectwithbuffer",
|
||||
"createobjectwithexcludedkeys",
|
||||
"createregexpwithliteral",
|
||||
"dec",
|
||||
"default_supers",
|
||||
"defineasyncfunc",
|
||||
"defineclasswithbuffer",
|
||||
"defineclass",
|
||||
"definefunc",
|
||||
"definefunc_variable_args",
|
||||
]
|
||||
foreach(test, assert_test_list) {
|
||||
deps += [ "${test}:${test}AotAssertAction" ]
|
||||
|
@ -13,6 +13,6 @@
|
||||
|
||||
import("//arkcompiler/ets_runtime/test/test_helper.gni")
|
||||
|
||||
host_aot_assert_test_action("array") {
|
||||
host_aot_test_action("array") {
|
||||
deps = []
|
||||
}
|
||||
|
@ -13,12 +13,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
declare function assert_equal(a: Object, b: Object):void;
|
||||
declare function print(arg:any):string;
|
||||
let a = []
|
||||
let l = a.push(1)
|
||||
assert_equal(l, 1)
|
||||
print(l)
|
||||
l = a.push(1, 2, 3, 4, 5)
|
||||
assert_equal(l, 6)
|
||||
print(l)
|
||||
|
||||
for (let i = 0; i < 100; i++) {
|
||||
a.push(i)
|
||||
@ -27,7 +27,7 @@ for (let i = 0; i < 100; i++) {
|
||||
let c = [1, 2, 3, 4]
|
||||
a.push(...c)
|
||||
|
||||
assert_equal(a.length, 110)
|
||||
print(a.length)
|
||||
|
||||
let b = []
|
||||
b.push(1, 2, 3, 4)
|
||||
@ -35,5 +35,5 @@ b.push(1, 2, 3)
|
||||
b.push(1, 2)
|
||||
b.push(1)
|
||||
b.push()
|
||||
assert_equal(Object.values(b), [1, 2, 3, 4, 1, 2, 3, 1, 2, 1])
|
||||
assert_equal(b.length, 10)
|
||||
print(Object.values(b))
|
||||
print(b.length)
|
||||
|
18
test/aottest/array/expect_output.txt
Normal file
18
test/aottest/array/expect_output.txt
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2022 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.
|
||||
|
||||
1
|
||||
6
|
||||
110
|
||||
1,2,3,4,1,2,3,1,2,1
|
||||
10
|
@ -13,7 +13,7 @@
|
||||
|
||||
import("//arkcompiler/ets_runtime/test/test_helper.gni")
|
||||
|
||||
host_aot_assert_test_action("array_foreach_inline") {
|
||||
host_aot_test_action("array_foreach_inline") {
|
||||
deps = []
|
||||
is_enable_opt_inlining = true
|
||||
is_enable_native_inline = true
|
||||
|
@ -13,30 +13,21 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
declare function assert_equal(a: Object, b: Object):void;
|
||||
let array1:numeber[] = [4, 5, 6];
|
||||
|
||||
const expectedArray1 = [4, 5, 6];
|
||||
let i = 0;
|
||||
array1.forEach((element) => {
|
||||
assert_equal(element, expectedArray1[i]);
|
||||
i++;
|
||||
print(element)
|
||||
});
|
||||
|
||||
i = 0;
|
||||
array1.forEach((element) => {
|
||||
array1[array1.length] = array1.length
|
||||
assert_equal(element, expectedArray1[i]);
|
||||
i++;
|
||||
print(element)
|
||||
});
|
||||
|
||||
const expectedArray2 = [4, 6, 3, 4, 5];
|
||||
i = 0;
|
||||
array1.forEach((element) => {
|
||||
delete array1[1];
|
||||
assert_equal(element, expectedArray2[i]);
|
||||
i++;
|
||||
print(element)
|
||||
});
|
||||
|
||||
assert_equal(array1.length, 6)
|
||||
print(array1.length)
|
||||
|
||||
|
25
test/aottest/array_foreach_inline/expect_output.txt
Normal file
25
test/aottest/array_foreach_inline/expect_output.txt
Normal file
@ -0,0 +1,25 @@
|
||||
# Copyright (c) 2023 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.
|
||||
|
||||
4
|
||||
5
|
||||
6
|
||||
4
|
||||
5
|
||||
6
|
||||
4
|
||||
6
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
@ -13,6 +13,6 @@
|
||||
|
||||
import("//arkcompiler/ets_runtime/test/test_helper.gni")
|
||||
|
||||
host_aot_assert_test_action("ashr") {
|
||||
host_aot_test_action("ashr") {
|
||||
deps = []
|
||||
}
|
||||
|
@ -13,45 +13,45 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
declare function assert_equal(a: Object, b: Object):void;
|
||||
declare function print(str:any):string;
|
||||
var x1 = 16;
|
||||
var y1 = 1;
|
||||
var r1 = x1 >>> y1;
|
||||
assert_equal(r1, 8);
|
||||
print(r1);
|
||||
|
||||
var x2 = 16.8;
|
||||
var y2 = 1;
|
||||
var r2 = x2 >>> y2;
|
||||
assert_equal(r2, 8);
|
||||
print(r2);
|
||||
|
||||
var x3 = 16;
|
||||
var y3 = 1.8;
|
||||
var r3 = x3 >>> y3;
|
||||
assert_equal(r3, 8);
|
||||
print(r3);
|
||||
|
||||
var x4 = 16.8;
|
||||
var y4 = 1.8;
|
||||
var r4 = x4 >>> y4;
|
||||
assert_equal(r4, 8);
|
||||
print(r4);
|
||||
|
||||
var x5:any = "16";
|
||||
var y5:number = 1;
|
||||
var r5 = x5 >>> y5;
|
||||
assert_equal(r5, 8);
|
||||
print(r5);
|
||||
|
||||
var x6 = -16;
|
||||
var y6 = 1;
|
||||
var r6 = x6 >>> y6;
|
||||
assert_equal(r6, 2147483640);
|
||||
print(r6);
|
||||
|
||||
var x7 = 16;
|
||||
var y7 = -1;
|
||||
var r7 = x7 >>> y7;
|
||||
assert_equal(r7, 0);
|
||||
print(r7);
|
||||
|
||||
var x8 = 4294967295.1;
|
||||
var y8 = 0;
|
||||
var r8 = x8 >>> y8;
|
||||
assert_equal(r8, 4294967295);
|
||||
print(r8);
|
||||
|
||||
// not supported type: string, bigint
|
||||
|
21
test/aottest/ashr/expect_output.txt
Normal file
21
test/aottest/ashr/expect_output.txt
Normal file
@ -0,0 +1,21 @@
|
||||
# Copyright (c) 2022 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.
|
||||
|
||||
8
|
||||
8
|
||||
8
|
||||
8
|
||||
8
|
||||
2147483640
|
||||
0
|
||||
4294967295
|
@ -13,6 +13,6 @@
|
||||
|
||||
import("//arkcompiler/ets_runtime/test/test_helper.gni")
|
||||
|
||||
host_aot_assert_test_action("bc_builder") {
|
||||
host_aot_test_action("bc_builder") {
|
||||
deps = []
|
||||
}
|
||||
|
14
test/aottest/bc_builder/expect_output.txt
Normal file
14
test/aottest/bc_builder/expect_output.txt
Normal file
@ -0,0 +1,14 @@
|
||||
# Copyright (c) 2023 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.
|
||||
|
||||
2
|
@ -13,6 +13,6 @@
|
||||
|
||||
import("//arkcompiler/ets_runtime/test/test_helper.gni")
|
||||
|
||||
host_aot_assert_test_action("binaryop_special_value") {
|
||||
host_aot_test_action("binaryop_special_value") {
|
||||
deps = []
|
||||
}
|
||||
|
@ -14,8 +14,6 @@
|
||||
*/
|
||||
|
||||
declare function print(arg:any):string;
|
||||
declare function assert_true(condition: boolean):void;
|
||||
declare function assert_equal(a: Object, b: Object):void;
|
||||
|
||||
let undf: any = undefined;
|
||||
let intNum: number = 5;
|
||||
@ -26,399 +24,399 @@ let nullValue: any = null;
|
||||
|
||||
// int op undefined
|
||||
print("=====int op undefined=====")
|
||||
assert_true(isNaN(intNum + undf));
|
||||
assert_true(isNaN(intNum - undf));
|
||||
assert_true(isNaN(intNum * undf));
|
||||
assert_true(isNaN(intNum / undf));
|
||||
assert_true(isNaN(intNum % undf));
|
||||
assert_equal(intNum < undf, falseValue);
|
||||
assert_equal(intNum <= undf, falseValue);
|
||||
assert_equal(intNum > undf, falseValue);
|
||||
assert_equal(intNum >= undf, falseValue);
|
||||
assert_equal(intNum == undf, falseValue);
|
||||
assert_equal(intNum === undf, falseValue);
|
||||
assert_equal(intNum != undf, trueValue);
|
||||
assert_equal(intNum !== undf, trueValue);
|
||||
assert_equal(intNum << undf, 5);
|
||||
assert_equal(intNum >> undf, 5);
|
||||
assert_equal(intNum >>> undf, 5);
|
||||
assert_equal(intNum | undf, 5);
|
||||
assert_equal(intNum ^ undf, 5);
|
||||
print(intNum + undf);
|
||||
print(intNum - undf);
|
||||
print(intNum * undf);
|
||||
print(intNum / undf);
|
||||
print(intNum % undf);
|
||||
print(intNum < undf);
|
||||
print(intNum <= undf);
|
||||
print(intNum > undf);
|
||||
print(intNum >= undf);
|
||||
print(intNum == undf);
|
||||
print(intNum === undf);
|
||||
print(intNum != undf);
|
||||
print(intNum !== undf);
|
||||
print(intNum << undf);
|
||||
print(intNum >> undf);
|
||||
print(intNum >>> undf);
|
||||
print(intNum | undf);
|
||||
print(intNum ^ undf);
|
||||
|
||||
// double op undefined
|
||||
print("=====double op undefined=====")
|
||||
assert_true(isNaN(doubleNum + undf));
|
||||
assert_true(isNaN(doubleNum - undf));
|
||||
assert_true(isNaN(doubleNum * undf));
|
||||
assert_true(isNaN(doubleNum / undf));
|
||||
assert_true(isNaN(doubleNum % undf));
|
||||
assert_equal(doubleNum < undf, falseValue);
|
||||
assert_equal(doubleNum <= undf, falseValue);
|
||||
assert_equal(doubleNum > undf, falseValue);
|
||||
assert_equal(doubleNum >= undf, falseValue);
|
||||
assert_equal(doubleNum == undf, falseValue);
|
||||
assert_equal(doubleNum === undf, falseValue);
|
||||
assert_equal(doubleNum != undf, trueValue);
|
||||
assert_equal(doubleNum !== undf, trueValue);
|
||||
assert_equal(doubleNum << undf, 1);
|
||||
assert_equal(doubleNum >> undf, 1);
|
||||
assert_equal(doubleNum >>> undf, 1);
|
||||
assert_equal(doubleNum | undf, 1);
|
||||
assert_equal(doubleNum ^ undf, 1);
|
||||
print(doubleNum + undf);
|
||||
print(doubleNum - undf);
|
||||
print(doubleNum * undf);
|
||||
print(doubleNum / undf);
|
||||
print(doubleNum % undf);
|
||||
print(doubleNum < undf);
|
||||
print(doubleNum <= undf);
|
||||
print(doubleNum > undf);
|
||||
print(doubleNum >= undf);
|
||||
print(doubleNum == undf);
|
||||
print(doubleNum === undf);
|
||||
print(doubleNum != undf);
|
||||
print(doubleNum !== undf);
|
||||
print(doubleNum << undf);
|
||||
print(doubleNum >> undf);
|
||||
print(doubleNum >>> undf);
|
||||
print(doubleNum | undf);
|
||||
print(doubleNum ^ undf);
|
||||
|
||||
// false op undefined
|
||||
print("=====false op undefined=====")
|
||||
assert_true(isNaN(falseValue + undf));
|
||||
assert_true(isNaN(falseValue - undf));
|
||||
assert_true(isNaN(falseValue * undf));
|
||||
assert_true(isNaN(falseValue / undf));
|
||||
assert_true(isNaN(falseValue % undf));
|
||||
assert_equal(falseValue < undf, falseValue);
|
||||
assert_equal(falseValue <= undf, falseValue);
|
||||
assert_equal(falseValue > undf, falseValue);
|
||||
assert_equal(falseValue >= undf, falseValue);
|
||||
assert_equal(falseValue == undf, falseValue);
|
||||
assert_equal(falseValue === undf, falseValue);
|
||||
assert_equal(falseValue != undf, trueValue);
|
||||
assert_equal(falseValue !== undf, trueValue);
|
||||
assert_equal(falseValue << undf, 0);
|
||||
assert_equal(falseValue >> undf, 0);
|
||||
assert_equal(falseValue >>> undf, 0);
|
||||
assert_equal(falseValue | undf, 0);
|
||||
assert_equal(falseValue ^ undf, 0);
|
||||
print(falseValue + undf);
|
||||
print(falseValue - undf);
|
||||
print(falseValue * undf);
|
||||
print(falseValue / undf);
|
||||
print(falseValue % undf);
|
||||
print(falseValue < undf);
|
||||
print(falseValue <= undf);
|
||||
print(falseValue > undf);
|
||||
print(falseValue >= undf);
|
||||
print(falseValue == undf);
|
||||
print(falseValue === undf);
|
||||
print(falseValue != undf);
|
||||
print(falseValue !== undf);
|
||||
print(falseValue << undf);
|
||||
print(falseValue >> undf);
|
||||
print(falseValue >>> undf);
|
||||
print(falseValue | undf);
|
||||
print(falseValue ^ undf);
|
||||
|
||||
// true op undefined
|
||||
print("=====true op undefined=====")
|
||||
assert_true(isNaN(trueValue + undf));
|
||||
assert_true(isNaN(trueValue - undf));
|
||||
assert_true(isNaN(trueValue * undf));
|
||||
assert_true(isNaN(trueValue / undf));
|
||||
assert_true(isNaN(trueValue % undf));
|
||||
assert_equal(trueValue < undf, falseValue);
|
||||
assert_equal(trueValue <= undf, falseValue);
|
||||
assert_equal(trueValue > undf, falseValue);
|
||||
assert_equal(trueValue >= undf, falseValue);
|
||||
assert_equal(trueValue == undf, falseValue);
|
||||
assert_equal(trueValue === undf, falseValue);
|
||||
assert_equal(trueValue != undf, trueValue);
|
||||
assert_equal(trueValue !== undf, trueValue);
|
||||
assert_equal(trueValue << undf, 1);
|
||||
assert_equal(trueValue >> undf, 1);
|
||||
assert_equal(trueValue >>> undf, 1);
|
||||
assert_equal(trueValue | undf, 1);
|
||||
assert_equal(trueValue ^ undf, 1);
|
||||
print(trueValue + undf);
|
||||
print(trueValue - undf);
|
||||
print(trueValue * undf);
|
||||
print(trueValue / undf);
|
||||
print(trueValue % undf);
|
||||
print(trueValue < undf);
|
||||
print(trueValue <= undf);
|
||||
print(trueValue > undf);
|
||||
print(trueValue >= undf);
|
||||
print(trueValue == undf);
|
||||
print(trueValue === undf);
|
||||
print(trueValue != undf);
|
||||
print(trueValue !== undf);
|
||||
print(trueValue << undf);
|
||||
print(trueValue >> undf);
|
||||
print(trueValue >>> undf);
|
||||
print(trueValue | undf);
|
||||
print(trueValue ^ undf);
|
||||
|
||||
// null op undefined
|
||||
print("=====null op undefined=====")
|
||||
assert_true(isNaN(nullValue + undf));
|
||||
assert_true(isNaN(nullValue - undf));
|
||||
assert_true(isNaN(nullValue * undf));
|
||||
assert_true(isNaN(nullValue / undf));
|
||||
assert_true(isNaN(nullValue % undf));
|
||||
assert_equal(nullValue < undf, falseValue);
|
||||
assert_equal(nullValue <= undf, falseValue);
|
||||
assert_equal(nullValue > undf, falseValue);
|
||||
assert_equal(nullValue >= undf, falseValue);
|
||||
assert_equal(nullValue == undf, trueValue);
|
||||
assert_equal(nullValue === undf, falseValue);
|
||||
assert_equal(nullValue != undf, falseValue);
|
||||
assert_equal(nullValue !== undf, trueValue);
|
||||
assert_equal(nullValue << undf, 0);
|
||||
assert_equal(nullValue >> undf, 0);
|
||||
assert_equal(nullValue >>> undf, 0);
|
||||
assert_equal(nullValue | undf, 0);
|
||||
assert_equal(nullValue ^ undf, 0);
|
||||
print(nullValue + undf);
|
||||
print(nullValue - undf);
|
||||
print(nullValue * undf);
|
||||
print(nullValue / undf);
|
||||
print(nullValue % undf);
|
||||
print(nullValue < undf);
|
||||
print(nullValue <= undf);
|
||||
print(nullValue > undf);
|
||||
print(nullValue >= undf);
|
||||
print(nullValue == undf);
|
||||
print(nullValue === undf);
|
||||
print(nullValue != undf);
|
||||
print(nullValue !== undf);
|
||||
print(nullValue << undf);
|
||||
print(nullValue >> undf);
|
||||
print(nullValue >>> undf);
|
||||
print(nullValue | undf);
|
||||
print(nullValue ^ undf);
|
||||
|
||||
// int op null
|
||||
print("=====int op null=====")
|
||||
assert_equal(intNum + nullValue, 5);
|
||||
assert_equal(intNum - nullValue, 5);
|
||||
assert_equal(intNum * nullValue, 0);
|
||||
assert_equal(intNum / nullValue, Infinity);
|
||||
assert_true(isNaN(intNum % nullValue));
|
||||
assert_equal(intNum < nullValue, falseValue);
|
||||
assert_equal(intNum <= nullValue, falseValue);
|
||||
assert_equal(intNum > nullValue, trueValue);
|
||||
assert_equal(intNum >= nullValue, trueValue);
|
||||
assert_equal(intNum == nullValue, falseValue);
|
||||
assert_equal(intNum === nullValue, falseValue);
|
||||
assert_equal(intNum != nullValue, trueValue);
|
||||
assert_equal(intNum !== nullValue, trueValue);
|
||||
assert_equal(intNum << nullValue, 5);
|
||||
assert_equal(intNum >> nullValue, 5);
|
||||
assert_equal(intNum >>> nullValue, 5);
|
||||
assert_equal(intNum | nullValue, 5);
|
||||
assert_equal(intNum ^ nullValue, 5);
|
||||
print(intNum + nullValue);
|
||||
print(intNum - nullValue);
|
||||
print(intNum * nullValue);
|
||||
print(intNum / nullValue);
|
||||
print(intNum % nullValue);
|
||||
print(intNum < nullValue);
|
||||
print(intNum <= nullValue);
|
||||
print(intNum > nullValue);
|
||||
print(intNum >= nullValue);
|
||||
print(intNum == nullValue);
|
||||
print(intNum === nullValue);
|
||||
print(intNum != nullValue);
|
||||
print(intNum !== nullValue);
|
||||
print(intNum << nullValue);
|
||||
print(intNum >> nullValue);
|
||||
print(intNum >>> nullValue);
|
||||
print(intNum | nullValue);
|
||||
print(intNum ^ nullValue);
|
||||
|
||||
// double op null
|
||||
print("=====double op null=====")
|
||||
assert_equal(doubleNum + nullValue, 1.1);
|
||||
assert_equal(doubleNum - nullValue, 1.1);
|
||||
assert_equal(doubleNum * nullValue, 0);
|
||||
assert_equal(doubleNum / nullValue, Infinity);
|
||||
assert_true(isNaN(doubleNum % nullValue));
|
||||
assert_equal(doubleNum < nullValue, falseValue);
|
||||
assert_equal(doubleNum <= nullValue, falseValue);
|
||||
assert_equal(doubleNum > nullValue, trueValue);
|
||||
assert_equal(doubleNum >= nullValue, trueValue);
|
||||
assert_equal(doubleNum == nullValue, falseValue);
|
||||
assert_equal(doubleNum === nullValue, falseValue);
|
||||
assert_equal(doubleNum != nullValue, trueValue);
|
||||
assert_equal(doubleNum !== nullValue, trueValue);
|
||||
assert_equal(doubleNum << nullValue, 1);
|
||||
assert_equal(doubleNum >> nullValue, 1);
|
||||
assert_equal(doubleNum >>> nullValue, 1);
|
||||
assert_equal(doubleNum | nullValue, 1);
|
||||
assert_equal(doubleNum ^ nullValue, 1);
|
||||
print(doubleNum + nullValue);
|
||||
print(doubleNum - nullValue);
|
||||
print(doubleNum * nullValue);
|
||||
print(doubleNum / nullValue);
|
||||
print(doubleNum % nullValue);
|
||||
print(doubleNum < nullValue);
|
||||
print(doubleNum <= nullValue);
|
||||
print(doubleNum > nullValue);
|
||||
print(doubleNum >= nullValue);
|
||||
print(doubleNum == nullValue);
|
||||
print(doubleNum === nullValue);
|
||||
print(doubleNum != nullValue);
|
||||
print(doubleNum !== nullValue);
|
||||
print(doubleNum << nullValue);
|
||||
print(doubleNum >> nullValue);
|
||||
print(doubleNum >>> nullValue);
|
||||
print(doubleNum | nullValue);
|
||||
print(doubleNum ^ nullValue);
|
||||
|
||||
// false op null
|
||||
print("=====false op null=====")
|
||||
assert_equal(falseValue + nullValue, 0);
|
||||
assert_equal(falseValue - nullValue, 0);
|
||||
assert_equal(falseValue * nullValue, 0);
|
||||
assert_true(isNaN(falseValue / nullValue));
|
||||
assert_true(isNaN(falseValue % nullValue));
|
||||
assert_equal(falseValue < nullValue, falseValue);
|
||||
assert_equal(falseValue <= nullValue, trueValue);
|
||||
assert_equal(falseValue > nullValue, falseValue);
|
||||
assert_equal(falseValue >= nullValue, trueValue);
|
||||
assert_equal(falseValue == nullValue, falseValue);
|
||||
assert_equal(falseValue === nullValue, falseValue);
|
||||
assert_equal(falseValue != nullValue, trueValue);
|
||||
assert_equal(falseValue !== nullValue, trueValue);
|
||||
assert_equal(falseValue << nullValue, 0);
|
||||
assert_equal(falseValue >> nullValue, 0);
|
||||
assert_equal(falseValue >>> nullValue, 0);
|
||||
assert_equal(falseValue | nullValue, 0);
|
||||
assert_equal(falseValue ^ nullValue, 0);
|
||||
print(falseValue + nullValue);
|
||||
print(falseValue - nullValue);
|
||||
print(falseValue * nullValue);
|
||||
print(falseValue / nullValue);
|
||||
print(falseValue % nullValue);
|
||||
print(falseValue < nullValue);
|
||||
print(falseValue <= nullValue);
|
||||
print(falseValue > nullValue);
|
||||
print(falseValue >= nullValue);
|
||||
print(falseValue == nullValue);
|
||||
print(falseValue === nullValue);
|
||||
print(falseValue != nullValue);
|
||||
print(falseValue !== nullValue);
|
||||
print(falseValue << nullValue);
|
||||
print(falseValue >> nullValue);
|
||||
print(falseValue >>> nullValue);
|
||||
print(falseValue | nullValue);
|
||||
print(falseValue ^ nullValue);
|
||||
|
||||
// true op null
|
||||
print("=====true op null=====")
|
||||
assert_equal(trueValue + nullValue, 1);
|
||||
assert_equal(trueValue - nullValue, 1);
|
||||
assert_equal(trueValue * nullValue, 0);
|
||||
assert_equal(trueValue / nullValue, Infinity);
|
||||
assert_true(isNaN(trueValue % nullValue));
|
||||
assert_equal(trueValue < nullValue, falseValue);
|
||||
assert_equal(trueValue <= nullValue, falseValue);
|
||||
assert_equal(trueValue > nullValue, trueValue);
|
||||
assert_equal(trueValue >= nullValue, trueValue);
|
||||
assert_equal(trueValue == nullValue, falseValue);
|
||||
assert_equal(trueValue === nullValue, falseValue);
|
||||
assert_equal(trueValue != nullValue, trueValue);
|
||||
assert_equal(trueValue !== nullValue, trueValue);
|
||||
assert_equal(trueValue << nullValue, 1);
|
||||
assert_equal(trueValue >> nullValue, 1);
|
||||
assert_equal(trueValue >>> nullValue, 1);
|
||||
assert_equal(trueValue | nullValue, 1);
|
||||
assert_equal(trueValue ^ nullValue, 1);
|
||||
print(trueValue + nullValue);
|
||||
print(trueValue - nullValue);
|
||||
print(trueValue * nullValue);
|
||||
print(trueValue / nullValue);
|
||||
print(trueValue % nullValue);
|
||||
print(trueValue < nullValue);
|
||||
print(trueValue <= nullValue);
|
||||
print(trueValue > nullValue);
|
||||
print(trueValue >= nullValue);
|
||||
print(trueValue == nullValue);
|
||||
print(trueValue === nullValue);
|
||||
print(trueValue != nullValue);
|
||||
print(trueValue !== nullValue);
|
||||
print(trueValue << nullValue);
|
||||
print(trueValue >> nullValue);
|
||||
print(trueValue >>> nullValue);
|
||||
print(trueValue | nullValue);
|
||||
print(trueValue ^ nullValue);
|
||||
|
||||
// int op false
|
||||
print("=====int op false=====")
|
||||
assert_equal(intNum + falseValue, 5);
|
||||
assert_equal(intNum - falseValue, 5);
|
||||
assert_equal(intNum * falseValue, 0);
|
||||
assert_equal(intNum / falseValue, Infinity);
|
||||
assert_true(isNaN(intNum % falseValue));
|
||||
assert_equal(intNum < falseValue, falseValue);
|
||||
assert_equal(intNum <= falseValue, falseValue);
|
||||
assert_equal(intNum > falseValue, trueValue);
|
||||
assert_equal(intNum >= falseValue, trueValue);
|
||||
assert_equal(intNum == falseValue, falseValue);
|
||||
assert_equal(intNum === falseValue, falseValue);
|
||||
assert_equal(intNum != falseValue, trueValue);
|
||||
assert_equal(intNum !== falseValue, trueValue);
|
||||
assert_equal(intNum << falseValue, 5);
|
||||
assert_equal(intNum >> falseValue, 5);
|
||||
assert_equal(intNum >>> falseValue, 5);
|
||||
assert_equal(intNum | falseValue, 5);
|
||||
assert_equal(intNum ^ falseValue, 5);
|
||||
print(intNum + falseValue);
|
||||
print(intNum - falseValue);
|
||||
print(intNum * falseValue);
|
||||
print(intNum / falseValue);
|
||||
print(intNum % falseValue);
|
||||
print(intNum < falseValue);
|
||||
print(intNum <= falseValue);
|
||||
print(intNum > falseValue);
|
||||
print(intNum >= falseValue);
|
||||
print(intNum == falseValue);
|
||||
print(intNum === falseValue);
|
||||
print(intNum != falseValue);
|
||||
print(intNum !== falseValue);
|
||||
print(intNum << falseValue);
|
||||
print(intNum >> falseValue);
|
||||
print(intNum >>> falseValue);
|
||||
print(intNum | falseValue);
|
||||
print(intNum ^ falseValue);
|
||||
|
||||
// double op false
|
||||
print("=====double op false=====")
|
||||
assert_equal(doubleNum + falseValue, 1.1);
|
||||
assert_equal(doubleNum - falseValue, 1.1);
|
||||
assert_equal(doubleNum * falseValue, 0);
|
||||
assert_equal(doubleNum / falseValue, Infinity);
|
||||
assert_true(isNaN(doubleNum % falseValue));
|
||||
assert_equal(doubleNum < falseValue, falseValue);
|
||||
assert_equal(doubleNum <= falseValue, falseValue);
|
||||
assert_equal(doubleNum > falseValue, trueValue);
|
||||
assert_equal(doubleNum >= falseValue, trueValue);
|
||||
assert_equal(doubleNum == falseValue, falseValue);
|
||||
assert_equal(doubleNum === falseValue, falseValue);
|
||||
assert_equal(doubleNum != falseValue, trueValue);
|
||||
assert_equal(doubleNum !== falseValue, trueValue);
|
||||
assert_equal(doubleNum << falseValue, 1);
|
||||
assert_equal(doubleNum >> falseValue, 1);
|
||||
assert_equal(doubleNum >>> falseValue, 1);
|
||||
assert_equal(doubleNum | falseValue, 1);
|
||||
assert_equal(doubleNum ^ falseValue, 1);
|
||||
print(doubleNum + falseValue);
|
||||
print(doubleNum - falseValue);
|
||||
print(doubleNum * falseValue);
|
||||
print(doubleNum / falseValue);
|
||||
print(doubleNum % falseValue);
|
||||
print(doubleNum < falseValue);
|
||||
print(doubleNum <= falseValue);
|
||||
print(doubleNum > falseValue);
|
||||
print(doubleNum >= falseValue);
|
||||
print(doubleNum == falseValue);
|
||||
print(doubleNum === falseValue);
|
||||
print(doubleNum != falseValue);
|
||||
print(doubleNum !== falseValue);
|
||||
print(doubleNum << falseValue);
|
||||
print(doubleNum >> falseValue);
|
||||
print(doubleNum >>> falseValue);
|
||||
print(doubleNum | falseValue);
|
||||
print(doubleNum ^ falseValue);
|
||||
|
||||
// true op false
|
||||
print("=====true op false=====")
|
||||
assert_equal(trueValue + falseValue, 1);
|
||||
assert_equal(trueValue - falseValue, 1);
|
||||
assert_equal(trueValue * falseValue, 0);
|
||||
assert_equal(trueValue / falseValue, Infinity);
|
||||
assert_true(isNaN(trueValue % falseValue));
|
||||
assert_equal(trueValue < falseValue, falseValue);
|
||||
assert_equal(trueValue <= falseValue, falseValue);
|
||||
assert_equal(trueValue > falseValue, trueValue);
|
||||
assert_equal(trueValue >= falseValue, trueValue);
|
||||
assert_equal(trueValue == falseValue, falseValue);
|
||||
assert_equal(trueValue === falseValue, falseValue);
|
||||
assert_equal(trueValue != falseValue, trueValue);
|
||||
assert_equal(trueValue !== falseValue, trueValue);
|
||||
assert_equal(trueValue << falseValue, 1);
|
||||
assert_equal(trueValue >> falseValue, 1);
|
||||
assert_equal(trueValue >>> falseValue, 1);
|
||||
assert_equal(trueValue | falseValue, 1);
|
||||
assert_equal(trueValue ^ falseValue, 1);
|
||||
print(trueValue + falseValue);
|
||||
print(trueValue - falseValue);
|
||||
print(trueValue * falseValue);
|
||||
print(trueValue / falseValue);
|
||||
print(trueValue % falseValue);
|
||||
print(trueValue < falseValue);
|
||||
print(trueValue <= falseValue);
|
||||
print(trueValue > falseValue);
|
||||
print(trueValue >= falseValue);
|
||||
print(trueValue == falseValue);
|
||||
print(trueValue === falseValue);
|
||||
print(trueValue != falseValue);
|
||||
print(trueValue !== falseValue);
|
||||
print(trueValue << falseValue);
|
||||
print(trueValue >> falseValue);
|
||||
print(trueValue >>> falseValue);
|
||||
print(trueValue | falseValue);
|
||||
print(trueValue ^ falseValue);
|
||||
|
||||
// int op true
|
||||
print("=====int op true=====")
|
||||
assert_equal(intNum + trueValue, 6);
|
||||
assert_equal(intNum - trueValue, 4);
|
||||
assert_equal(intNum * trueValue, 5);
|
||||
assert_equal(intNum / trueValue, 5);
|
||||
assert_equal(intNum % trueValue, 0);
|
||||
assert_equal(intNum < trueValue, falseValue);
|
||||
assert_equal(intNum <= trueValue, falseValue);
|
||||
assert_equal(intNum > trueValue, trueValue);
|
||||
assert_equal(intNum >= trueValue, trueValue);
|
||||
assert_equal(intNum == trueValue, falseValue);
|
||||
assert_equal(intNum === trueValue, falseValue);
|
||||
assert_equal(intNum != trueValue, trueValue);
|
||||
assert_equal(intNum !== trueValue, trueValue);
|
||||
assert_equal(intNum << trueValue, 10);
|
||||
assert_equal(intNum >> trueValue, 2);
|
||||
assert_equal(intNum >>> trueValue, 2);
|
||||
assert_equal(intNum | trueValue, 5);
|
||||
assert_equal(intNum ^ trueValue, 4);
|
||||
print(intNum + trueValue);
|
||||
print(intNum - trueValue);
|
||||
print(intNum * trueValue);
|
||||
print(intNum / trueValue);
|
||||
print(intNum % trueValue);
|
||||
print(intNum < trueValue);
|
||||
print(intNum <= trueValue);
|
||||
print(intNum > trueValue);
|
||||
print(intNum >= trueValue);
|
||||
print(intNum == trueValue);
|
||||
print(intNum === trueValue);
|
||||
print(intNum != trueValue);
|
||||
print(intNum !== trueValue);
|
||||
print(intNum << trueValue);
|
||||
print(intNum >> trueValue);
|
||||
print(intNum >>> trueValue);
|
||||
print(intNum | trueValue);
|
||||
print(intNum ^ trueValue);
|
||||
|
||||
// double op true
|
||||
print("=====double op true=====")
|
||||
assert_equal(doubleNum + trueValue, 2.1);
|
||||
assert_equal(doubleNum - trueValue, 0.10000000000000009);
|
||||
assert_equal(doubleNum * trueValue, 1.1);
|
||||
assert_equal(doubleNum / trueValue, 1.1);
|
||||
assert_equal(doubleNum % trueValue, 0.10000000000000009);
|
||||
assert_equal(doubleNum < trueValue, falseValue);
|
||||
assert_equal(doubleNum <= trueValue, falseValue);
|
||||
assert_equal(doubleNum > trueValue, trueValue);
|
||||
assert_equal(doubleNum >= trueValue, trueValue);
|
||||
assert_equal(doubleNum == trueValue, falseValue);
|
||||
assert_equal(doubleNum === trueValue, falseValue);
|
||||
assert_equal(doubleNum != trueValue, trueValue);
|
||||
assert_equal(doubleNum !== trueValue, trueValue);
|
||||
assert_equal(doubleNum << trueValue, 2);
|
||||
assert_equal(doubleNum >> trueValue, 0);
|
||||
assert_equal(doubleNum >>> trueValue, 0);
|
||||
assert_equal(doubleNum | trueValue, 1);
|
||||
assert_equal(doubleNum ^ trueValue, 0);
|
||||
print(doubleNum + trueValue);
|
||||
print(doubleNum - trueValue);
|
||||
print(doubleNum * trueValue);
|
||||
print(doubleNum / trueValue);
|
||||
print(doubleNum % trueValue);
|
||||
print(doubleNum < trueValue);
|
||||
print(doubleNum <= trueValue);
|
||||
print(doubleNum > trueValue);
|
||||
print(doubleNum >= trueValue);
|
||||
print(doubleNum == trueValue);
|
||||
print(doubleNum === trueValue);
|
||||
print(doubleNum != trueValue);
|
||||
print(doubleNum !== trueValue);
|
||||
print(doubleNum << trueValue);
|
||||
print(doubleNum >> trueValue);
|
||||
print(doubleNum >>> trueValue);
|
||||
print(doubleNum | trueValue);
|
||||
print(doubleNum ^ trueValue);
|
||||
|
||||
// true op false
|
||||
print("=====true op false=====")
|
||||
assert_equal(trueValue + falseValue, 1);
|
||||
assert_equal(trueValue - falseValue, 1);
|
||||
assert_equal(trueValue * falseValue, 0);
|
||||
assert_equal(trueValue / falseValue, Infinity);
|
||||
assert_true(isNaN(trueValue % falseValue));
|
||||
assert_equal(trueValue < falseValue, falseValue);
|
||||
assert_equal(trueValue <= falseValue, falseValue);
|
||||
assert_equal(trueValue > falseValue, trueValue);
|
||||
assert_equal(trueValue >= falseValue, trueValue);
|
||||
assert_equal(trueValue == falseValue, falseValue);
|
||||
assert_equal(trueValue === falseValue, falseValue);
|
||||
assert_equal(trueValue != falseValue, trueValue);
|
||||
assert_equal(trueValue !== falseValue, trueValue);
|
||||
assert_equal(trueValue << falseValue, 1);
|
||||
assert_equal(trueValue >> falseValue, 1);
|
||||
assert_equal(trueValue >>> falseValue, 1);
|
||||
assert_equal(trueValue | falseValue, 1);
|
||||
assert_equal(trueValue ^ falseValue, 1);
|
||||
print(trueValue + falseValue);
|
||||
print(trueValue - falseValue);
|
||||
print(trueValue * falseValue);
|
||||
print(trueValue / falseValue);
|
||||
print(trueValue % falseValue);
|
||||
print(trueValue < falseValue);
|
||||
print(trueValue <= falseValue);
|
||||
print(trueValue > falseValue);
|
||||
print(trueValue >= falseValue);
|
||||
print(trueValue == falseValue);
|
||||
print(trueValue === falseValue);
|
||||
print(trueValue != falseValue);
|
||||
print(trueValue !== falseValue);
|
||||
print(trueValue << falseValue);
|
||||
print(trueValue >> falseValue);
|
||||
print(trueValue >>> falseValue);
|
||||
print(trueValue | falseValue);
|
||||
print(trueValue ^ falseValue);
|
||||
|
||||
// undefined op undefined
|
||||
print("=====undefined op undefined=====")
|
||||
assert_true(isNaN(undf + undf));
|
||||
assert_true(isNaN(undf - undf));
|
||||
assert_true(isNaN(undf * undf));
|
||||
assert_true(isNaN(undf / undf));
|
||||
assert_true(isNaN(undf % undf));
|
||||
assert_equal(undf < undf, falseValue);
|
||||
assert_equal(undf <= undf, falseValue);
|
||||
assert_equal(undf > undf, falseValue);
|
||||
assert_equal(undf >= undf, falseValue);
|
||||
assert_equal(undf == undf, trueValue);
|
||||
assert_equal(undf === undf, trueValue);
|
||||
assert_equal(undf != undf, falseValue);
|
||||
assert_equal(undf !== undf, falseValue);
|
||||
assert_equal(undf << undf, 0);
|
||||
assert_equal(undf >> undf, 0);
|
||||
assert_equal(undf >>> undf, 0);
|
||||
assert_equal(undf | undf, 0);
|
||||
assert_equal(undf ^ undf, 0);
|
||||
print(undf + undf);
|
||||
print(undf - undf);
|
||||
print(undf * undf);
|
||||
print(undf / undf);
|
||||
print(undf % undf);
|
||||
print(undf < undf);
|
||||
print(undf <= undf);
|
||||
print(undf > undf);
|
||||
print(undf >= undf);
|
||||
print(undf == undf);
|
||||
print(undf === undf);
|
||||
print(undf != undf);
|
||||
print(undf !== undf);
|
||||
print(undf << undf);
|
||||
print(undf >> undf);
|
||||
print(undf >>> undf);
|
||||
print(undf | undf);
|
||||
print(undf ^ undf);
|
||||
|
||||
// null op null
|
||||
print("=====null op null=====")
|
||||
assert_equal(nullValue + nullValue, 0);
|
||||
assert_equal(nullValue - nullValue, 0);
|
||||
assert_equal(nullValue * nullValue, 0);
|
||||
assert_true(isNaN(nullValue / nullValue));
|
||||
assert_true(isNaN(nullValue % nullValue));
|
||||
assert_equal(nullValue < nullValue, falseValue);
|
||||
assert_equal(nullValue <= nullValue, trueValue);
|
||||
assert_equal(nullValue > nullValue, falseValue);
|
||||
assert_equal(nullValue >= nullValue, trueValue);
|
||||
assert_equal(nullValue == nullValue, trueValue);
|
||||
assert_equal(nullValue === nullValue, trueValue);
|
||||
assert_equal(nullValue != nullValue, falseValue);
|
||||
assert_equal(nullValue !== nullValue, falseValue);
|
||||
assert_equal(nullValue << nullValue, 0);
|
||||
assert_equal(nullValue >> nullValue, 0);
|
||||
assert_equal(nullValue >>> nullValue, 0);
|
||||
assert_equal(nullValue | nullValue, 0);
|
||||
assert_equal(nullValue ^ nullValue, 0);
|
||||
print(nullValue + nullValue);
|
||||
print(nullValue - nullValue);
|
||||
print(nullValue * nullValue);
|
||||
print(nullValue / nullValue);
|
||||
print(nullValue % nullValue);
|
||||
print(nullValue < nullValue);
|
||||
print(nullValue <= nullValue);
|
||||
print(nullValue > nullValue);
|
||||
print(nullValue >= nullValue);
|
||||
print(nullValue == nullValue);
|
||||
print(nullValue === nullValue);
|
||||
print(nullValue != nullValue);
|
||||
print(nullValue !== nullValue);
|
||||
print(nullValue << nullValue);
|
||||
print(nullValue >> nullValue);
|
||||
print(nullValue >>> nullValue);
|
||||
print(nullValue | nullValue);
|
||||
print(nullValue ^ nullValue);
|
||||
|
||||
// true op true
|
||||
print("=====true op true=====")
|
||||
assert_equal(trueValue + trueValue, 2);
|
||||
assert_equal(trueValue - trueValue, 0);
|
||||
assert_equal(trueValue * trueValue, 1);
|
||||
assert_equal(trueValue / trueValue, 1);
|
||||
assert_equal(trueValue % trueValue, 0);
|
||||
assert_equal(trueValue < trueValue, falseValue);
|
||||
assert_equal(trueValue <= trueValue, trueValue);
|
||||
assert_equal(trueValue > trueValue, falseValue);
|
||||
assert_equal(trueValue >= trueValue, trueValue);
|
||||
assert_equal(trueValue == trueValue, trueValue);
|
||||
assert_equal(trueValue === trueValue, trueValue);
|
||||
assert_equal(trueValue != trueValue, falseValue);
|
||||
assert_equal(trueValue !== trueValue, falseValue);
|
||||
assert_equal(trueValue << trueValue, 2);
|
||||
assert_equal(trueValue >> trueValue, 0);
|
||||
assert_equal(trueValue >>> trueValue, 0);
|
||||
assert_equal(trueValue | trueValue, 1);
|
||||
assert_equal(trueValue ^ trueValue, 0);
|
||||
print(trueValue + trueValue);
|
||||
print(trueValue - trueValue);
|
||||
print(trueValue * trueValue);
|
||||
print(trueValue / trueValue);
|
||||
print(trueValue % trueValue);
|
||||
print(trueValue < trueValue);
|
||||
print(trueValue <= trueValue);
|
||||
print(trueValue > trueValue);
|
||||
print(trueValue >= trueValue);
|
||||
print(trueValue == trueValue);
|
||||
print(trueValue === trueValue);
|
||||
print(trueValue != trueValue);
|
||||
print(trueValue !== trueValue);
|
||||
print(trueValue << trueValue);
|
||||
print(trueValue >> trueValue);
|
||||
print(trueValue >>> trueValue);
|
||||
print(trueValue | trueValue);
|
||||
print(trueValue ^ trueValue);
|
||||
|
||||
// false op false
|
||||
print("=====false op false=====")
|
||||
assert_equal(falseValue + falseValue, 0);
|
||||
assert_equal(falseValue - falseValue, 0);
|
||||
assert_equal(falseValue * falseValue, 0);
|
||||
assert_true(isNaN(falseValue / falseValue));
|
||||
assert_true(isNaN(falseValue % falseValue));
|
||||
assert_equal(falseValue < falseValue, falseValue);
|
||||
assert_equal(falseValue <= falseValue, trueValue);
|
||||
assert_equal(falseValue > falseValue, falseValue);
|
||||
assert_equal(falseValue >= falseValue, trueValue);
|
||||
assert_equal(falseValue == falseValue, trueValue);
|
||||
assert_equal(falseValue === falseValue, trueValue);
|
||||
assert_equal(falseValue != falseValue, falseValue);
|
||||
assert_equal(falseValue !== falseValue, falseValue);
|
||||
assert_equal(falseValue << falseValue, 0);
|
||||
assert_equal(falseValue >> falseValue, 0);
|
||||
assert_equal(falseValue >>> falseValue, 0);
|
||||
assert_equal(falseValue | falseValue, 0);
|
||||
assert_equal(falseValue ^ falseValue, 0);
|
||||
print(falseValue + falseValue);
|
||||
print(falseValue - falseValue);
|
||||
print(falseValue * falseValue);
|
||||
print(falseValue / falseValue);
|
||||
print(falseValue % falseValue);
|
||||
print(falseValue < falseValue);
|
||||
print(falseValue <= falseValue);
|
||||
print(falseValue > falseValue);
|
||||
print(falseValue >= falseValue);
|
||||
print(falseValue == falseValue);
|
||||
print(falseValue === falseValue);
|
||||
print(falseValue != falseValue);
|
||||
print(falseValue !== falseValue);
|
||||
print(falseValue << falseValue);
|
||||
print(falseValue >> falseValue);
|
||||
print(falseValue >>> falseValue);
|
||||
print(falseValue | falseValue);
|
||||
print(falseValue ^ falseValue);
|
374
test/aottest/binaryop_special_value/expect_output.txt
Normal file
374
test/aottest/binaryop_special_value/expect_output.txt
Normal file
@ -0,0 +1,374 @@
|
||||
# Copyright (c) 2023 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.
|
||||
|
||||
=====int op undefined=====
|
||||
NaN
|
||||
NaN
|
||||
NaN
|
||||
NaN
|
||||
NaN
|
||||
false
|
||||
false
|
||||
false
|
||||
false
|
||||
false
|
||||
false
|
||||
true
|
||||
true
|
||||
5
|
||||
5
|
||||
5
|
||||
5
|
||||
5
|
||||
=====double op undefined=====
|
||||
NaN
|
||||
NaN
|
||||
NaN
|
||||
NaN
|
||||
NaN
|
||||
false
|
||||
false
|
||||
false
|
||||
false
|
||||
false
|
||||
false
|
||||
true
|
||||
true
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
=====false op undefined=====
|
||||
NaN
|
||||
NaN
|
||||
NaN
|
||||
NaN
|
||||
NaN
|
||||
false
|
||||
false
|
||||
false
|
||||
false
|
||||
false
|
||||
false
|
||||
true
|
||||
true
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
=====true op undefined=====
|
||||
NaN
|
||||
NaN
|
||||
NaN
|
||||
NaN
|
||||
NaN
|
||||
false
|
||||
false
|
||||
false
|
||||
false
|
||||
false
|
||||
false
|
||||
true
|
||||
true
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
=====null op undefined=====
|
||||
NaN
|
||||
NaN
|
||||
NaN
|
||||
NaN
|
||||
NaN
|
||||
false
|
||||
false
|
||||
false
|
||||
false
|
||||
true
|
||||
false
|
||||
false
|
||||
true
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
=====int op null=====
|
||||
5
|
||||
5
|
||||
0
|
||||
Infinity
|
||||
NaN
|
||||
false
|
||||
false
|
||||
true
|
||||
true
|
||||
false
|
||||
false
|
||||
true
|
||||
true
|
||||
5
|
||||
5
|
||||
5
|
||||
5
|
||||
5
|
||||
=====double op null=====
|
||||
1.1
|
||||
1.1
|
||||
0
|
||||
Infinity
|
||||
NaN
|
||||
false
|
||||
false
|
||||
true
|
||||
true
|
||||
false
|
||||
false
|
||||
true
|
||||
true
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
=====false op null=====
|
||||
0
|
||||
0
|
||||
0
|
||||
NaN
|
||||
NaN
|
||||
false
|
||||
true
|
||||
false
|
||||
true
|
||||
false
|
||||
false
|
||||
true
|
||||
true
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
=====true op null=====
|
||||
1
|
||||
1
|
||||
0
|
||||
Infinity
|
||||
NaN
|
||||
false
|
||||
false
|
||||
true
|
||||
true
|
||||
false
|
||||
false
|
||||
true
|
||||
true
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
=====int op false=====
|
||||
5
|
||||
5
|
||||
0
|
||||
Infinity
|
||||
NaN
|
||||
false
|
||||
false
|
||||
true
|
||||
true
|
||||
false
|
||||
false
|
||||
true
|
||||
true
|
||||
5
|
||||
5
|
||||
5
|
||||
5
|
||||
5
|
||||
=====double op false=====
|
||||
1.1
|
||||
1.1
|
||||
0
|
||||
Infinity
|
||||
NaN
|
||||
false
|
||||
false
|
||||
true
|
||||
true
|
||||
false
|
||||
false
|
||||
true
|
||||
true
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
=====true op false=====
|
||||
1
|
||||
1
|
||||
0
|
||||
Infinity
|
||||
NaN
|
||||
false
|
||||
false
|
||||
true
|
||||
true
|
||||
false
|
||||
false
|
||||
true
|
||||
true
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
=====int op true=====
|
||||
6
|
||||
4
|
||||
5
|
||||
5
|
||||
0
|
||||
false
|
||||
false
|
||||
true
|
||||
true
|
||||
false
|
||||
false
|
||||
true
|
||||
true
|
||||
10
|
||||
2
|
||||
2
|
||||
5
|
||||
4
|
||||
=====double op true=====
|
||||
2.1
|
||||
0.10000000000000009
|
||||
1.1
|
||||
1.1
|
||||
0.10000000000000009
|
||||
false
|
||||
false
|
||||
true
|
||||
true
|
||||
false
|
||||
false
|
||||
true
|
||||
true
|
||||
2
|
||||
0
|
||||
0
|
||||
1
|
||||
0
|
||||
=====true op false=====
|
||||
1
|
||||
1
|
||||
0
|
||||
Infinity
|
||||
NaN
|
||||
false
|
||||
false
|
||||
true
|
||||
true
|
||||
false
|
||||
false
|
||||
true
|
||||
true
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
=====undefined op undefined=====
|
||||
NaN
|
||||
NaN
|
||||
NaN
|
||||
NaN
|
||||
NaN
|
||||
false
|
||||
false
|
||||
false
|
||||
false
|
||||
true
|
||||
true
|
||||
false
|
||||
false
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
=====null op null=====
|
||||
0
|
||||
0
|
||||
0
|
||||
NaN
|
||||
NaN
|
||||
false
|
||||
true
|
||||
false
|
||||
true
|
||||
true
|
||||
true
|
||||
false
|
||||
false
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
=====true op true=====
|
||||
2
|
||||
0
|
||||
1
|
||||
1
|
||||
0
|
||||
false
|
||||
true
|
||||
false
|
||||
true
|
||||
true
|
||||
true
|
||||
false
|
||||
false
|
||||
2
|
||||
0
|
||||
0
|
||||
1
|
||||
0
|
||||
=====false op false=====
|
||||
0
|
||||
0
|
||||
0
|
||||
NaN
|
||||
NaN
|
||||
false
|
||||
true
|
||||
false
|
||||
true
|
||||
true
|
||||
true
|
||||
false
|
||||
false
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
@ -13,6 +13,6 @@
|
||||
|
||||
import("//arkcompiler/ets_runtime/test/test_helper.gni")
|
||||
|
||||
host_aot_assert_test_action("bind") {
|
||||
host_aot_test_action("bind") {
|
||||
deps = []
|
||||
}
|
||||
|
@ -13,17 +13,17 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
declare function assert_equal(a: Object, b: Object):void;
|
||||
declare function print(arg:any):string;
|
||||
|
||||
function foo(a:any, b:any) {
|
||||
return a + b
|
||||
}
|
||||
|
||||
assert_equal(foo(1, 2), 3);
|
||||
print(foo(1, 2));
|
||||
|
||||
var bindfunc = foo.bind(null, 37);
|
||||
|
||||
assert_equal(bindfunc(5), 42)
|
||||
print(bindfunc(5));
|
||||
|
||||
const person = {
|
||||
name: 'Alice'
|
||||
@ -33,15 +33,15 @@ const greetPerson = function aaaaaa(message, message2, message3, message4) {
|
||||
print(message + ', ' + message2 + ', ' + message3 + ', ' + message4 + ', ' + this.name + '!');
|
||||
}.bind(person, 'hello');
|
||||
greetPerson();
|
||||
assert_equal(greetPerson.name, "bound aaaaaa");
|
||||
assert_equal(greetPerson.length, 3);
|
||||
print(greetPerson.name);
|
||||
print(greetPerson.length);
|
||||
|
||||
const greetPerson2 = greetPerson.bind(person, 'hello2');
|
||||
greetPerson2();
|
||||
assert_equal(greetPerson2.name, "bound bound aaaaaa");
|
||||
assert_equal(greetPerson2.length, 2);
|
||||
print(greetPerson2.name);
|
||||
print(greetPerson2.length);
|
||||
|
||||
const greetPerson3 = greetPerson2.bind(greetPerson, 'hello3');
|
||||
greetPerson3();
|
||||
assert_equal(greetPerson3.name, "bound bound bound aaaaaa");
|
||||
assert_equal(greetPerson3.length, 1);
|
||||
print(greetPerson3.name);
|
||||
print(greetPerson3.length);
|
24
test/aottest/bind/expect_output.txt
Normal file
24
test/aottest/bind/expect_output.txt
Normal file
@ -0,0 +1,24 @@
|
||||
# Copyright (c) 2022 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.
|
||||
|
||||
3
|
||||
42
|
||||
hello, undefined, undefined, undefined, Alice!
|
||||
bound aaaaaa
|
||||
3
|
||||
hello, hello2, undefined, undefined, Alice!
|
||||
bound bound aaaaaa
|
||||
2
|
||||
hello, hello2, hello3, undefined, Alice!
|
||||
bound bound bound aaaaaa
|
||||
1
|
@ -13,6 +13,6 @@
|
||||
|
||||
import("//arkcompiler/ets_runtime/test/test_helper.gni")
|
||||
|
||||
host_aot_assert_test_action("builtinmath") {
|
||||
host_aot_test_action("builtinmath") {
|
||||
deps = []
|
||||
}
|
||||
|
@ -14,125 +14,123 @@
|
||||
*/
|
||||
|
||||
declare function print(arg:any):string;
|
||||
declare function assert_true(condition: boolean):void;
|
||||
declare function assert_equal(a: Object, b: Object):void;
|
||||
function replace(a : number)
|
||||
{
|
||||
return a;
|
||||
}
|
||||
let len:number = 1;
|
||||
len = 1 / Math.sqrt(len);
|
||||
assert_equal(len, 1);
|
||||
print(len);
|
||||
|
||||
len = 9 / len;
|
||||
len = Math.sqrt(len);
|
||||
assert_equal(len, 3);
|
||||
print(len);
|
||||
print(NaN);
|
||||
len = Math.sqrt(NaN);
|
||||
assert_true(isNaN(len));
|
||||
print(len);
|
||||
|
||||
len = Math.sqrt(+0); // 0
|
||||
assert_equal(len, 0);
|
||||
print(len);
|
||||
len = Math.sqrt(Number.POSITIVE_INFINITY); // Infinity
|
||||
assert_equal(len, Infinity);
|
||||
print(len);
|
||||
len = Math.sqrt(Number.NEGATIVE_INFINITY); // NaN
|
||||
assert_true(isNaN(len));
|
||||
print(len);
|
||||
len = Math.sqrt(-1); // NaN
|
||||
assert_true(isNaN(len));
|
||||
print(len);
|
||||
function sqrt()
|
||||
{
|
||||
Math.sqrt = replace;
|
||||
len = Math.sqrt(9)
|
||||
assert_equal(len, 9);
|
||||
print(len);
|
||||
}
|
||||
sqrt()
|
||||
|
||||
len = Math.cos(0); // 1
|
||||
assert_equal(len, 1);
|
||||
print(len);
|
||||
len = Math.cos(1); // 0.5....
|
||||
assert_equal(len, 0.5403023058681398);
|
||||
print(len);
|
||||
function cos()
|
||||
{
|
||||
Math.cos = replace;
|
||||
len = Math.cos(1);
|
||||
assert_equal(len, 1);
|
||||
print(len);
|
||||
}
|
||||
cos()
|
||||
|
||||
len = Math.sin(0); // 0
|
||||
assert_equal(len, 0);
|
||||
print(len);
|
||||
len = Math.sin(1); // 0.84
|
||||
assert_equal(len, 0.8414709848078965);
|
||||
print(len);
|
||||
len = Math.sin(Math.PI / 2);
|
||||
assert_equal(len, 1);
|
||||
print(len);
|
||||
function sin()
|
||||
{
|
||||
Math.sin = replace;
|
||||
len = Math.sin(1)
|
||||
assert_equal(len, 1);
|
||||
print(len);
|
||||
}
|
||||
sin()
|
||||
|
||||
len = Math.acos(0.5);// 1.0471975511965979
|
||||
assert_equal(len, 1.0471975511965979);
|
||||
print(len);
|
||||
function acos()
|
||||
{
|
||||
Math.acos = replace
|
||||
len = Math.acos(0.5)
|
||||
assert_equal(len, 0.5);
|
||||
print(len);
|
||||
}
|
||||
acos()
|
||||
|
||||
len = Math.atan(2); // 1.1071487177940904
|
||||
assert_equal(len, 1.1071487177940904);
|
||||
print(len);
|
||||
function atan()
|
||||
{
|
||||
Math.atan = replace
|
||||
len = Math.atan(2)
|
||||
assert_equal(len, 2);
|
||||
print(len);
|
||||
}
|
||||
atan()
|
||||
|
||||
len = Math.abs(Number.NaN);
|
||||
assert_true(isNaN(len));
|
||||
print(len);
|
||||
len = Math.abs(-Number.NaN);
|
||||
assert_true(isNaN(len));
|
||||
print(len);
|
||||
len = Math.abs(Number.NEGATIVE_INFINITY);
|
||||
assert_equal(len, Infinity);
|
||||
print(len);
|
||||
len = Math.abs(Number.POSITIVE_INFINITY);
|
||||
assert_equal(len, Infinity);
|
||||
print(len);
|
||||
len = Math.abs(9.6);
|
||||
assert_equal(len, 9.6);
|
||||
print(len);
|
||||
len = Math.abs(6);
|
||||
assert_equal(len, 6);
|
||||
print(len);
|
||||
len = Math.abs(-9.6);
|
||||
assert_equal(len, 9.6);
|
||||
print(len);
|
||||
len = Math.abs(-6);
|
||||
assert_equal(len, 6);
|
||||
print(len);
|
||||
function abs()
|
||||
{
|
||||
Math.abs = replace
|
||||
len = Math.abs(-9.6)
|
||||
assert_equal(len, -9.6);
|
||||
print(len);
|
||||
}
|
||||
abs()
|
||||
|
||||
len = Math.floor(Number.NaN);
|
||||
assert_true(isNaN(len));
|
||||
print(len);
|
||||
len = Math.floor(-Number.NaN);
|
||||
assert_true(isNaN(len));
|
||||
print(len);
|
||||
len = Math.floor(Number.NEGATIVE_INFINITY);
|
||||
assert_equal(len, -Infinity);
|
||||
print(len);
|
||||
len = Math.floor(Number.POSITIVE_INFINITY);
|
||||
assert_equal(len, Infinity);
|
||||
print(len);
|
||||
len = Math.floor(9.6);
|
||||
assert_equal(len, 9);
|
||||
print(len);
|
||||
len = Math.floor(-9.6);
|
||||
assert_equal(len, -10);
|
||||
print(len);
|
||||
function floor()
|
||||
{
|
||||
Math.floor = replace
|
||||
len = Math.floor(-9.6)
|
||||
assert_equal(len, -9.6);
|
||||
print(len);
|
||||
}
|
||||
floor()
|
||||
|
49
test/aottest/builtinmath/expect_output.txt
Normal file
49
test/aottest/builtinmath/expect_output.txt
Normal file
@ -0,0 +1,49 @@
|
||||
# Copyright (c) 2022 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.
|
||||
|
||||
1
|
||||
3
|
||||
NaN
|
||||
NaN
|
||||
0
|
||||
Infinity
|
||||
NaN
|
||||
NaN
|
||||
9
|
||||
1
|
||||
0.5403023058681398
|
||||
1
|
||||
0
|
||||
0.8414709848078965
|
||||
1
|
||||
1
|
||||
1.0471975511965979
|
||||
0.5
|
||||
1.1071487177940904
|
||||
2
|
||||
NaN
|
||||
NaN
|
||||
Infinity
|
||||
Infinity
|
||||
9.6
|
||||
6
|
||||
9.6
|
||||
6
|
||||
-9.6
|
||||
NaN
|
||||
NaN
|
||||
-Infinity
|
||||
Infinity
|
||||
9
|
||||
-10
|
||||
-9.6
|
@ -13,6 +13,6 @@
|
||||
|
||||
import("//arkcompiler/ets_runtime/test/test_helper.gni")
|
||||
|
||||
host_aot_assert_test_action("call_same_bytecode_func") {
|
||||
host_aot_test_action("call_same_bytecode_func") {
|
||||
deps = []
|
||||
}
|
||||
|
@ -13,7 +13,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
declare function print(str:any):string;
|
||||
declare function assert_equal(a: Object, b: Object):void;
|
||||
|
||||
function foo1(a:string, b:string)
|
||||
{
|
||||
@ -34,8 +33,8 @@ function foo4()
|
||||
{
|
||||
print("hello");
|
||||
}
|
||||
assert_equal(foo2(3, 4), 7);
|
||||
assert_equal(foo1("1", "2"), "12");
|
||||
print(foo2(3, 4));
|
||||
print(foo1("1", "2"));
|
||||
|
||||
foo3();
|
||||
foo4();
|
17
test/aottest/call_same_bytecode_func/expect_output.txt
Normal file
17
test/aottest/call_same_bytecode_func/expect_output.txt
Normal file
@ -0,0 +1,17 @@
|
||||
# Copyright (c) 2022 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.
|
||||
|
||||
7
|
||||
12
|
||||
hello
|
||||
hello
|
@ -13,6 +13,6 @@
|
||||
|
||||
import("//arkcompiler/ets_runtime/test/test_helper.gni")
|
||||
|
||||
host_aot_assert_test_action("callithisrange") {
|
||||
host_aot_test_action("callithisrange") {
|
||||
deps = []
|
||||
}
|
||||
|
14
test/aottest/callithisrange/expect_output.txt
Normal file
14
test/aottest/callithisrange/expect_output.txt
Normal file
@ -0,0 +1,14 @@
|
||||
# Copyright (c) 2022 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.
|
||||
|
||||
pass
|
@ -13,6 +13,6 @@
|
||||
|
||||
import("//arkcompiler/ets_runtime/test/test_helper.gni")
|
||||
|
||||
host_aot_assert_test_action("calls") {
|
||||
host_aot_test_action("calls") {
|
||||
deps = []
|
||||
}
|
||||
|
@ -13,7 +13,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
declare function print(str: any): string;
|
||||
declare function assert_equal(a: Object, b: Object):void;
|
||||
declare var ArkTools:any;
|
||||
function foo() {
|
||||
return "pass";
|
||||
@ -35,91 +34,67 @@ function foo4(a: any, b: any, c: any, d: any) {
|
||||
return a + b + c + d;
|
||||
}
|
||||
|
||||
assert_equal(foo(), "pass");
|
||||
assert_equal(foo1(1), 2);
|
||||
assert_equal(foo1(1), 2);
|
||||
assert_equal(foo1(1), 2);
|
||||
assert_equal(foo2(1, 2), 3);
|
||||
assert_equal(foo3(1, 2, 3), 6);
|
||||
assert_equal(foo4(1, 2, 3, 4), 10);
|
||||
print(foo());
|
||||
print(foo1(1));
|
||||
print(foo1(1));
|
||||
print(foo1(1));
|
||||
print(foo2(1, 2));
|
||||
print(foo3(1, 2, 3));
|
||||
print(foo4(1, 2, 3, 4));
|
||||
|
||||
var classTestNameA = "unassigned";
|
||||
var classTestNumA1 = -1;
|
||||
var classTestNumA2 = -1;
|
||||
class A {
|
||||
public mode: number = 1;
|
||||
|
||||
constructor(dt: number) {
|
||||
classTestNumA1 = dt;
|
||||
classTestNameA = new.target.name;
|
||||
print(dt);
|
||||
print(new.target.name);
|
||||
const size = 50;
|
||||
this.mode = 4;
|
||||
}
|
||||
|
||||
update (dt: number, dt1: number): void {
|
||||
classTestNumA1 = dt;
|
||||
classTestNumA2 = dt1;
|
||||
print(dt);
|
||||
print(dt1);
|
||||
}
|
||||
}
|
||||
|
||||
var classTestNameB = "unassigned";
|
||||
var classTestNumB1 = -1;
|
||||
var classTestNumB2 = -1;
|
||||
var classTestNumB3 = -1;
|
||||
class B {
|
||||
public mode: number = 1;
|
||||
|
||||
constructor(dt: number, dt1: number, dt2: number) {
|
||||
classTestNumB1 = dt;
|
||||
classTestNumB2 = dt1;
|
||||
classTestNumB3 = dt2;
|
||||
classTestNameB = new.target.name;
|
||||
print(dt);
|
||||
print(dt1);
|
||||
print(dt2);
|
||||
print(new.target.name);
|
||||
const size = 50;
|
||||
this.mode = 4;
|
||||
}
|
||||
}
|
||||
|
||||
var classTestNameC = "unassigned";
|
||||
var classTestNumC1 = -1;
|
||||
var classTestNumC2 = -1;
|
||||
var classTestNumC3 = -1;
|
||||
var classTestNumC4 = -1;
|
||||
var classTestNumC5 = -1;
|
||||
var classTestNumC6 = -1;
|
||||
var classTestNumC7 = -1;
|
||||
var classTestNumC8 = -1;
|
||||
class C {
|
||||
public mode: number = 1;
|
||||
|
||||
constructor(dt: number, dt1: number, dt2: number, dt3: number, dt4: number, dt5: number, dt6: number, dt7: number) {
|
||||
classTestNameC = new.target.name;
|
||||
classTestNumC1 = dt;
|
||||
classTestNumC2 = dt1;
|
||||
classTestNumC5 = dt4;
|
||||
classTestNumC7 = dt6;
|
||||
classTestNumC8 = dt7;
|
||||
print(new.target.name);
|
||||
print(dt);
|
||||
print(dt1);
|
||||
print(dt4);
|
||||
print(dt6);
|
||||
print(dt7);
|
||||
const size = 50;
|
||||
this.mode = 4;
|
||||
}
|
||||
}
|
||||
|
||||
var funcvTestNum1 = -1;
|
||||
var funcvTestNum2 = -1;
|
||||
var funcvTestNum3 = -1;
|
||||
var funcvTestNum4 = -1;
|
||||
var funcvTestNum5 = -1;
|
||||
var funcvTestNum6 = -1;
|
||||
var funcvTestNum7 = -1;
|
||||
var funcvTestNum8 = -1;
|
||||
function funcv(value: number, value1: number, value2: number, value3: number, value4: number, value5: number, value6: number, value7: number): number {
|
||||
funcvTestNum1 = value;
|
||||
funcvTestNum2 = value1;
|
||||
funcvTestNum3 = value2;
|
||||
funcvTestNum4 = value3;
|
||||
funcvTestNum5 = value4;
|
||||
funcvTestNum6 = value5;
|
||||
funcvTestNum7 = value6;
|
||||
funcvTestNum8 = value7;
|
||||
print(value);
|
||||
print(value1);
|
||||
print(value2);
|
||||
print(value3);
|
||||
print(value4);
|
||||
print(value5);
|
||||
print(value6);
|
||||
print(value7);
|
||||
return 100;
|
||||
}
|
||||
|
||||
@ -127,157 +102,69 @@ function func0(): number {
|
||||
return 110;
|
||||
}
|
||||
|
||||
var func1TestNum = -1;
|
||||
function func1(value: number): number {
|
||||
func1TestNum = value;
|
||||
print(value);
|
||||
return value;
|
||||
}
|
||||
|
||||
var func2TestNum1 = -1;
|
||||
var func2TestNum2 = -1;
|
||||
function func2(value: number, value1: number): number {
|
||||
func2TestNum1 = value;
|
||||
func2TestNum2 = value1;
|
||||
print(value);
|
||||
print(value1);
|
||||
return value;
|
||||
}
|
||||
|
||||
var func3TestNum1 = -1;
|
||||
var func3TestNum2 = -1;
|
||||
var func3TestNum3 = -1;
|
||||
function func3(value: number, value1: number, value2: number): number {
|
||||
func3TestNum1 = value;
|
||||
func3TestNum2 = value1;
|
||||
func3TestNum3 = value2;
|
||||
print(value);
|
||||
print(value1);
|
||||
print(value2);
|
||||
func1(value);
|
||||
return value;
|
||||
}
|
||||
|
||||
var func4TestNum1 = -1;
|
||||
var func4TestNum2 = -1;
|
||||
var func4TestNum3 = -1;
|
||||
var func4TestNum4 = -1;
|
||||
function func4(value: number, value1: number, value2: number, value3: number): number {
|
||||
func4TestNum1 = value;
|
||||
func4TestNum2 = value1;
|
||||
func4TestNum3 = value2;
|
||||
func4TestNum4 = value3;
|
||||
print(value);
|
||||
print(value1);
|
||||
print(value2);
|
||||
print(value3);
|
||||
return value;
|
||||
}
|
||||
|
||||
var classTestName = "unassigned";
|
||||
function testNewTarget(value: number): number {
|
||||
classTestName = new.target.name;
|
||||
print(new.target.name);
|
||||
return value;
|
||||
}
|
||||
var systems: A = new A(1);
|
||||
assert_equal(classTestNumA1, 1);
|
||||
assert_equal(classTestNameA, "A");
|
||||
var systems1: B = new B(2, 3);
|
||||
assert_equal(classTestNumB1, 2);
|
||||
assert_equal(classTestNumB2, 3);
|
||||
assert_equal(classTestNumB3, undefined);
|
||||
assert_equal(classTestNameB, "B");
|
||||
var systems2: C = new C(3, 4, 5, 6, 7, 8);
|
||||
assert_equal(classTestNameC, "C");
|
||||
assert_equal(classTestNumC1, 3);
|
||||
assert_equal(classTestNumC2, 4);
|
||||
assert_equal(classTestNumC5, 7);
|
||||
assert_equal(classTestNumC7, undefined);
|
||||
assert_equal(classTestNumC8, undefined);
|
||||
assert_equal(func0(), 110);
|
||||
print(func0());
|
||||
func1();
|
||||
assert_equal(func1TestNum, undefined);
|
||||
func2(1);
|
||||
assert_equal(func2TestNum1, 1);
|
||||
assert_equal(func2TestNum2, undefined);
|
||||
func3("mytest", 2);
|
||||
assert_equal(func3TestNum1, "mytest");
|
||||
assert_equal(func3TestNum2, 2);
|
||||
assert_equal(func3TestNum3, undefined);
|
||||
assert_equal(func1TestNum, "mytest");
|
||||
func4(3, 4, 5);
|
||||
assert_equal(func4TestNum1, 3);
|
||||
assert_equal(func4TestNum2, 4);
|
||||
assert_equal(func4TestNum3, 5);
|
||||
assert_equal(func4TestNum4, undefined);
|
||||
funcv(6, 7 , 8, 9);
|
||||
assert_equal(funcvTestNum1, 6);
|
||||
assert_equal(funcvTestNum2, 7);
|
||||
assert_equal(funcvTestNum3, 8);
|
||||
assert_equal(funcvTestNum4, 9)
|
||||
assert_equal(funcvTestNum5, undefined);
|
||||
assert_equal(funcvTestNum6, undefined);
|
||||
assert_equal(funcvTestNum7, undefined);
|
||||
assert_equal(funcvTestNum8, undefined)
|
||||
systems.update(4);
|
||||
assert_equal(classTestNumA1, 4)
|
||||
assert_equal(classTestNumA2, undefined);
|
||||
var k = new testNewTarget(1);
|
||||
assert_equal(classTestName, "testNewTarget");
|
||||
|
||||
var funcAsmTestNum1 = -1;
|
||||
var funcAsmTestNum2 = -1;
|
||||
var funcAsmTestNum3 = -1;
|
||||
function funcAsm(value: number, value1: number, value2: number): number {
|
||||
funcAsmTestNum1 = value;
|
||||
funcAsmTestNum2 = value1;
|
||||
funcAsmTestNum3 = value2;
|
||||
print(value);
|
||||
print(value1);
|
||||
print(value2);
|
||||
func2(value1, value2);
|
||||
assert_equal(func2TestNum1, 2);
|
||||
assert_equal(func2TestNum2, undefined);
|
||||
func3(value1, value2);
|
||||
assert_equal(func3TestNum1, 2);
|
||||
assert_equal(func3TestNum2, undefined);
|
||||
assert_equal(func3TestNum3, undefined);
|
||||
assert_equal(func1TestNum, 2);
|
||||
func4(value1);
|
||||
assert_equal(func4TestNum1, 2);
|
||||
assert_equal(func4TestNum2, undefined);
|
||||
assert_equal(func4TestNum3, undefined);
|
||||
assert_equal(func4TestNum4, undefined);
|
||||
funcv(value, value1, value2, value);
|
||||
assert_equal(funcvTestNum1, 1);
|
||||
assert_equal(funcvTestNum2, 2);
|
||||
assert_equal(funcvTestNum3, undefined);
|
||||
assert_equal(funcvTestNum4, 1);
|
||||
assert_equal(funcvTestNum5, undefined);
|
||||
assert_equal(funcvTestNum6, undefined);
|
||||
assert_equal(funcvTestNum7, undefined);
|
||||
assert_equal(funcvTestNum8, undefined);
|
||||
var s: A = new A(1, 4);
|
||||
assert_equal(classTestNumA1, 1);
|
||||
assert_equal(classTestNameA, "A");
|
||||
var s1: B = new B(2, 3);
|
||||
assert_equal(classTestNumB1, 2);
|
||||
assert_equal(classTestNumB2, 3);
|
||||
assert_equal(classTestNumB3, undefined);
|
||||
assert_equal(classTestNameB, "B");
|
||||
var s2: C = new C(3, 4, 5, 6, 7, 8);
|
||||
assert_equal(classTestNameC, "C");
|
||||
assert_equal(classTestNumC1, 3);
|
||||
assert_equal(classTestNumC2, 4);
|
||||
assert_equal(classTestNumC5, 7);
|
||||
assert_equal(classTestNumC7, undefined);
|
||||
assert_equal(classTestNumC8, undefined);
|
||||
var s3: C = new C(3, 4, 5, 6, 7, 8, 9, 10);
|
||||
assert_equal(classTestNameC, "C");
|
||||
assert_equal(classTestNumC1, 3);
|
||||
assert_equal(classTestNumC2, 4);
|
||||
assert_equal(classTestNumC5, 7);
|
||||
assert_equal(classTestNumC7, 9);
|
||||
assert_equal(classTestNumC8, 10);
|
||||
return value;
|
||||
}
|
||||
ArkTools.removeAOTFlag(funcAsm);
|
||||
funcAsm(1, 2);
|
||||
assert_equal(funcAsmTestNum1, 1);
|
||||
assert_equal(funcAsmTestNum2, 2);
|
||||
assert_equal(funcAsmTestNum3, undefined);
|
||||
|
||||
var TestCallArg = "unassigned";
|
||||
class TestCallThis0 {
|
||||
foo(arg?: any) {
|
||||
TestCallArg = arg;
|
||||
print(arg);
|
||||
}
|
||||
}
|
||||
|
||||
@ -287,4 +174,3 @@ function testCallThis0() {
|
||||
}
|
||||
|
||||
testCallThis0();
|
||||
assert_equal(TestCallArg, undefined);
|
||||
|
95
test/aottest/calls/expect_output.txt
Normal file
95
test/aottest/calls/expect_output.txt
Normal file
@ -0,0 +1,95 @@
|
||||
# Copyright (c) 2022 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.
|
||||
|
||||
pass
|
||||
2
|
||||
2
|
||||
2
|
||||
3
|
||||
6
|
||||
10
|
||||
1
|
||||
A
|
||||
2
|
||||
3
|
||||
undefined
|
||||
B
|
||||
C
|
||||
3
|
||||
4
|
||||
7
|
||||
undefined
|
||||
undefined
|
||||
110
|
||||
undefined
|
||||
1
|
||||
undefined
|
||||
mytest
|
||||
2
|
||||
undefined
|
||||
mytest
|
||||
3
|
||||
4
|
||||
5
|
||||
undefined
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
undefined
|
||||
undefined
|
||||
undefined
|
||||
undefined
|
||||
4
|
||||
undefined
|
||||
testNewTarget
|
||||
1
|
||||
2
|
||||
undefined
|
||||
2
|
||||
undefined
|
||||
2
|
||||
undefined
|
||||
undefined
|
||||
2
|
||||
2
|
||||
undefined
|
||||
undefined
|
||||
undefined
|
||||
1
|
||||
2
|
||||
undefined
|
||||
1
|
||||
undefined
|
||||
undefined
|
||||
undefined
|
||||
undefined
|
||||
1
|
||||
A
|
||||
2
|
||||
3
|
||||
undefined
|
||||
B
|
||||
C
|
||||
3
|
||||
4
|
||||
7
|
||||
undefined
|
||||
undefined
|
||||
C
|
||||
3
|
||||
4
|
||||
7
|
||||
9
|
||||
10
|
||||
undefined
|
@ -13,6 +13,6 @@
|
||||
|
||||
import("//arkcompiler/ets_runtime/test/test_helper.gni")
|
||||
|
||||
host_aot_assert_test_action("class_method_signature") {
|
||||
host_aot_test_action("class_method_signature") {
|
||||
deps = []
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
declare function assert_equal(a: Object, b: Object):void;
|
||||
declare function print(str:any):string;
|
||||
|
||||
class A {
|
||||
constructor() {}
|
||||
@ -30,9 +30,9 @@ class A {
|
||||
}
|
||||
|
||||
let a = new A();
|
||||
assert_equal(a.bar(), "bar");
|
||||
assert_equal(a.bar2(), "bar2");
|
||||
assert_equal(Reflect.ownKeys(A.prototype), ["constructor", "bar", "bar2"]); //constructor,bar,bar2
|
||||
print(a.bar());
|
||||
print(a.bar2());
|
||||
print(Reflect.ownKeys(A.prototype)); //constructor,bar,bar2
|
||||
|
||||
class A2 {
|
||||
constructor() {}
|
||||
@ -52,10 +52,10 @@ class A2 {
|
||||
}
|
||||
|
||||
let a2 = new A2();
|
||||
assert_equal(a2.foo(), "foo");
|
||||
assert_equal(a2.bar(), "bar");
|
||||
assert_equal(a2.bar2(), "bar2");
|
||||
assert_equal(Reflect.ownKeys(A2.prototype), ["constructor", "foo", "bar", "bar2"]); //constructor,foo,bar,bar2
|
||||
print(a2.foo());
|
||||
print(a2.bar());
|
||||
print(a2.bar2());
|
||||
print(Reflect.ownKeys(A2.prototype)); //constructor,foo,bar,bar2
|
||||
|
||||
|
||||
class B {
|
||||
@ -73,9 +73,9 @@ class B {
|
||||
}
|
||||
|
||||
let b = new B();
|
||||
assert_equal(b.bar(), "bar");
|
||||
assert_equal(b.bar2(), "bar2");
|
||||
assert_equal(Reflect.ownKeys(B.prototype), ["constructor", "bar", "bar2"]); //constructor,bar,bar2
|
||||
print(b.bar());
|
||||
print(b.bar2());
|
||||
print(Reflect.ownKeys(B.prototype)); //constructor,bar,bar2
|
||||
|
||||
class B2 {
|
||||
constructor() {}
|
||||
@ -95,10 +95,10 @@ class B2 {
|
||||
}
|
||||
|
||||
let b2 = new B2();
|
||||
assert_equal(b2.foo(), "foo");
|
||||
assert_equal(b2.bar(), "bar");
|
||||
assert_equal(b2.bar2(), "bar2");
|
||||
assert_equal(Reflect.ownKeys(B2.prototype), ["constructor", "bar", "foo", "bar2"]); //constructor,bar,foo,bar2
|
||||
print(b2.foo());
|
||||
print(b2.bar());
|
||||
print(b2.bar2());
|
||||
print(Reflect.ownKeys(B2.prototype)); //constructor,bar,foo,bar2
|
||||
|
||||
// one signature but no body
|
||||
class C {
|
||||
@ -112,7 +112,7 @@ class C {
|
||||
}
|
||||
|
||||
let c = new C();
|
||||
assert_equal(c.bar(), "test one signature but no body");
|
||||
print(c.bar());
|
||||
|
||||
// multi-signatures but one body
|
||||
class D {
|
||||
@ -132,8 +132,8 @@ class D {
|
||||
}
|
||||
|
||||
let d = new D();
|
||||
assert_equal(d.foo!("D"), "D");
|
||||
assert_equal(d.bar(), "test multi-signatures but one body");
|
||||
print(d.foo!("D"));
|
||||
print(d.bar());
|
||||
|
||||
// multi-signature but no body.
|
||||
class E {
|
||||
@ -155,6 +155,6 @@ E.prototype.foo = function(): string {
|
||||
}
|
||||
|
||||
let e = new E();
|
||||
assert_equal(e.foo!(), "E");
|
||||
assert_equal(e.bar(), "test multi-signatures but no body");
|
||||
print(e.foo!());
|
||||
print(e.bar());
|
||||
|
||||
|
32
test/aottest/class_method_signature/expect_output.txt
Normal file
32
test/aottest/class_method_signature/expect_output.txt
Normal file
@ -0,0 +1,32 @@
|
||||
# Copyright (c) 2023 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.
|
||||
|
||||
bar
|
||||
bar2
|
||||
constructor,bar,bar2
|
||||
foo
|
||||
bar
|
||||
bar2
|
||||
constructor,foo,bar,bar2
|
||||
bar
|
||||
bar2
|
||||
constructor,bar,bar2
|
||||
foo
|
||||
bar
|
||||
bar2
|
||||
constructor,bar,foo,bar2
|
||||
test one signature but no body
|
||||
D
|
||||
test multi-signatures but one body
|
||||
E
|
||||
test multi-signatures but no body
|
@ -13,6 +13,6 @@
|
||||
|
||||
import("//arkcompiler/ets_runtime/test/test_helper.gni")
|
||||
|
||||
host_aot_assert_test_action("classstatic") {
|
||||
host_aot_test_action("classstatic") {
|
||||
deps = []
|
||||
}
|
||||
|
@ -13,28 +13,24 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
declare function print(arg:any, arg1?:any):string;
|
||||
declare function assert_unreachable():void;
|
||||
declare function assert_equal(a: Object, b: Object):void;
|
||||
|
||||
var cpuTestNum1 = -1;
|
||||
var cpuTestNum2 = -1;
|
||||
class cpu {
|
||||
public mode: number = 1;
|
||||
constructor() {
|
||||
this.mode = 4;
|
||||
}
|
||||
public static add(a: number, b: number): number {
|
||||
cpuTestNum1 = a;
|
||||
print(a);
|
||||
cpu.sub(a, b);
|
||||
var out : number = a + b;
|
||||
return out;
|
||||
}
|
||||
get kind() {
|
||||
assert_equal(this.mode, 4);
|
||||
print(this.mode);
|
||||
return this.mode;
|
||||
}
|
||||
public static sub(a: number, b: number): number {
|
||||
cpuTestNum2 = b;
|
||||
print(b);
|
||||
var out : number = a + b;
|
||||
return out;
|
||||
}
|
||||
@ -189,7 +185,7 @@ class cpu1 {
|
||||
}
|
||||
|
||||
get kind() {
|
||||
return this.mode;
|
||||
print(this.mode);
|
||||
}
|
||||
static Constant = 1;
|
||||
static Curve = 2;
|
||||
@ -199,23 +195,19 @@ class cpu1 {
|
||||
function foo():number {
|
||||
return cpu.Curve;
|
||||
}
|
||||
assert_equal(foo(), 2);
|
||||
print(foo());
|
||||
cpu.add(1, 3);
|
||||
assert_equal(cpuTestNum1, 1);
|
||||
assert_equal(cpuTestNum2, 3);
|
||||
var systems: cpu = new cpu();
|
||||
assert_equal(systems.kind, 4);
|
||||
print(systems.kind);
|
||||
cpu.sub(1, 4);
|
||||
assert_equal(cpuTestNum2, 4);
|
||||
assert_equal(cpu1.TwoC, 3);
|
||||
assert_equal(cpu1.length, 0);
|
||||
print(cpu1.TwoC);
|
||||
print(cpu1.length);
|
||||
cpu1.color();
|
||||
|
||||
try {
|
||||
cpu1.length = 4;
|
||||
assert_unreachable();
|
||||
} catch (e) {
|
||||
assert_equal(e.message, "Cannot assign to read only property")
|
||||
print(e)
|
||||
}
|
||||
|
||||
class Info {
|
||||
@ -238,7 +230,7 @@ class Shape {
|
||||
}
|
||||
func1(a:any,...A:any) : void {
|
||||
for (let p in A) {
|
||||
assert_equal(A[p], 2);
|
||||
print(A[p]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -313,11 +305,11 @@ class Node{
|
||||
while (el) {
|
||||
var map = el.map;
|
||||
if (map == names) {
|
||||
assert_equal(map, "hh")
|
||||
print(map)
|
||||
}
|
||||
el = el.nodeType == 1 ? el.childNode : el.parentNode;
|
||||
const tmp = Node.Constant;
|
||||
assert_equal(el, null);
|
||||
print(el);
|
||||
}
|
||||
}
|
||||
|
||||
|
30
test/aottest/classstatic/expect_output.txt
Normal file
30
test/aottest/classstatic/expect_output.txt
Normal file
@ -0,0 +1,30 @@
|
||||
# Copyright (c) 2022 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.
|
||||
|
||||
2
|
||||
1
|
||||
3
|
||||
4
|
||||
4
|
||||
4
|
||||
3
|
||||
0
|
||||
method is ok
|
||||
TypeError: Cannot assign to read only property
|
||||
intersect
|
||||
func1
|
||||
intersect
|
||||
func1
|
||||
2
|
||||
hh
|
||||
null
|
@ -13,6 +13,6 @@
|
||||
|
||||
import("//arkcompiler/ets_runtime/test/test_helper.gni")
|
||||
|
||||
host_aot_assert_test_action("closeiterator") {
|
||||
host_aot_test_action("closeiterator") {
|
||||
deps = []
|
||||
}
|
||||
|
14
test/aottest/closeiterator/expect_output.txt
Normal file
14
test/aottest/closeiterator/expect_output.txt
Normal file
@ -0,0 +1,14 @@
|
||||
# Copyright (c) 2022 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.
|
||||
|
||||
pass
|
@ -13,6 +13,6 @@
|
||||
|
||||
import("//arkcompiler/ets_runtime/test/test_helper.gni")
|
||||
|
||||
host_aot_assert_test_action("compiler_test") {
|
||||
host_aot_test_action("compiler_test") {
|
||||
deps = []
|
||||
}
|
||||
|
@ -13,8 +13,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
declare function print(str:any):string;
|
||||
declare function assert_unreachable():void;
|
||||
declare function assert_equal(a: Object, b: Object):void;
|
||||
|
||||
// case1: CREATEOBJECTWITHEXCLUDEDKEYS
|
||||
const o4 : {} = {
|
||||
@ -39,7 +37,6 @@ function f1() {
|
||||
return
|
||||
try {
|
||||
f()
|
||||
assert_unreachable();
|
||||
} catch(e) {
|
||||
}
|
||||
}
|
||||
@ -48,7 +45,6 @@ function f1() {
|
||||
function f2() {
|
||||
try {
|
||||
return
|
||||
assert_unreachable();
|
||||
} catch(e15) {
|
||||
}
|
||||
while(1) {}
|
||||
@ -63,7 +59,7 @@ const v75 : number = new C60()
|
||||
function f230():string {
|
||||
const v292:number = -2;
|
||||
const v303:number[] = [1000,-1970969808,536870887,257,17933,11,1024];
|
||||
try { new v292(64, ...v303, ...v303, ...v303, ...v303); assert_unreachable(); } catch (e) {}
|
||||
try { new v292(64, ...v303, ...v303, ...v303, ...v303); } catch (e) {}
|
||||
return "bigint";
|
||||
}
|
||||
for (let v316:number = 0; v316 < 5; v316++) {
|
||||
@ -77,7 +73,6 @@ try {
|
||||
[a1718];
|
||||
static [v1705] = a1719;
|
||||
}
|
||||
assert_unreachable();
|
||||
} catch (e) {}
|
||||
|
||||
// case8: stackmapNum % 2
|
||||
@ -87,9 +82,9 @@ v39++;
|
||||
|
||||
// case9: this branch is unreachable
|
||||
let v:number = [];
|
||||
assert_equal(Math.abs(--v), 1);
|
||||
assert_equal(v, -1);
|
||||
print(Math.abs(--v));
|
||||
print(v);
|
||||
let u:number[] = [];
|
||||
assert_equal(--u, -1);
|
||||
print(--u);
|
||||
|
||||
print("compiler success");
|
17
test/aottest/compiler_test/expect_output.txt
Normal file
17
test/aottest/compiler_test/expect_output.txt
Normal file
@ -0,0 +1,17 @@
|
||||
# Copyright (c) 2023 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.
|
||||
|
||||
1
|
||||
-1
|
||||
-1
|
||||
compiler success
|
@ -13,6 +13,6 @@
|
||||
|
||||
import("//arkcompiler/ets_runtime/test/test_helper.gni")
|
||||
|
||||
host_aot_assert_test_action("constpool") {
|
||||
host_aot_test_action("constpool") {
|
||||
deps = []
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
declare function assert_equal(a: Object, b: Object):void;
|
||||
declare function print(str:any):string;
|
||||
|
||||
class A {
|
||||
constructor() {}
|
||||
@ -23,5 +23,5 @@ class A {
|
||||
z() {}
|
||||
}
|
||||
let a = new A()
|
||||
assert_equal(a.y, 1)
|
||||
assert_equal(a.z.name, "z")
|
||||
print(a.y)
|
||||
print(a.z.name)
|
15
test/aottest/constpool/expect_output.txt
Normal file
15
test/aottest/constpool/expect_output.txt
Normal file
@ -0,0 +1,15 @@
|
||||
# Copyright (c) 2023 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.
|
||||
|
||||
1
|
||||
z
|
@ -13,6 +13,6 @@
|
||||
|
||||
import("//arkcompiler/ets_runtime/test/test_helper.gni")
|
||||
|
||||
host_aot_assert_test_action("continue_from_finally") {
|
||||
host_aot_test_action("continue_from_finally") {
|
||||
deps = []
|
||||
}
|
||||
|
@ -14,8 +14,6 @@
|
||||
*/
|
||||
|
||||
declare function print(arg:any):string;
|
||||
declare function assert_unreachable():void;
|
||||
declare function assert_equal(a: Object, b: Object):void;
|
||||
|
||||
function* values() {
|
||||
yield 1;
|
||||
@ -27,7 +25,6 @@ function* values() {
|
||||
for (var x of iterator) {
|
||||
try {
|
||||
throw new Error();
|
||||
assert_unreachable();
|
||||
} catch (err) {
|
||||
} finally {
|
||||
i++;
|
||||
@ -39,4 +36,4 @@ function* values() {
|
||||
print('This code is unreachable (following `try` statement).');
|
||||
}
|
||||
|
||||
assert_equal(i, 2);
|
||||
print(i);
|
14
test/aottest/continue_from_finally/expect_output.txt
Normal file
14
test/aottest/continue_from_finally/expect_output.txt
Normal file
@ -0,0 +1,14 @@
|
||||
# Copyright (c) 2022 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.
|
||||
|
||||
2
|
@ -13,6 +13,6 @@
|
||||
|
||||
import("//arkcompiler/ets_runtime/test/test_helper.gni")
|
||||
|
||||
host_aot_assert_test_action("copyrestargs") {
|
||||
host_aot_test_action("copyrestargs") {
|
||||
deps = []
|
||||
}
|
||||
|
@ -13,21 +13,21 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
declare function assert_equal(a: Object, b: Object):void;
|
||||
var testArrary = [2, 3, "success", "fail"];
|
||||
declare function print(str:any):string;
|
||||
function f(a:any,...A:any) {
|
||||
for (let p in A) {
|
||||
A[p] = testArrary[p];
|
||||
print(A[p]);
|
||||
}
|
||||
}
|
||||
|
||||
f(1, [2, 3, "success", "fail"]);
|
||||
f(1, 2, 3);
|
||||
f(1, "success", "fail");
|
||||
|
||||
// The following test cases have exposed a bug: the variable actualRestNum in RuntimeOptCopyRestArgs
|
||||
// computed mistakely and may out of uint32_t range.
|
||||
function foo(x: number, y?: number, ...restArgs: number[]):void {
|
||||
let arr = [...restArgs];
|
||||
assert_equal(arr.length, 0);
|
||||
print(arr.length);
|
||||
}
|
||||
|
||||
foo(1);
|
||||
|
18
test/aottest/copyrestargs/expect_output.txt
Normal file
18
test/aottest/copyrestargs/expect_output.txt
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2022 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.
|
||||
|
||||
2
|
||||
3
|
||||
success
|
||||
fail
|
||||
0
|
@ -13,7 +13,7 @@
|
||||
|
||||
import("//arkcompiler/ets_runtime/test/test_helper.gni")
|
||||
|
||||
host_aot_assert_test_action("createarray_meta_data") {
|
||||
host_aot_test_action("createarray_meta_data") {
|
||||
deps = []
|
||||
is_only_typed_path = true
|
||||
is_enable_pgo = true
|
||||
|
@ -13,8 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
declare function assert_equal(a: Object, b: Object):void;
|
||||
let k =1;
|
||||
let arr:number[] = [-1,-1];
|
||||
let a2:number[] = [k];
|
||||
assert_equal(a2.length, 1);
|
||||
print(a2.length);
|
14
test/aottest/createarray_meta_data/expect_output.txt
Normal file
14
test/aottest/createarray_meta_data/expect_output.txt
Normal file
@ -0,0 +1,14 @@
|
||||
# Copyright (c) 2024 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.
|
||||
|
||||
1
|
14
test/aottest/createarray_meta_data/pgo_expect_output.txt
Normal file
14
test/aottest/createarray_meta_data/pgo_expect_output.txt
Normal file
@ -0,0 +1,14 @@
|
||||
# Copyright (c) 2024 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.
|
||||
|
||||
1
|
@ -13,6 +13,6 @@
|
||||
|
||||
import("//arkcompiler/ets_runtime/test/test_helper.gni")
|
||||
|
||||
host_aot_assert_test_action("createarrayimm16") {
|
||||
host_aot_test_action("createarrayimm16") {
|
||||
deps = []
|
||||
}
|
||||
|
@ -154,21 +154,21 @@ function foo() {
|
||||
|
||||
a134.push(-4);
|
||||
a134[4] = 5;
|
||||
assert_equal(a134[0], -1);
|
||||
assert_equal(a134[1], 1.2);
|
||||
assert_equal(a134[2], 3);
|
||||
assert_equal(a134[3], -4);
|
||||
assert_equal(a134[4], 5);
|
||||
print(a134[0]);
|
||||
print(a134[1]);
|
||||
print(a134[2]);
|
||||
print(a134[3]);
|
||||
print(a134[4]);
|
||||
a134[4] = a134[2] + a134[1];
|
||||
assert_equal(a134[4], 4.2);
|
||||
print(a134[4]);
|
||||
|
||||
a133.push(3.2);
|
||||
a133.push(4.8);
|
||||
a133[3] = a133[0] + a133[1];
|
||||
assert_equal(a133[0], 3.2);
|
||||
assert_equal(a133[1], 4.8);
|
||||
assert_equal(a133[2], undefined);
|
||||
assert_equal(a133[3], 8);
|
||||
print(a133[0]);
|
||||
print(a133[1]);
|
||||
print(a133[2]);
|
||||
print(a133[3]);
|
||||
}
|
||||
|
||||
for (let i = 0; i < 4; i++) {
|
||||
|
53
test/aottest/createarrayimm16/expect_output.txt
Normal file
53
test/aottest/createarrayimm16/expect_output.txt
Normal file
@ -0,0 +1,53 @@
|
||||
# Copyright (c) 2023 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.
|
||||
|
||||
-1
|
||||
1.2
|
||||
3
|
||||
-4
|
||||
5
|
||||
4.2
|
||||
3.2
|
||||
4.8
|
||||
undefined
|
||||
8
|
||||
-1
|
||||
1.2
|
||||
3
|
||||
-4
|
||||
5
|
||||
4.2
|
||||
3.2
|
||||
4.8
|
||||
undefined
|
||||
8
|
||||
-1
|
||||
1.2
|
||||
3
|
||||
-4
|
||||
5
|
||||
4.2
|
||||
3.2
|
||||
4.8
|
||||
undefined
|
||||
8
|
||||
-1
|
||||
1.2
|
||||
3
|
||||
-4
|
||||
5
|
||||
4.2
|
||||
3.2
|
||||
4.8
|
||||
undefined
|
||||
8
|
@ -13,6 +13,6 @@
|
||||
|
||||
import("//arkcompiler/ets_runtime/test/test_helper.gni")
|
||||
|
||||
host_aot_assert_test_action("createarraywithbuffer") {
|
||||
host_aot_test_action("createarraywithbuffer") {
|
||||
deps = []
|
||||
}
|
||||
|
@ -13,14 +13,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
declare function assert_equal(a: Object, b: Object):void;
|
||||
declare function print(str:any):string;
|
||||
var arrayIterator = ['fifth', 'sixth', 666];
|
||||
assert_equal(arrayIterator[0], "fifth");
|
||||
assert_equal(arrayIterator[1], "sixth");
|
||||
assert_equal(arrayIterator[2], 666);
|
||||
print(arrayIterator[0]);
|
||||
print(arrayIterator[1]);
|
||||
print(arrayIterator[2]);
|
||||
|
||||
var testNum1 = -1;
|
||||
var testNum2 = -1;
|
||||
class Index {
|
||||
currentArrays: number[][] = [
|
||||
[0, 0, 0, 0],
|
||||
@ -57,8 +55,8 @@ class Index {
|
||||
|
||||
run() {
|
||||
let newArray = this.changeCurretArrays();
|
||||
testNum1 = this.computeScore(newArray);
|
||||
testNum2 = this.computeScore(this.currentArrays);
|
||||
print(this.computeScore(newArray));
|
||||
print(this.computeScore(this.currentArrays));
|
||||
this.currentArrays = newArray;
|
||||
}
|
||||
}
|
||||
@ -66,51 +64,49 @@ class Index {
|
||||
let index = new Index;
|
||||
for (let i = 0; i < 3; i++) {
|
||||
index.run();
|
||||
assert_equal(testNum1, 16 * (i + 1));
|
||||
assert_equal(testNum2, 16 * i);
|
||||
}
|
||||
|
||||
let K:number[] = [];
|
||||
K.push(8.2);
|
||||
assert_equal(K[0], 8.2);
|
||||
print(K[0]);
|
||||
K[1] = 3;
|
||||
assert_equal(K[1], 3);
|
||||
print(K[1]);
|
||||
|
||||
let x = 1.2;
|
||||
let y = 9;
|
||||
let T:number[] = [0, 1, 1.2, x];
|
||||
assert_equal(T[0], 0);
|
||||
assert_equal(T[1], 1);
|
||||
assert_equal(T[2], 1.2);
|
||||
assert_equal(T[3], x);
|
||||
print(T[0]);
|
||||
print(T[1]);
|
||||
print(T[2]);
|
||||
print(T[3]);
|
||||
x = 1;
|
||||
let Ta:number[] = [,, 4.2, x];
|
||||
let Tb:number[] = [1, y, 1.2, x];
|
||||
let Tc:number[] = [-2, -9, 8.3, x];
|
||||
|
||||
assert_equal(Ta[0], undefined);
|
||||
assert_equal(Ta[1], undefined);
|
||||
assert_equal(Ta[2], 4.2);
|
||||
assert_equal(Ta[3], 1);
|
||||
print(Ta[0]);
|
||||
print(Ta[1]);
|
||||
print(Ta[2]);
|
||||
print(Ta[3]);
|
||||
|
||||
assert_equal(Tb[0], 1);
|
||||
assert_equal(Tb[1], 9);
|
||||
assert_equal(Tb[2], 1.2);
|
||||
assert_equal(Tb[3], 1);
|
||||
print(Tb[0]);
|
||||
print(Tb[1]);
|
||||
print(Tb[2]);
|
||||
print(Tb[3]);
|
||||
|
||||
assert_equal(Tc[0], -2);
|
||||
assert_equal(Tc[1], -9);
|
||||
assert_equal(Tc[2], 8.3);
|
||||
assert_equal(Tc[3], 1);
|
||||
print(Tc[0]);
|
||||
print(Tc[1]);
|
||||
print(Tc[2]);
|
||||
print(Tc[3]);
|
||||
|
||||
let z = {test: 1.8}
|
||||
|
||||
let Td:number[] = [8848, "aotTest", z, x];
|
||||
|
||||
assert_equal(Td[0], 8848);
|
||||
assert_equal(Td[1], "aotTest");
|
||||
assert_equal(Td[2].test, 1.8);
|
||||
assert_equal(Td[3], 1);
|
||||
print(Td[0]);
|
||||
print(Td[1]);
|
||||
print(Td[2].test);
|
||||
print(Td[3]);
|
||||
|
||||
Td[4] = 9999;
|
||||
assert_equal(Td[4], 9999);
|
||||
print(Td[4]);
|
45
test/aottest/createarraywithbuffer/expect_output.txt
Normal file
45
test/aottest/createarraywithbuffer/expect_output.txt
Normal file
@ -0,0 +1,45 @@
|
||||
# Copyright (c) 2022 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.
|
||||
|
||||
fifth
|
||||
sixth
|
||||
666
|
||||
16
|
||||
0
|
||||
32
|
||||
16
|
||||
48
|
||||
32
|
||||
8.2
|
||||
3
|
||||
0
|
||||
1
|
||||
1.2
|
||||
1.2
|
||||
undefined
|
||||
undefined
|
||||
4.2
|
||||
1
|
||||
1
|
||||
9
|
||||
1.2
|
||||
1
|
||||
-2
|
||||
-9
|
||||
8.3
|
||||
1
|
||||
8848
|
||||
aotTest
|
||||
1.8
|
||||
1
|
||||
9999
|
@ -13,6 +13,6 @@
|
||||
|
||||
import("//arkcompiler/ets_runtime/test/test_helper.gni")
|
||||
|
||||
host_aot_assert_test_action("createemptyarray") {
|
||||
host_aot_test_action("createemptyarray") {
|
||||
deps = []
|
||||
}
|
||||
|
@ -13,9 +13,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
declare function assert_true(condition: boolean):void;
|
||||
declare function assert_equal(a: Object, b: Object):void;
|
||||
declare function print(str:any):string;
|
||||
var empArr : Array<any> = [];
|
||||
var isArr = Array.isArray(empArr);
|
||||
assert_equal(empArr.length, 0);
|
||||
assert_true(isArr);
|
||||
print(empArr.length);
|
||||
print(isArr);
|
15
test/aottest/createemptyarray/expect_output.txt
Normal file
15
test/aottest/createemptyarray/expect_output.txt
Normal file
@ -0,0 +1,15 @@
|
||||
# Copyright (c) 2022 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.
|
||||
|
||||
0
|
||||
true
|
@ -13,6 +13,6 @@
|
||||
|
||||
import("//arkcompiler/ets_runtime/test/test_helper.gni")
|
||||
|
||||
host_aot_assert_test_action("createemptyobject") {
|
||||
host_aot_test_action("createemptyobject") {
|
||||
deps = []
|
||||
}
|
||||
|
@ -13,10 +13,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
declare function assert_true(condition: boolean):void;
|
||||
declare function assert_equal(a: Object, b: Object):void;
|
||||
declare function print(str:any):string;
|
||||
var empObj : {[key:string]:any} = {};
|
||||
var isObj = typeof empObj == "object";
|
||||
var keyNums = Object.keys(empObj).length;
|
||||
assert_equal(keyNums, 0);
|
||||
assert_true(isObj);
|
||||
print(keyNums);
|
||||
print(isObj);
|
15
test/aottest/createemptyobject/expect_output.txt
Normal file
15
test/aottest/createemptyobject/expect_output.txt
Normal file
@ -0,0 +1,15 @@
|
||||
# Copyright (c) 2022 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.
|
||||
|
||||
0
|
||||
true
|
@ -13,6 +13,6 @@
|
||||
|
||||
import("//arkcompiler/ets_runtime/test/test_helper.gni")
|
||||
|
||||
host_aot_assert_test_action("creategeneratorobj") {
|
||||
host_aot_test_action("creategeneratorobj") {
|
||||
deps = []
|
||||
}
|
||||
|
14
test/aottest/creategeneratorobj/expect_output.txt
Normal file
14
test/aottest/creategeneratorobj/expect_output.txt
Normal file
@ -0,0 +1,14 @@
|
||||
# Copyright (c) 2022 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.
|
||||
|
||||
helloworld
|
@ -13,6 +13,6 @@
|
||||
|
||||
import("//arkcompiler/ets_runtime/test/test_helper.gni")
|
||||
|
||||
host_aot_assert_test_action("createiterresultobj") {
|
||||
host_aot_test_action("createiterresultobj") {
|
||||
deps = []
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
declare function assert_equal(a: Object, b: Object):void;
|
||||
declare function print(str:any):string;
|
||||
function* foo(){
|
||||
let index = 0;
|
||||
while(index < 2) {
|
||||
@ -23,6 +23,6 @@ function* foo(){
|
||||
|
||||
let gen = foo();
|
||||
|
||||
assert_equal(gen.next().value, 0);
|
||||
assert_equal(gen.next().value, 1);
|
||||
assert_equal(gen.next().value, undefined);
|
||||
print(gen.next().value);
|
||||
print(gen.next().value);
|
||||
print(gen.next().value);
|
16
test/aottest/createiterresultobj/expect_output.txt
Normal file
16
test/aottest/createiterresultobj/expect_output.txt
Normal file
@ -0,0 +1,16 @@
|
||||
# Copyright (c) 2022 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.
|
||||
|
||||
0
|
||||
1
|
||||
undefined
|
@ -13,6 +13,6 @@
|
||||
|
||||
import("//arkcompiler/ets_runtime/test/test_helper.gni")
|
||||
|
||||
host_aot_assert_test_action("createobjecthavingmethod") {
|
||||
host_aot_test_action("createobjecthavingmethod") {
|
||||
deps = []
|
||||
}
|
||||
|
@ -13,10 +13,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
declare function assert_equal(a: Object, b: Object):void;
|
||||
declare function print(arg:any):string;
|
||||
var obj = {
|
||||
value: 1,
|
||||
fun (a:number) {assert_equal(this.value + a, 2)},
|
||||
fun (a:number) {print(this.value + a)},
|
||||
};
|
||||
|
||||
obj.fun(1);
|
||||
|
14
test/aottest/createobjecthavingmethod/expect_output.txt
Normal file
14
test/aottest/createobjecthavingmethod/expect_output.txt
Normal file
@ -0,0 +1,14 @@
|
||||
# Copyright (c) 2022 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.
|
||||
|
||||
2
|
@ -13,6 +13,6 @@
|
||||
|
||||
import("//arkcompiler/ets_runtime/test/test_helper.gni")
|
||||
|
||||
host_aot_assert_test_action("createobjectwithbuffer") {
|
||||
host_aot_test_action("createobjectwithbuffer") {
|
||||
deps = []
|
||||
}
|
||||
|
@ -13,13 +13,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
declare function assert_equal(a: Object, b: Object):void;
|
||||
declare function print(str:any):string;
|
||||
let obj:{a:number, b:string}={
|
||||
a:1,
|
||||
b:"str",
|
||||
}
|
||||
assert_equal(obj.a, 1);
|
||||
assert_equal(obj.b, "str");
|
||||
print(obj.a);
|
||||
print(obj.b);
|
||||
|
||||
class A {
|
||||
data: {
|
||||
@ -35,7 +35,7 @@ class A {
|
||||
elapsed = 11.1;
|
||||
|
||||
this.data.elapsed += elapsed;
|
||||
assert_equal(this.data.elapsed, 11.1);
|
||||
print(this.data.elapsed)
|
||||
}
|
||||
}
|
||||
|
||||
|
16
test/aottest/createobjectwithbuffer/expect_output.txt
Normal file
16
test/aottest/createobjectwithbuffer/expect_output.txt
Normal file
@ -0,0 +1,16 @@
|
||||
# Copyright (c) 2022 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.
|
||||
|
||||
1
|
||||
str
|
||||
11.1
|
@ -13,6 +13,6 @@
|
||||
|
||||
import("//arkcompiler/ets_runtime/test/test_helper.gni")
|
||||
|
||||
host_aot_assert_test_action("createobjectwithexcludedkeys") {
|
||||
host_aot_test_action("createobjectwithexcludedkeys") {
|
||||
deps = []
|
||||
}
|
||||
|
@ -14,11 +14,10 @@
|
||||
*/
|
||||
|
||||
// CREATEOBJECTWITHEXCLUDEDKEYS_IMM8_V8_V8
|
||||
declare function assert_equal(a: Object, b: Object):void;
|
||||
const v0 = {value : 'value', age: 23, name: 'name'};
|
||||
const {value, age, ...v1} = v0;
|
||||
assert_equal(value, 'value');
|
||||
assert_equal(age, 23);
|
||||
assert_equal(v1.value, undefined);
|
||||
assert_equal(v1.age, undefined);
|
||||
assert_equal(v1.name, 'name');
|
||||
print(value);
|
||||
print(age);
|
||||
print(v1.value);
|
||||
print(v1.age);
|
||||
print(v1.name);
|
||||
|
18
test/aottest/createobjectwithexcludedkeys/expect_output.txt
Normal file
18
test/aottest/createobjectwithexcludedkeys/expect_output.txt
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2022 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.
|
||||
|
||||
value
|
||||
23
|
||||
undefined
|
||||
undefined
|
||||
name
|
@ -13,6 +13,6 @@
|
||||
|
||||
import("//arkcompiler/ets_runtime/test/test_helper.gni")
|
||||
|
||||
host_aot_assert_test_action("createregexpwithliteral") {
|
||||
host_aot_test_action("createregexpwithliteral") {
|
||||
deps = []
|
||||
}
|
||||
|
@ -13,12 +13,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
declare function assert_true(condition: boolean):void;
|
||||
declare function assert_equal(a: Object, b: Object):void;
|
||||
declare function print(str:boolean):boolean;
|
||||
var re = /abc+/;
|
||||
var str1 = "abcc";
|
||||
var str2 = "ac";
|
||||
var res1 = re.test(str1);
|
||||
var res2 = re.test(str2);
|
||||
assert_true(res1);
|
||||
assert_equal(res2, false);
|
||||
print(res1);
|
||||
print(res2);
|
15
test/aottest/createregexpwithliteral/expect_output.txt
Normal file
15
test/aottest/createregexpwithliteral/expect_output.txt
Normal file
@ -0,0 +1,15 @@
|
||||
# Copyright (c) 2022 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.
|
||||
|
||||
true
|
||||
false
|
@ -13,6 +13,6 @@
|
||||
|
||||
import("//arkcompiler/ets_runtime/test/test_helper.gni")
|
||||
|
||||
host_aot_assert_test_action("dec") {
|
||||
host_aot_test_action("dec") {
|
||||
deps = []
|
||||
}
|
||||
|
@ -13,14 +13,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
declare function assert_true(condition: boolean):void;
|
||||
declare function assert_equal(a: Object, b: Object):void;
|
||||
declare function print(arg:any):string;
|
||||
|
||||
let num1:number = 2;
|
||||
assert_equal(--num1, 1);
|
||||
print(--num1);
|
||||
|
||||
let num2:number = 2.1;
|
||||
assert_equal(--num2, 1.1);
|
||||
print(--num2);
|
||||
|
||||
let str:any = "a";
|
||||
assert_true(isNaN(--str));
|
||||
print(--str);
|
16
test/aottest/dec/expect_output.txt
Normal file
16
test/aottest/dec/expect_output.txt
Normal file
@ -0,0 +1,16 @@
|
||||
# Copyright (c) 2022 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.
|
||||
|
||||
1
|
||||
1.1
|
||||
NaN
|
@ -12,6 +12,6 @@
|
||||
# limitations under the License.
|
||||
import("//arkcompiler/ets_runtime/test/test_helper.gni")
|
||||
|
||||
host_aot_assert_test_action("default_supers") {
|
||||
host_aot_test_action("default_supers") {
|
||||
deps = []
|
||||
}
|
||||
|
@ -12,13 +12,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
declare function assert_equal(a: Object, b: Object):void;
|
||||
class A {
|
||||
a:number = 1;
|
||||
}
|
||||
class B {
|
||||
foo(a : A) {
|
||||
assert_equal(a.a, undefined);
|
||||
print(a.a);
|
||||
}
|
||||
}
|
||||
let b = new B();
|
||||
|
18
test/aottest/default_supers/expect_output.txt
Normal file
18
test/aottest/default_supers/expect_output.txt
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2023 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.
|
||||
|
||||
1
|
||||
undefined
|
||||
2
|
||||
undefined
|
||||
3
|
@ -13,6 +13,6 @@
|
||||
|
||||
import("//arkcompiler/ets_runtime/test/test_helper.gni")
|
||||
|
||||
host_aot_assert_test_action("defineasyncfunc") {
|
||||
host_aot_test_action("defineasyncfunc") {
|
||||
deps = []
|
||||
}
|
||||
|
15
test/aottest/defineasyncfunc/expect_output.txt
Normal file
15
test/aottest/defineasyncfunc/expect_output.txt
Normal file
@ -0,0 +1,15 @@
|
||||
# Copyright (c) 2022 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.
|
||||
|
||||
hello2
|
||||
hello1
|
@ -13,6 +13,6 @@
|
||||
|
||||
import("//arkcompiler/ets_runtime/test/test_helper.gni")
|
||||
|
||||
host_aot_js_assert_test_action("defineclass") {
|
||||
host_aot_js_test_action("defineclass") {
|
||||
deps = []
|
||||
}
|
||||
|
14
test/aottest/defineclass/expect_output.txt
Normal file
14
test/aottest/defineclass/expect_output.txt
Normal file
@ -0,0 +1,14 @@
|
||||
# Copyright (c) 2023 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.
|
||||
|
||||
compiler succ
|
@ -13,6 +13,6 @@
|
||||
|
||||
import("//arkcompiler/ets_runtime/test/test_helper.gni")
|
||||
|
||||
host_aot_assert_test_action("defineclasswithbuffer") {
|
||||
host_aot_test_action("defineclasswithbuffer") {
|
||||
deps = []
|
||||
}
|
||||
|
@ -14,9 +14,6 @@
|
||||
*/
|
||||
|
||||
declare function print(str:any):string;
|
||||
declare function assert_unreachable():void;
|
||||
declare function assert_true(condition: boolean):void;
|
||||
declare function assert_equal(a: Object, b: Object):void;
|
||||
class Obj1 {
|
||||
value:number;
|
||||
constructor(value:number) {
|
||||
@ -34,12 +31,12 @@ class Obj2 {
|
||||
}
|
||||
|
||||
var obj1 = new Obj1(1);
|
||||
assert_equal(obj1.value, 1);
|
||||
assert_equal(obj1.fun(2), 4);
|
||||
print(obj1.value);
|
||||
print(obj1.fun(2));
|
||||
var obj2 = new Obj2();
|
||||
obj2.fun();
|
||||
|
||||
assert_true(obj1 instanceof Object);
|
||||
print(obj1 instanceof Object);
|
||||
|
||||
// The following test case once exposed a bug: The abstract methods were not ignored when generating phc using ts types,
|
||||
// resulting in the inconsistency between the properties key and class litreal at runtime.
|
||||
@ -53,7 +50,7 @@ abstract class C {
|
||||
}
|
||||
}
|
||||
|
||||
assert_equal(C.prototype.bar(), "bar");
|
||||
print(C.prototype.bar());
|
||||
|
||||
function f26() {
|
||||
function f29() {}
|
||||
@ -62,6 +59,5 @@ function f26() {
|
||||
}
|
||||
try {
|
||||
const v31 = f26();
|
||||
assert_unreachable();
|
||||
} catch (e) {}
|
||||
class C33 {}
|
18
test/aottest/defineclasswithbuffer/expect_output.txt
Normal file
18
test/aottest/defineclasswithbuffer/expect_output.txt
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2022 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.
|
||||
|
||||
1
|
||||
4
|
||||
Hello World
|
||||
true
|
||||
bar
|
@ -13,6 +13,6 @@
|
||||
|
||||
import("//arkcompiler/ets_runtime/test/test_helper.gni")
|
||||
|
||||
host_aot_assert_test_action("definefunc") {
|
||||
host_aot_test_action("definefunc") {
|
||||
deps = []
|
||||
}
|
||||
|
@ -14,7 +14,6 @@
|
||||
*/
|
||||
|
||||
declare function print(str:string):string;
|
||||
declare function assert_equal(a: Object, b: Object):void;
|
||||
|
||||
function getHelloWorld():string
|
||||
{
|
||||
@ -27,4 +26,4 @@ function printArg(a:any, b:any)
|
||||
print(b);
|
||||
}
|
||||
|
||||
assert_equal(getHelloWorld(), "hello world");
|
||||
print(getHelloWorld());
|
14
test/aottest/definefunc/expect_output.txt
Normal file
14
test/aottest/definefunc/expect_output.txt
Normal file
@ -0,0 +1,14 @@
|
||||
# Copyright (c) 2022 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.
|
||||
|
||||
hello world
|
@ -13,6 +13,6 @@
|
||||
|
||||
import("//arkcompiler/ets_runtime/test/test_helper.gni")
|
||||
|
||||
host_aot_assert_test_action("definefunc_variable_args") {
|
||||
host_aot_test_action("definefunc_variable_args") {
|
||||
deps = []
|
||||
}
|
||||
|
@ -14,12 +14,11 @@
|
||||
*/
|
||||
|
||||
declare function print(str:string):string;
|
||||
declare function assert_equal(a: Object, b: Object):void;
|
||||
|
||||
function printArgs(...rest:any)
|
||||
{
|
||||
assert_equal(arguments[0], "aaa");
|
||||
assert_equal(arguments[1], 55555);
|
||||
print(arguments[0]);
|
||||
print(arguments[1]);
|
||||
}
|
||||
|
||||
printArgs("aaa", 55555);
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user