| /arkcompiler/ets_runtime/test/aottest/object/object_transition/ |
| D | object_transition.ts | 34 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/ |
| D | BuiltinArraySort.ets | 20 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 …]
|
| D | BuiltinArrayAlgorithms.ets | 30 * 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/ |
| D | index_negative.ets | 36 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 …]
|
| D | array_indexing_iteration.ets | 18 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 …]
|
| D | runtime_array_bound.ets.migrate.ets | 17 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 …]
|
| D | runtime_array_bound.ets | 17 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/ |
| D | far1.params.yaml | 21 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 …]
|
| D | far3.params.yaml | 18 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/ |
| D | ArrayTest7.ets | 22 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 …]
|
| D | RegExpExecTest.ets | 30 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 …]
|
| D | ArrayTest3.ets | 59 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/ |
| D | list.std_core_array_reverse.yaml | 18 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 …]
|
| D | list.std_core_array_indexOf_2.yaml | 18 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 …]
|
| D | list.std_core_array_includes.yaml | 18 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 …]
|
| D | list.std_core_array_copyOf_3.yaml | 19 method_signature: { arr: "FixedArray<boolean>"}, 21 method_signature_desc: {arr: "boolean_array"}, 26 …arr: "[true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, t… 30 arr: "[true]", 34 …arr: "[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 …]
|
| D | list.std_core_array_copyOf.yaml | 20 method_signature: { arr: "FixedArray<boolean>", startIndex: int, endIndex: int }, 27 …arr: "[true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, t… 33 …arr: "[true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, t… 39 …arr: "[true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, t… 45 …arr: "[true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, t… 47 endIndex: arr.length, 51 …arr: "[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/ |
| D | Array_builtin_sort.ets.j2 | 82 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 …]
|
| D | Array_builtin_algorithms.ets.j2 | 34 * 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/ |
| D | escompat.ets | 42 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/ |
| D | typedarrayfill.ts | 18 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/ |
| D | main.ets | 21 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/ |
| D | encoder_operands.cpp | 45 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/ |
| D | SortingTest.ets | 48 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/ |
| D | elements_kind.ts | 121 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 …]
|