Home
last modified time | relevance | path

Searched full:arr (Results 1 – 25 of 995) sorted by relevance

12345678910>>...40

/arkcompiler/ets_runtime/test/aottest/object/object_transition/
Dobject_transition.ts34 let arr: number[] = new Array(1025).fill(0);
35 arr[1] = 1;
36 print(arr[1]);
42 let arr: number[] = new Array(2048)
43 arr[1] = 2;
44 arr[3] = 4;
45 arr.x1 = 1;
46 arr.x2 = 2;
47 arr.x3 = 3;
48 arr.x4 = 4;
[all …]
/arkcompiler/runtime_core/static_core/plugins/ets/stdlib/std/core/
DBuiltinArraySort.ets20 function bubbleSort(arr: FixedArray<boolean>, startIndex: int, endIndex: int): void {
25 if (((arr[i + 1]) ? 1 : 0) < ((arr[i]) ? 1 : 0)) {
26 const tmp = arr[i + 1]
27 arr[i + 1] = arr[i]
28 arr[i] = tmp
35 function insertionSort(arr: FixedArray<boolean>, startIndex: int, endIndex: int, initIndex: int = s…
37 // arr[startIndex - 1] exists and is less than or equal to all elements in range
39 const tmp = arr[i]
41 while (((tmp) ? 1 : 0) < ((arr[pos - 1]) ? 1 : 0)) {
42 arr[pos] = arr[pos - 1]
[all …]
DBuiltinArrayAlgorithms.ets30 * tries to find a lower bound of a key in sorted arr.
34 …* @param arr array to find a lower bound of a key. Has to be sorted, otherwise the answer is imple…
36 * @param key a value to find lower bound of. It may be not in arr, lower bound will present anyway
38 * @param startIndex an index of arr to begin search with
40 * @param endIndex a last index to stop search in arr, i.e. arr[endIndex] is not checked
42 * @returns index such (arr[index] < key) is false. If no such index is found than endIndex
44 export function lowerBoundSearch(arr: FixedArray<boolean>, key: boolean, startIndex: int, endIndex:…
45 if (!checkRange(arr.length, startIndex, endIndex)){
56 if (arr[middle] == false && key == true) {
68 * tries to find a lower bound of a key in sorted arr.
[all …]
/arkcompiler/ets_frontend/ets2panda/linter/test/main/
Dindex_negative.ets36 let arr: string[] = ['1', '2']
37 arr[-2]
38 arr[-0.13536]
39 arr[test()]
40 arr[test()*6]
42 arr[b]
44 arr[a.a]
45 arr[a.aa()]
47 arr[a.a+5]
48 arr[a.aa()*5]
[all …]
Darray_indexing_iteration.ets18 let arr: number[] = num as number[]
21 return arr[0]
24 let arr: number[] = [1,2,3]
25 let arrNum = rOnlyNum(arr, arr)
34 let arr: ArrayLike<number> = num as ArrayLike<number>
37 return arr[0]
40 let arr: ArrayLike<number> = [1,2,3]
41 let arrNum = rOnlyNum(arr, arr)
50 let arr: ConcatArray<number> = num as ConcatArray<number>
53 return arr[0]
[all …]
Druntime_array_bound.ets.migrate.ets17 const arr: int[] = [1.0, 2.0, 3.0, 4.0];
19 for (let i: number = 0.0; i < arr.length; i++) {
20 arr[i as int]; //legal
89 let arr: number[] = [0.0, 1.0, 2.0, 3.0, 4.0, 5.0]
90 for(let i: number = 0.0; i < arr.length; i++) {
91 arr[i as int] = arr[i as int] + 1.0;
93 for(let i: number = 0.0; i < arr.length; i++) {
95 arr[i as int] = arr[i as int] + 1.0;
98 let arr: number[] = [0.0, 1.0, 2.0, 3.0, 4.0, 5.0]
100 if(idx > 0.0 && idx < arr.length) {
[all …]
Druntime_array_bound.ets17 const arr: int[] = [1, 2, 3, 4];
19 for (let i = 0; i < arr.length; i++) {
20 arr[i]; //legal
89 let arr = [0, 1, 2, 3, 4, 5]
90 for(let i = 0; i < arr.length; i++) {
91 arr[i] = arr[i] + 1;
93 for(let i = 0; i < arr.length; i++) {
95 arr[i] = arr[i] + 1;
98 let arr = [0, 1, 2, 3, 4, 5]
100 if(idx > 0 && idx < arr.length) {
[all …]
/arkcompiler/runtime_core/static_core/plugins/ets/tests/ets-templates/17.experimental_features/02.fixed_array_types/
Dfar1.params.yaml21 let arr = obj as FixedArray<byte>
22 let v: byte = arr[0]
23 arr[1] = (arr[1] + v) as byte
24 assertEQ(arr[1], -1)
31 let arr = obj as FixedArray<short>
32 let v: short = arr[0]
33 arr[1] = (arr[1] + v) as short
34 assertEQ(arr[1], -1)
41 let arr = obj as FixedArray<int>
42 let v: int = arr[0]
[all …]
Dfar3.params.yaml18 let arr = foo<Byte>(obj)
19 let v: byte = arr[0]
20 arr[1] = (arr[1] + v) as byte
21 assertEQ(arr[1], -1)
25 let arr = foo<Short>(obj)
26 let v: short = arr[0]
27 arr[1] = (arr[1] + v) as short
28 assertEQ(arr[1], -1)
32 let arr = foo<Int>(obj)
33 let v: int = arr[0]
[all …]
/arkcompiler/runtime_core/static_core/plugins/ets/tests/ets_func_tests/escompat/
DArrayTest7.ets22 const arr = new Array<number>(1, 2, 3, 4, 5);
23 const removed = arr.splice(1, 2);
24 assertEQ(arr.length, 3)
25 assertEQ(arr[0], 1)
26 assertEQ(arr[1], 4)
27 assertEQ(arr[2], 5)
33 const arr = new Array<number>(1, 2, 3);
34 const removed = arr.splice(1, 0, 4, 5);
35 assertEQ(arr.length, 5)
36 assertEQ(arr[0], 1)
[all …]
DRegExpExecTest.ets30 let arr = new RegExp("\x00").exec("\u0000");
31 assertNE(arr, null);
32 if (arr != null) {
33 assertEQ(arr[0].codePointAt(0), 0, "testRegExpExec1");
38 let arr = new RegExp("ab\x00g").exec("ab\u0000grfd");
39 assertNE(arr, null);
40 if (arr != null) {
41 assertEQ(arr[0].codePointAt(0), 97, "testRegExpExec2");
42 assertEQ(arr[0].codePointAt(1), 98, "testRegExpExec2");
43 assertEQ(arr[0].codePointAt(2), 0, "testRegExpExec2");
[all …]
DArrayTest3.ets59 let fnTrue = (elem: number, index: number, arr: Array<Number>): boolean => {
60 return arr.at(index)! == elem && elem < 238;
63 return check(() => new Array<Number>, (arr: Array<Number>) => {
64 if (arr.every(fnTrue) == false) { return fail; }
66 arr.push(d[i]);
68 if (arr.every(fnTrue) == false) { return fail; }
70 let fnFalse = (elem: number, index: number, arr: Array<Number>): boolean => {
71 return arr.at(index)! == elem && elem < -238;
73 if (arr.every(fnFalse) == true) { return fail; }
83 return check(() => new Array<Number>, (arr: Array<Number>) => {
[all …]
/arkcompiler/runtime_core/static_core/plugins/ets/tests/stdlib-templates/std/core/
Dlist.std_core_array_reverse.yaml18 result: arr,
20 method_signature: { arr: "FixedArray<boolean>" },
22 method_signature_desc: {arr: "boolean_array"},
25 test1: { arr: "[true]" },
26 test2: { arr: "[true, false]" },
27 test3: { arr: "[true, false, false]" },
28 test4: { arr: "[]" },
42 result: arr,
44 method_signature: { arr: "FixedArray<byte>"},
46 method_signature_desc: {arr: "byte_array"},
[all …]
Dlist.std_core_array_indexOf_2.yaml18 method_signature: { arr: "FixedArray<boolean>", key: "boolean" },
19 method_signature_desc: {arr: "boolean_array", key: "boolean"},
25 arr: "[true, true, true, true]",
30 arr: "[true, true, true, true, true]",
35 arr: "[false, false, false, false, false, true]",
40 arr: "[false, false, true, false, false]",
45 arr: "[]",
50 arr: "[]",
68 method_signature: { arr: "FixedArray<byte>", key: "byte" },
69 method_signature_desc: {arr: "byte_array", key: "byte"},
[all …]
Dlist.std_core_array_includes.yaml18 method_signature: { arr: "FixedArray<boolean>", key: "boolean" },
25 arr: "[true, true, true, true]",
30 arr: "[true, true, true, true, true]",
35 arr: "[false, false, false, false, false, true]",
40 arr: "[false, false, true, false, false]",
45 arr: "[]",
50 arr: "[]",
68 method_signature: { arr: "FixedArray<byte>", key: "byte" },
75 arr: "[120, 100, 99, 21]",
80 arr: "[33, 120, 121, 99, 77, 33, 33]",
[all …]
Dlist.std_core_array_copyOf_3.yaml19 method_signature: { arr: "FixedArray<boolean>"},
21 method_signature_desc: {arr: "boolean_array"},
26arr: "[true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, t…
30 arr: "[true]",
34arr: "[true, false, true, false, true, false, true, false, true, false, true, false, true, false, …
38 arr: "[]"
54 method_signature: { arr: "FixedArray<byte>"},
56 method_signature_desc: {arr: "byte_array"},
61 arr: "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]",
65 arr: "[0]",
[all …]
Dlist.std_core_array_copyOf.yaml20 method_signature: { arr: "FixedArray<boolean>", startIndex: int, endIndex: int },
27arr: "[true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, t…
33arr: "[true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, t…
39arr: "[true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, t…
45arr: "[true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, t…
47 endIndex: arr.length,
51arr: "[true, false, true, false, true, false, true, false, true, false, true, false, true, false]",
53 endIndex: arr.length,
57 arr: "[]",
59 endIndex: arr.length
[all …]
/arkcompiler/runtime_core/static_core/plugins/ets/templates/stdlib/
DArray_builtin_sort.ets.j282 function bubbleSort(arr: FixedArray<{{T}}>, startIndex: int, endIndex: int{{arg}}): void {
87 if ({{prec % ('arr[i + 1]', 'arr[i]')}}) {
88 const tmp = arr[i + 1]
89 arr[i + 1] = arr[i]
90 arr[i] = tmp
97 function insertionSort(arr: FixedArray<{{T}}>, startIndex: int, endIndex: int{{arg}}, initIndex: in…
99 // arr[startIndex - 1] exists and is less than or equal to all elements in range
101 const tmp = arr[i]
103 while ({{prec % ('tmp', 'arr[pos - 1]')}}) {
104 arr[pos] = arr[pos - 1]
[all …]
DArray_builtin_algorithms.ets.j234 * tries to find a lower bound of a key in sorted arr.
38 …* @param arr array to find a lower bound of a key. Has to be sorted, otherwise the answer is imple…
42 * @param startIndex an index of arr to begin search with
44 * @param endIndex a last index to stop search in arr, i.e. arr[endIndex] is not checked
46 * @returns index such (arr[index] < key) is false. If no such index is found than endIndex
48 export function lowerBoundSearch(arr: FixedArray<{{T}}>, key: {{T}}, startIndex: int, endIndex: int…
49 if (!checkRange(arr.length, startIndex, endIndex)){
60 if (arr[middle] < key) {
72 * tries to find a lower bound of a key in sorted arr.
74 …element, where (element < key) is false. If no such element is found than lower bound is arr.length
[all …]
/arkcompiler/runtime_core/static_core/plugins/ets/tests/interop_js/tests/escompat/
Descompat.ets42 function Array_TestJSSample(arr: Array<FooClass>): void {
43 assertTrue( (arr as Object) instanceof Array);
44 assertEQ( (arr.at(0)! as FooClass).name, "zero");
45 assertEQ( arr.at(1)!.toString(), "{Foo named one}");
48 assertEQ( (arr.at(idx)! as FooClass).name, "zero");
50 arr.push(new FooClass("two"));
51 assertEQ( arr.at(2)!.toString(), "{Foo named two}");
52 assertEQ( arr.toString(), "{Foo named zero},{Foo named one},{Foo named two}");
55 function Array_TestJSLength(arr: Array<FooClass>): void {
57 // let len: int = arr.length();
[all …]
/arkcompiler/ets_runtime/test/aottest/typedarrayfill/
Dtypedarrayfill.ts18 let arr = new Int8Array(length)
21 arr.fill(2, start, end);
24 if (arr[i] == 2) {
29 if (arr[i] != 2) {
34 if (arr[i] == 2) {
47 let arr = new Uint8ClampedArray(length)
50 arr.fill(2, start, end);
53 if (arr[i] == 2) {
58 if (arr[i] != 2) {
63 if (arr[i] == 2) {
[all …]
/arkcompiler/runtime_core/taihe/test/ani_typedarray/user/
Dmain.ets21 let arr = bar.newUint8Array(2, 0x01 as byte);
22 assertEQ(arr.length, 2);
23 assertEQ(arr.at(0), 0x01);
24 assertEQ(arr.at(1), 0x01);
25 let res = bar.sumUint8Array(arr);
30 let arr = bar.newUint16Array(2, 0x0123 as short);
31 assertEQ(arr.at(0), 0x0123);
32 assertEQ(arr.at(1), 0x0123);
33 let res = bar.sumUint16Array(arr);
38 let arr = bar.newUint32Array(2, 0x01234567 as int);
[all …]
/arkcompiler/runtime_core/compiler/tests/
Dencoder_operands.cpp45 TypeInfo arr[] = { in TEST() local
66 for (uint8_t i = 0; i < sizeof(arr) / sizeof(TypeInfo); ++i) { in TEST()
68 ASSERT_FALSE(arr[i].IsValid()); in TEST()
70 ASSERT_TRUE(arr[i].IsValid()); in TEST()
75 ASSERT_EQ(arr[i], arr[4 + i]); in TEST()
76 ASSERT_EQ(arr[i], arr[8 + i]); in TEST()
77 ASSERT_EQ(arr[4 + i], arr[8 + i]); in TEST()
79 ASSERT_EQ(arr[i].GetSize(), arr[4 + i].GetSize()); in TEST()
80 ASSERT_EQ(arr[i].GetSize(), arr[8 + i].GetSize()); in TEST()
81 ASSERT_EQ(arr[4 + i].GetSize(), arr[8 + i].GetSize()); in TEST()
[all …]
/arkcompiler/runtime_core/static_core/plugins/ets/tests/ets_func_tests/algorithms/
DSortingTest.ets48 function swap(arr: FixedArray<int>, i: int, k: int): void {
49 let tmp = arr[i];
50 arr[i] = arr[k];
51 arr[k] = tmp;
54 function bubble_sort(arr: FixedArray<int>): void {
55 for (let i = 0; i + 1 < arr.length; ++i) {
56 for (let j = 0; j + 1 < arr.length - i; ++j) {
57 if (arr[j + 1] < arr[j]) {
58 swap(arr, j, j + 1);
64 function shaker_sort(arr: FixedArray<int>): void {
[all …]
/arkcompiler/ets_runtime/test/aottest/elements_kind/
Delements_kind.ts121 let arr = [];
122 arr.length = 1024;
123 print(ArkTools.getElementsKind(arr));
130 let arr = [];
131 arr.length = 1025
132 print(ArkTools.getElementsKind(arr));
139 let arr = [,,,,,,,,,,,,1];
140 print(ArkTools.getElementsKind(arr));
147 let arr = [,,,,,,];
148 print(ArkTools.getElementsKind(arr));
[all …]

12345678910>>...40