| /arkcompiler/runtime_core/static_core/plugins/ets/stdlib/std/core/ |
| D | BuiltinArraySort.sts | 20 function bubbleSort(arr: 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: boolean[], startIndex: int, endIndex: int, initIndex: int = startIndex)… 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.sts | 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: boolean[], key: boolean, startIndex: int, endIndex: int): int… 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_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/templates/stdlib/ |
| D | Array_builtin_sort.sts.j2 | 28 function bubbleSort(arr: {{T}}[], startIndex: int, endIndex: int{{arg}}): void { 33 if ({{prec % ('arr[i + 1]', 'arr[i]')}}) { 34 const tmp = arr[i + 1] 35 arr[i + 1] = arr[i] 36 arr[i] = tmp 43 function insertionSort(arr: {{T}}[], startIndex: int, endIndex: int{{arg}}, initIndex: int = startI… 45 // arr[startIndex - 1] exists and is less than or equal to all elements in range 47 const tmp = arr[i] 49 while ({{prec % ('tmp', 'arr[pos - 1]')}}) { 50 arr[pos] = arr[pos - 1] [all …]
|
| D | Array_builtin_algorithms.sts.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: {{T}}[], key: {{T}}, startIndex: int, endIndex: int): 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/stdlib-templates/std/core/ |
| D | list.std_core_array_reverse.yaml | 18 result: arr, 20 method_signature: { arr: "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: "byte[]"}, 46 method_signature_desc: {arr: "byte_array"}, [all …]
|
| D | list.std_core_array_indexOf_2.yaml | 18 method_signature: { arr: "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: "byte[]", key: "byte" }, 69 method_signature_desc: {arr: "byte_array", key: "byte"}, [all …]
|
| D | list.std_core_array_includes.yaml | 18 method_signature: { arr: "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: "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: "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: "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: "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 …]
|
| D | list.std_core_array_foreach_2.yaml | 17 result: arr, 20 method_signature: { arr: "boolean[]", fn : "(value:boolean)=>void" }, 22 method_signature_desc: {arr: "boolean_array", fn: "func_boolean"}, 27 …arr: "[false, false, false, false, false, false, false, false, false, false, false, false, false, … 32 arr: "[]", 45 result: arr, 48 method_signature: { arr: "byte[]", fn : "(value:byte)=>void" }, 50 method_signature_desc: {arr: "byte_array", fn: "func_byte"}, 55 arr: "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]", 60 arr: "[]", [all …]
|
| D | list.std_core_array_lowerBoundSearch_2.yaml | 18 method_signature: { arr: "boolean[]", key: "boolean"}, 25 arr: "[false, false, false, true, true, true]", 30 arr: "[false, false, false, true, true, true]", 35 arr: "[false, false, false, false, false, false, true]", 40 arr: "[false, false, false, false, false, false, false]", 45 arr: "[true, true, true, true, true, true, true]", 50 arr: "[true, true, true, true, true, true, true]", 55 arr: "[false, false, false, false, false, false, false]", 75 method_signature: { arr: "byte[]", key: "byte"}, 82 arr: "[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]", [all …]
|
| D | list.std_core_array_upperBoundSearch_2.yaml | 18 method_signature: { arr: "boolean[]", key: "boolean"}, 25 arr: "[false, false, false, false, true, true, true]", 30 arr: "[false, false, false, false, true, true, true]", 35 arr: "[false, false, false, false, false, false, false]", 40 arr: "[true, true, true, true, true, true, true]", 56 method_signature: { arr: "byte[]", key: "byte"}, 63 arr: "[0,1,2,3,4,5,6,7,7,7,7,7,8,9,10,11,12,13,14,15,16]", 68 arr: "[7,7,7,7,7,8,9,10,11,12,13,14,15,16]", 74 arr: "[0,1,2,3,4,5,6,7,7,7,7,7]", 79 arr: "[0,1,2,3,4,5,6,7,7,7,7,7,8,9,10,11]", [all …]
|
| D | list.std_core_array_join.yaml | 19 method_signature: { arr: "boolean[]", delimiter: "String" }, 26 arr: "[true, true, true, true, true, true, true, true, true]", 31 arr: "[true, true, true, true, true, true, true, true, true]", 36 arr: "[true, true, true, true, true, true, true, true, true]", 41 arr: "[true, true, true, true, true, true, true, true, true]", 44 test5: {arr: "[]", delimiter: '","'}, 61 method_signature: { arr: "byte[]", delimiter: "String" }, 66 test1: { arr: "[1, 22, 33, 44, 55, 66, 77, 88, 99]", delimiter: '""' }, 67 test2: { arr: "[1, 22, 33, 44, 55, 66, 77, 88, 99]", delimiter: '" "' }, 69 { arr: "[1, 22, 33, 44, 55, 66, 77, 88, 99]", delimiter: '"------"' }, [all …]
|
| D | list.std_core_array_fill_2.yaml | 17 result: arr, 20 method_signature: { arr: "boolean[]", value: boolean }, 27 …arr: "[false, false, false, false, false, false, false, false, false, false, false, false, false, … 32 …arr: "[false, false, false, false, false, false, false, false, false, false, false, false, false, … 37 …arr: "[true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, t… 42 …arr: "[true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, t… 45 test5: { arr: "[true]", value: "false" }, 59 result: arr, 62 method_signature: { arr: "byte[]", value: byte }, 69 arr: "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]", [all …]
|
| /arkcompiler/runtime_core/static_core/plugins/ets/tests/interop_js/tests/escompat/ |
| D | escompat.sts | 42 function Array_TestJSSample(arr: Array<FooClass>): void { 43 assert (arr as Object) instanceof Array; 44 assert (arr.at(0)! as FooClass).name == "zero"; 45 assert arr.at(1)!.toString() == "{Foo named one}"; 48 assert (arr.at(idx)! as FooClass).name == "zero"; 50 arr.push(new FooClass("two")); 51 assert arr.at(2)!.toString() == "{Foo named two}"; 52 assert 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/moduletest/arrayfrom/ |
| D | arrayfrom.js | 16 let arr = Array.from("abcd"); variable 17 print(arr); 18 arr = Array.from("abcd"); 19 print(arr); 20 arr[1] = 'e'; 21 print(arr); 22 arr = Array.from("abcd"); 23 print(arr); 25 arr = Array.from("01234567890123456789012"); 26 print(arr) [all …]
|
| /arkcompiler/runtime_core/static_core/plugins/ets/tests/ets_func_tests/algorithms/ |
| D | SortingTest.sts | 48 function swap(arr: 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: 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: int[]): void { [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/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/escompat/ |
| D | ArrayTest3.sts | 43 let fnTrue = (elem: number, index: number, arr: Array<Number>): boolean => { 44 return arr.at(index)! == elem && elem < 238; 49 let arr = new Array<Number>; 51 arr.push(d[i]); 53 if (arr.every(fnTrue) == false) { return fail; } 55 let fnFalse = (elem: number, index: number, arr: Array<Number>): boolean => { 56 return arr.at(index)! == elem && elem < -238; 58 if (arr.every(fnFalse) == true) { return fail; } 69 let arr = new Array<Number>; 71 arr.push(d[i]); [all …]
|
| D | ArrayTest6.sts | 37 let arr = new Array<Number>; 39 arr.push(d[i]); 45 if (arr.findIndex(fnPositive) != 9) { return fail; } 46 if (arr.findIndex(fnNegative) != 1) { return fail; } 47 if (arr.findIndex(fnUndefined) != -1) { return fail; } 48 if (arr.findIndex(fnNull) != -1) { return fail; } 53 let arr = new Array<Number>; 55 arr.push(d[i]); 69 if (arr.findIndex(fnPositive) != 9) { return fail; } 70 if (arr.findIndex(fnNegative) != 1) { return fail; } [all …]
|
| D | ReadonlyArrayTest.sts | 82 function filterPositiveElement(elem: Number, index: number, arr: ReadonlyArray<Number>): boolean { 83 return arr[index] == elem && elem.valueOf() == 12 && index > 0; 86 function filterNegativeElement(elem: Number, index: number, arr: ReadonlyArray<Number>): boolean { 87 return arr[index] == elem && elem.valueOf() < 0 && index > 0; 90 function filterUndefinedElement(elem: Number, index: number, arr: ReadonlyArray<Number>): boolean { 91 return arr[index] == elem && elem == undefined && index < 0; 94 function filterNullElement(elem: Number, index: number, arr: ReadonlyArray<Number>) { 95 return arr[index] == elem && elem == null && index > 0; 101 const arr: ReadonlyArray<Number> = Arrays.copy(TEST_ARRAY); 102 if (arr.find(filterPositiveElement) != 12) return RESULT_FAILURE; [all …]
|
| D | ArrayTest2.sts | 35 let arr = new Array<Number>; 36 let iterator = arr.keys(); 49 arr.push(dd[i]); 51 iterator = arr.keys(); 56 if ((idx != arr.length) || (idx != dd.length)) { 69 let arr = new Array<Number>; 70 let iterator = arr.values(); 75 if ((i != 0) && (i != arr.length)) { 83 arr.push(d[i]) 85 iterator = arr.values(); [all …]
|
| /arkcompiler/runtime_core/static_core/plugins/ets/tests/ets_func_tests/std/containers/ |
| D | TrivialArrayTest.sts | 17 const arr = new Array<number>() 18 assert arr.length == 0 20 assert arr.length == i 21 arr.push(i as number) 24 assert arr.includes(i as number, undefined) 26 assert arr.at(50) == null 27 assert arr.length == 30 29 assert arr.pop()! as Object as Double as double as int == 30 - 1 - i 31 assert arr.length == 0 39 const arr = new Array<number>() [all …]
|