aottest部分测试用例切换

Signed-off-by: shiminnan@huawei.com <shiminnan@huawei.com>
This commit is contained in:
swx1282997 2024-03-06 14:21:30 +08:00
parent 1fdb6d1e71
commit 9b5d12c9c6
74 changed files with 204 additions and 670 deletions

View File

@ -64,31 +64,6 @@ group("ark_aot_ts_test") {
"async_env",
"await",
"await_loop",
"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",
@ -334,6 +309,31 @@ group("ark_aot_ts_assert_test") {
"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" ]

View File

@ -13,6 +13,7 @@
* limitations under the License.
*/
declare function assert_unreachable():void;
declare function assert_true(condition: boolean):void;
declare function assert_equal(a: Object, b: Object):void;
declare function print(arg:any):string;

View File

@ -13,6 +13,6 @@
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_aot_test_action("class_method_signature") {
host_aot_assert_test_action("class_method_signature") {
deps = []
}

View File

@ -13,7 +13,7 @@
* limitations under the License.
*/
declare function print(str:any):string;
declare function assert_equal(a: Object, b: Object):void;
class A {
constructor() {}
@ -30,9 +30,9 @@ class A {
}
let a = new A();
print(a.bar());
print(a.bar2());
print(Reflect.ownKeys(A.prototype)); //constructor,bar,bar2
assert_equal(a.bar(), "bar");
assert_equal(a.bar2(), "bar2");
assert_equal(Reflect.ownKeys(A.prototype), ["constructor", "bar", "bar2"]); //constructor,bar,bar2
class A2 {
constructor() {}
@ -52,10 +52,10 @@ class A2 {
}
let a2 = new A2();
print(a2.foo());
print(a2.bar());
print(a2.bar2());
print(Reflect.ownKeys(A2.prototype)); //constructor,foo,bar,bar2
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
class B {
@ -73,9 +73,9 @@ class B {
}
let b = new B();
print(b.bar());
print(b.bar2());
print(Reflect.ownKeys(B.prototype)); //constructor,bar,bar2
assert_equal(b.bar(), "bar");
assert_equal(b.bar2(), "bar2");
assert_equal(Reflect.ownKeys(B.prototype), ["constructor", "bar", "bar2"]); //constructor,bar,bar2
class B2 {
constructor() {}
@ -95,10 +95,10 @@ class B2 {
}
let b2 = new B2();
print(b2.foo());
print(b2.bar());
print(b2.bar2());
print(Reflect.ownKeys(B2.prototype)); //constructor,bar,foo,bar2
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
// one signature but no body
class C {
@ -112,7 +112,7 @@ class C {
}
let c = new C();
print(c.bar());
assert_equal(c.bar(), "test one signature but no body");
// multi-signatures but one body
class D {
@ -132,8 +132,8 @@ class D {
}
let d = new D();
print(d.foo!("D"));
print(d.bar());
assert_equal(d.foo!("D"), "D");
assert_equal(d.bar(), "test multi-signatures but one body");
// multi-signature but no body.
class E {
@ -155,6 +155,6 @@ E.prototype.foo = function(): string {
}
let e = new E();
print(e.foo!());
print(e.bar());
assert_equal(e.foo!(), "E");
assert_equal(e.bar(), "test multi-signatures but no body");

View File

@ -1,32 +0,0 @@
# 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

View File

@ -13,6 +13,6 @@
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_aot_test_action("classstatic") {
host_aot_assert_test_action("classstatic") {
deps = []
}

View File

@ -13,24 +13,28 @@
* 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 {
print(a);
cpuTestNum1 = a;
cpu.sub(a, b);
var out : number = a + b;
return out;
}
get kind() {
print(this.mode);
assert_equal(this.mode, 4);
return this.mode;
}
public static sub(a: number, b: number): number {
print(b);
cpuTestNum2 = b;
var out : number = a + b;
return out;
}
@ -185,7 +189,6 @@ class cpu1 {
}
get kind() {
print(this.mode);
return this.mode;
}
static Constant = 1;
@ -196,19 +199,23 @@ class cpu1 {
function foo():number {
return cpu.Curve;
}
print(foo());
assert_equal(foo(), 2);
cpu.add(1, 3);
assert_equal(cpuTestNum1, 1);
assert_equal(cpuTestNum2, 3);
var systems: cpu = new cpu();
print(systems.kind);
assert_equal(systems.kind, 4);
cpu.sub(1, 4);
print(cpu1.TwoC);
print(cpu1.length);
assert_equal(cpuTestNum2, 4);
assert_equal(cpu1.TwoC, 3);
assert_equal(cpu1.length, 0);
cpu1.color();
try {
cpu1.length = 4;
assert_unreachable();
} catch (e) {
print(e)
assert_equal(e.message, "Cannot assign to read only property")
}
class Info {
@ -231,7 +238,7 @@ class Shape {
}
func1(a:any,...A:any) : void {
for (let p in A) {
print(A[p]);
assert_equal(A[p], 2);
}
}
}
@ -306,11 +313,11 @@ class Node{
while (el) {
var map = el.map;
if (map == names) {
print(map)
assert_equal(map, "hh")
}
el = el.nodeType == 1 ? el.childNode : el.parentNode;
const tmp = Node.Constant;
print(el);
assert_equal(el, null);
}
}

View File

@ -1,30 +0,0 @@
# 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

View File

@ -13,6 +13,6 @@
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_aot_test_action("closeiterator") {
host_aot_assert_test_action("closeiterator") {
deps = []
}

View File

@ -1,14 +0,0 @@
# 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

View File

@ -13,6 +13,6 @@
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_aot_test_action("compiler_test") {
host_aot_assert_test_action("compiler_test") {
deps = []
}

View File

@ -13,6 +13,8 @@
* 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 : {} = {
@ -37,6 +39,7 @@ function f1() {
return
try {
f()
assert_unreachable();
} catch(e) {
}
}
@ -45,6 +48,7 @@ function f1() {
function f2() {
try {
return
assert_unreachable();
} catch(e15) {
}
while(1) {}
@ -59,7 +63,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); } catch (e) {}
try { new v292(64, ...v303, ...v303, ...v303, ...v303); assert_unreachable(); } catch (e) {}
return "bigint";
}
for (let v316:number = 0; v316 < 5; v316++) {
@ -73,6 +77,7 @@ try {
[a1718];
static [v1705] = a1719;
}
assert_unreachable();
} catch (e) {}
// case8: stackmapNum % 2
@ -82,9 +87,9 @@ v39++;
// case9: this branch is unreachable
let v:number = [];
print(Math.abs(--v));
print(v);
assert_equal(Math.abs(--v), 1);
assert_equal(v, -1);
let u:number[] = [];
print(--u);
assert_equal(--u, -1);
print("compiler success");

View File

@ -1,17 +0,0 @@
# 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

View File

@ -13,6 +13,6 @@
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_aot_test_action("constpool") {
host_aot_assert_test_action("constpool") {
deps = []
}

View File

@ -13,7 +13,7 @@
* limitations under the License.
*/
declare function print(str:any):string;
declare function assert_equal(a: Object, b: Object):void;
class A {
constructor() {}
@ -23,5 +23,5 @@ class A {
z() {}
}
let a = new A()
print(a.y)
print(a.z.name)
assert_equal(a.y, 1)
assert_equal(a.z.name, "z")

View File

@ -1,15 +0,0 @@
# 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

View File

@ -13,6 +13,6 @@
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_aot_test_action("continue_from_finally") {
host_aot_assert_test_action("continue_from_finally") {
deps = []
}

View File

@ -14,6 +14,8 @@
*/
declare function print(arg:any):string;
declare function assert_unreachable():void;
declare function assert_equal(a: Object, b: Object):void;
function* values() {
yield 1;
@ -25,6 +27,7 @@ function* values() {
for (var x of iterator) {
try {
throw new Error();
assert_unreachable();
} catch (err) {
} finally {
i++;
@ -36,4 +39,4 @@ function* values() {
print('This code is unreachable (following `try` statement).');
}
print(i)
assert_equal(i, 2);

View File

@ -1,14 +0,0 @@
# 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

View File

@ -13,6 +13,6 @@
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_aot_test_action("copyrestargs") {
host_aot_assert_test_action("copyrestargs") {
deps = []
}

View File

@ -13,21 +13,21 @@
* limitations under the License.
*/
declare function print(str:any):string;
declare function assert_equal(a: Object, b: Object):void;
var testArrary = [2, 3, "success", "fail"];
function f(a:any,...A:any) {
for (let p in A) {
print(A[p]);
A[p] = testArrary[p];
}
}
f(1, 2, 3);
f(1, "success", "fail");
f(1, [2, 3, "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];
print(arr.length);
assert_equal(arr.length, 0);
}
foo(1);

View File

@ -1,18 +0,0 @@
# 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

View File

@ -13,7 +13,7 @@
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_aot_test_action("createarray_meta_data") {
host_aot_assert_test_action("createarray_meta_data") {
deps = []
is_only_typed_path = true
is_enable_pgo = true

View File

@ -13,7 +13,8 @@
* 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];
print(a2.length)
assert_equal(a2.length, 1);

View File

@ -1,14 +0,0 @@
# 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

View File

@ -1,14 +0,0 @@
# 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

View File

@ -13,6 +13,6 @@
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_aot_test_action("createarrayimm16") {
host_aot_assert_test_action("createarrayimm16") {
deps = []
}

View File

@ -154,21 +154,21 @@ function foo() {
a134.push(-4);
a134[4] = 5;
print(a134[0]);
print(a134[1]);
print(a134[2]);
print(a134[3]);
print(a134[4]);
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);
a134[4] = a134[2] + a134[1];
print(a134[4]);
assert_equal(a134[4], 4.2);
a133.push(3.2);
a133.push(4.8);
a133[3] = a133[0] + a133[1];
print(a133[0]);
print(a133[1]);
print(a133[2]);
print(a133[3]);
assert_equal(a133[0], 3.2);
assert_equal(a133[1], 4.8);
assert_equal(a133[2], undefined);
assert_equal(a133[3], 8);
}
for (let i = 0; i < 4; i++) {

View File

@ -1,53 +0,0 @@
# 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

View File

@ -13,6 +13,6 @@
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_aot_test_action("createarraywithbuffer") {
host_aot_assert_test_action("createarraywithbuffer") {
deps = []
}

View File

@ -13,12 +13,14 @@
* limitations under the License.
*/
declare function print(str:any):string;
declare function assert_equal(a: Object, b: Object):void;
var arrayIterator = ['fifth', 'sixth', 666];
print(arrayIterator[0]);
print(arrayIterator[1]);
print(arrayIterator[2]);
assert_equal(arrayIterator[0], "fifth");
assert_equal(arrayIterator[1], "sixth");
assert_equal(arrayIterator[2], 666);
var testNum1 = -1;
var testNum2 = -1;
class Index {
currentArrays: number[][] = [
[0, 0, 0, 0],
@ -55,8 +57,8 @@ class Index {
run() {
let newArray = this.changeCurretArrays();
print(this.computeScore(newArray));
print(this.computeScore(this.currentArrays));
testNum1 = this.computeScore(newArray);
testNum2 = this.computeScore(this.currentArrays);
this.currentArrays = newArray;
}
}
@ -64,49 +66,51 @@ 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);
print(K[0]);
assert_equal(K[0], 8.2);
K[1] = 3;
print(K[1]);
assert_equal(K[1], 3);
let x = 1.2;
let y = 9;
let T:number[] = [0, 1, 1.2, x];
print(T[0]);
print(T[1]);
print(T[2]);
print(T[3]);
assert_equal(T[0], 0);
assert_equal(T[1], 1);
assert_equal(T[2], 1.2);
assert_equal(T[3], x);
x = 1;
let Ta:number[] = [,, 4.2, x];
let Tb:number[] = [1, y, 1.2, x];
let Tc:number[] = [-2, -9, 8.3, x];
print(Ta[0]);
print(Ta[1]);
print(Ta[2]);
print(Ta[3]);
assert_equal(Ta[0], undefined);
assert_equal(Ta[1], undefined);
assert_equal(Ta[2], 4.2);
assert_equal(Ta[3], 1);
print(Tb[0]);
print(Tb[1]);
print(Tb[2]);
print(Tb[3]);
assert_equal(Tb[0], 1);
assert_equal(Tb[1], 9);
assert_equal(Tb[2], 1.2);
assert_equal(Tb[3], 1);
print(Tc[0]);
print(Tc[1]);
print(Tc[2]);
print(Tc[3]);
assert_equal(Tc[0], -2);
assert_equal(Tc[1], -9);
assert_equal(Tc[2], 8.3);
assert_equal(Tc[3], 1);
let z = {test: 1.8}
let Td:number[] = [8848, "aotTest", z, x];
print(Td[0]);
print(Td[1]);
print(Td[2].test);
print(Td[3]);
assert_equal(Td[0], 8848);
assert_equal(Td[1], "aotTest");
assert_equal(Td[2].test, 1.8);
assert_equal(Td[3], 1);
Td[4] = 9999;
print(Td[4]);
assert_equal(Td[4], 9999);

View File

@ -1,45 +0,0 @@
# 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

View File

@ -13,6 +13,6 @@
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_aot_test_action("createemptyarray") {
host_aot_assert_test_action("createemptyarray") {
deps = []
}

View File

@ -13,8 +13,9 @@
* limitations under the License.
*/
declare function print(str:any):string;
declare function assert_true(condition: boolean):void;
declare function assert_equal(a: Object, b: Object):void;
var empArr : Array<any> = [];
var isArr = Array.isArray(empArr);
print(empArr.length);
print(isArr);
assert_equal(empArr.length, 0);
assert_true(isArr);

View File

@ -1,15 +0,0 @@
# 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

View File

@ -13,6 +13,6 @@
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_aot_test_action("createemptyobject") {
host_aot_assert_test_action("createemptyobject") {
deps = []
}

View File

@ -13,9 +13,10 @@
* limitations under the License.
*/
declare function print(str:any):string;
declare function assert_true(condition: boolean):void;
declare function assert_equal(a: Object, b: Object):void;
var empObj : {[key:string]:any} = {};
var isObj = typeof empObj == "object";
var keyNums = Object.keys(empObj).length;
print(keyNums);
print(isObj);
assert_equal(keyNums, 0);
assert_true(isObj);

View File

@ -1,15 +0,0 @@
# 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

View File

@ -13,6 +13,6 @@
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_aot_test_action("creategeneratorobj") {
host_aot_assert_test_action("creategeneratorobj") {
deps = []
}

View File

@ -1,14 +0,0 @@
# 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

View File

@ -13,6 +13,6 @@
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_aot_test_action("createiterresultobj") {
host_aot_assert_test_action("createiterresultobj") {
deps = []
}

View File

@ -13,7 +13,7 @@
* limitations under the License.
*/
declare function print(str:any):string;
declare function assert_equal(a: Object, b: Object):void;
function* foo(){
let index = 0;
while(index < 2) {
@ -23,6 +23,6 @@ function* foo(){
let gen = foo();
print(gen.next().value);
print(gen.next().value);
print(gen.next().value);
assert_equal(gen.next().value, 0);
assert_equal(gen.next().value, 1);
assert_equal(gen.next().value, undefined);

View File

@ -1,16 +0,0 @@
# 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

View File

@ -13,6 +13,6 @@
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_aot_test_action("createobjecthavingmethod") {
host_aot_assert_test_action("createobjecthavingmethod") {
deps = []
}

View File

@ -13,10 +13,10 @@
* limitations under the License.
*/
declare function print(arg:any):string;
declare function assert_equal(a: Object, b: Object):void;
var obj = {
value: 1,
fun (a:number) {print(this.value + a)},
fun (a:number) {assert_equal(this.value + a, 2)},
};
obj.fun(1);

View File

@ -1,14 +0,0 @@
# 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

View File

@ -13,6 +13,6 @@
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_aot_test_action("createobjectwithbuffer") {
host_aot_assert_test_action("createobjectwithbuffer") {
deps = []
}

View File

@ -13,13 +13,13 @@
* limitations under the License.
*/
declare function print(str:any):string;
declare function assert_equal(a: Object, b: Object):void;
let obj:{a:number, b:string}={
a:1,
b:"str",
}
print(obj.a);
print(obj.b);
assert_equal(obj.a, 1);
assert_equal(obj.b, "str");
class A {
data: {
@ -35,7 +35,7 @@ class A {
elapsed = 11.1;
this.data.elapsed += elapsed;
print(this.data.elapsed)
assert_equal(this.data.elapsed, 11.1);
}
}

View File

@ -1,16 +0,0 @@
# 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

View File

@ -13,6 +13,6 @@
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_aot_test_action("createobjectwithexcludedkeys") {
host_aot_assert_test_action("createobjectwithexcludedkeys") {
deps = []
}

View File

@ -14,10 +14,11 @@
*/
// 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;
print(value);
print(age);
print(v1.value);
print(v1.age);
print(v1.name);
assert_equal(value, 'value');
assert_equal(age, 23);
assert_equal(v1.value, undefined);
assert_equal(v1.age, undefined);
assert_equal(v1.name, 'name');

View File

@ -1,18 +0,0 @@
# 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

View File

@ -13,6 +13,6 @@
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_aot_test_action("createregexpwithliteral") {
host_aot_assert_test_action("createregexpwithliteral") {
deps = []
}

View File

@ -13,11 +13,12 @@
* limitations under the License.
*/
declare function print(str:boolean):boolean;
declare function assert_true(condition: boolean):void;
declare function assert_equal(a: Object, b: Object):void;
var re = /abc+/;
var str1 = "abcc";
var str2 = "ac";
var res1 = re.test(str1);
var res2 = re.test(str2);
print(res1);
print(res2);
assert_true(res1);
assert_equal(res2, false);

View File

@ -1,15 +0,0 @@
# 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

View File

@ -13,6 +13,6 @@
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_aot_test_action("dec") {
host_aot_assert_test_action("dec") {
deps = []
}

View File

@ -13,13 +13,14 @@
* limitations under the License.
*/
declare function print(arg:any):string;
declare function assert_true(condition: boolean):void;
declare function assert_equal(a: Object, b: Object):void;
let num1:number = 2;
print(--num1);
assert_equal(--num1, 1);
let num2:number = 2.1;
print(--num2);
assert_equal(--num2, 1.1);
let str:any = "a";
print(--str);
assert_true(isNaN(--str));

View File

@ -1,16 +0,0 @@
# 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

View File

@ -12,6 +12,6 @@
# limitations under the License.
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_aot_test_action("default_supers") {
host_aot_assert_test_action("default_supers") {
deps = []
}

View File

@ -12,12 +12,13 @@
* 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) {
print(a.a);
assert_equal(a.a, undefined);
}
}
let b = new B();

View File

@ -1,18 +0,0 @@
# 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

View File

@ -13,6 +13,6 @@
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_aot_test_action("defineasyncfunc") {
host_aot_assert_test_action("defineasyncfunc") {
deps = []
}

View File

@ -1,15 +0,0 @@
# 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

View File

@ -13,6 +13,6 @@
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_aot_js_test_action("defineclass") {
host_aot_js_assert_test_action("defineclass") {
deps = []
}

View File

@ -1,14 +0,0 @@
# 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

View File

@ -13,6 +13,6 @@
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_aot_test_action("defineclasswithbuffer") {
host_aot_assert_test_action("defineclasswithbuffer") {
deps = []
}

View File

@ -14,6 +14,9 @@
*/
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) {
@ -31,12 +34,12 @@ class Obj2 {
}
var obj1 = new Obj1(1);
print(obj1.value);
print(obj1.fun(2));
assert_equal(obj1.value, 1);
assert_equal(obj1.fun(2), 4);
var obj2 = new Obj2();
obj2.fun();
print(obj1 instanceof Object);
assert_true(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.
@ -50,7 +53,7 @@ abstract class C {
}
}
print(C.prototype.bar());
assert_equal(C.prototype.bar(), "bar");
function f26() {
function f29() {}
@ -59,5 +62,6 @@ function f26() {
}
try {
const v31 = f26();
assert_unreachable();
} catch (e) {}
class C33 {}

View File

@ -1,18 +0,0 @@
# 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

View File

@ -13,6 +13,6 @@
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_aot_test_action("definefunc") {
host_aot_assert_test_action("definefunc") {
deps = []
}

View File

@ -14,6 +14,7 @@
*/
declare function print(str:string):string;
declare function assert_equal(a: Object, b: Object):void;
function getHelloWorld():string
{
@ -26,4 +27,4 @@ function printArg(a:any, b:any)
print(b);
}
print(getHelloWorld());
assert_equal(getHelloWorld(), "hello world");

View File

@ -1,14 +0,0 @@
# 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

View File

@ -13,6 +13,6 @@
import("//arkcompiler/ets_runtime/test/test_helper.gni")
host_aot_test_action("definefunc_variable_args") {
host_aot_assert_test_action("definefunc_variable_args") {
deps = []
}

View File

@ -14,11 +14,12 @@
*/
declare function print(str:string):string;
declare function assert_equal(a: Object, b: Object):void;
function printArgs(...rest:any)
{
print(arguments[0]);
print(arguments[1]);
assert_equal(arguments[0], "aaa");
assert_equal(arguments[1], 55555);
}
printArgs("aaa", 55555);

View File

@ -1,15 +0,0 @@
# 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.
aaa
55555