| /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 …]
|
| /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/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 …]
|
| /arkcompiler/ets_frontend/ets2panda/linter/test/main/ |
| D | array_indexing_iteration.sts | 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 …]
|
| /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/static_core/plugins/ets/tests/ets_func_tests/escompat/ |
| D | ArrayTest3.sts | 58 let fnTrue = (elem: number, index: number, arr: Array<Number>): boolean => { 59 return arr.at(index)! == elem && elem < 238; 62 return check(() => new Array<Number>, (arr: Array<Number>) => { 63 if (arr.every(fnTrue) == false) { return fail; } 65 arr.push(d[i]); 67 if (arr.every(fnTrue) == false) { return fail; } 69 let fnFalse = (elem: number, index: number, arr: Array<Number>): boolean => { 70 return arr.at(index)! == elem && elem < -238; 72 if (arr.every(fnFalse) == true) { return fail; } 82 return check(() => new Array<Number>, (arr: Array<Number>) => { [all …]
|
| D | ArrayTest6.sts | 52 return check(() => new Array<Number>, (arr: Array<Number>) => { 54 arr.push(d[i]); 60 if (arr.findIndex(fnPositive) != 9) { return fail; } 61 if (arr.findIndex(fnNegative) != 1) { return fail; } 62 if (arr.findIndex(fnUndefined) != -1) { return fail; } 63 if (arr.findIndex(fnNull) != -1) { return fail; } 69 return check(() => new Array<Number>, (arr: Array<Number>) => { 71 arr.push(d[i]); 85 if (arr.findIndex(fnPositive) != 9) { return fail; } 86 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 …]
|
| /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/debugger/src/arkdb/internal_tests/ |
| D | test_mirror.py | 22 from arkdb.mirrors import mirror_array as arr unknown 62 arr("arr", [1, 2, 3]), 63 arr("arr", [1, 2, 3]), 66 arr("arr", [cls("foo", a=1), cls("foo", a=2), cls("foo", a=3)]), 67 arr("arr", [cls("foo", a=1), cls("foo", a=2), cls("foo", a=3)]), 74 arr("arr", []), 75 arr("arr", []), 117 arr("arr", [1, 2, 3]), 118 arr("arr", [1, 2, 3, 4]), 121 arr("arr", [1, 2, 3, 4]), [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 …]
|
| /arkcompiler/runtime_core/static_core/plugins/ets/tests/ets-templates/07.expressions/12.indexing_expression/02.record_indexing_expression/ |
| D | ind.params.yaml | 178 let arr: long[] = [0, Long.MIN_VALUE, Long.MAX_VALUE, 99] 179 return arr[p] 191 …let arr: float[] = [0f, Float.MIN_VALUE, Float.MAX_VALUE, Float.NEGATIVE_INFINITY, Float.POSITIVE_… 195 r[arr[0]] = 0f 196 r[arr[1]] = Float.MIN_VALUE 197 r[arr[2]] = Float.MAX_VALUE 198 r[arr[3]] = Float.NEGATIVE_INFINITY 199 r[arr[4]] = Float.POSITIVE_INFINITY 200 r[arr[5]] = Float.NaN 201 assert(r[arr[0]] == 0f && r[arr[1]] == Float.MIN_VALUE && r[arr[2]] == Float.MAX_VALUE) [all …]
|