diff --git a/plugins/ets/runtime/interop_js/ets_proxy/ets_class_wrapper.cpp b/plugins/ets/runtime/interop_js/ets_proxy/ets_class_wrapper.cpp index 84b25f4a2dd82a55eac8cde3577d151304d27253..d77d4369c43d644c9007a3e2213db02d0b65c6c8 100644 --- a/plugins/ets/runtime/interop_js/ets_proxy/ets_class_wrapper.cpp +++ b/plugins/ets/runtime/interop_js/ets_proxy/ets_class_wrapper.cpp @@ -518,7 +518,10 @@ bool EtsClassWrapper::CreateAndWrap(napi_env env, napi_value js_newtarget, napi_ EtsClass *instance_class {}; if (LIKELY(not_extensible)) { +#ifndef PANDA_TARGET_OHOS + // In case of OHOS sealed object can't be wrapped, therefore seal it after wrapping NAPI_CHECK_FATAL(napi_object_seal(env, js_this)); +#endif // PANDA_TARGET_OHOS instance_class = ets_class_; } else { if (UNLIKELY(jsproxy_wrapper_ == nullptr)) { @@ -536,6 +539,10 @@ bool EtsClassWrapper::CreateAndWrap(napi_env env, napi_value js_newtarget, napi_ SharedReference *shared_ref; if (LIKELY(not_extensible)) { shared_ref = ctx->GetSharedRefStorage()->CreateETSObjectRef(ctx, ets_object.GetPtr(), js_this); +#ifdef PANDA_TARGET_OHOS + // In case of OHOS sealed object can't be wrapped, therefore seal it after wrapping + NAPI_CHECK_FATAL(napi_object_seal(env, js_this)); +#endif // PANDA_TARGET_OHOS } else { shared_ref = ctx->GetSharedRefStorage()->CreateHybridObjectRef(ctx, ets_object.GetPtr(), js_this); } diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/addition/add_arr_ref.ets b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/addition/add_arr_ref.ets new file mode 100644 index 0000000000000000000000000000000000000000..79dcc3577f4fcc1db0c852dda4402b660e42c38d --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/addition/add_arr_ref.ets @@ -0,0 +1,31 @@ +/*--- +Copyright (c) 2021-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. +---*/ +{%- for v in vals %} +/*--- +desc: >- + ArkTS provides a number of operators to act on character values: + Character operators that produce a value of type char. +---*/ + +const a: Char[] = new Char[1] + +function main() { + const v1 = new Char({{v.v1}}) + const v2 = new Char({{v.v2}}) + + a[0] = {{v.exp}} // unboxing/boxing is expected here + assert a[0] == {{v.r}} +} +{%- endfor %} diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/addition/add_arr_ref.params.yaml b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/addition/add_arr_ref.params.yaml new file mode 100644 index 0000000000000000000000000000000000000000..d0417a7407e3efe00fdbc4ddce612d061de72902 --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/addition/add_arr_ref.params.yaml @@ -0,0 +1,48 @@ +# Copyright (c) 2021-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. +--- +vals: + - v1: c'\u0020' + v2: c'\u0021' + exp: 'v1 + v2' + r: c'A' + + - v1: c'\u0020' + v2: c'\u0001' + exp: "v1 + v2 + c' '" + r: c'A' + + - v1: c'\uFFFF' + v2: c'\uFFFF' + exp: "v1 + v2" + r: c'\uFFFE' + + - v1: c'\uFFFF' + v2: c'\u0001' + exp: "v1 + v2" + r: c'\u0000' + + - v1: c'\uFFFF' + v2: c'\u000F' + exp: "v1 + c'\\u000F'" + r: c'\u000E' + + - v1: c'\u1010' + v2: c'\u0101' + exp: "v1 + c'\\u1010' + v2 + c'\\u0101'" + r: c'\u2222' + + - v1: c'∫' + v2: c'\x01' + exp: "v1 + v2" + r: c'∬' diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/addition/add_arr_val.ets b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/addition/add_arr_val.ets new file mode 100644 index 0000000000000000000000000000000000000000..889f670f9160b83a62706cc2f6372898a6b3d3b8 --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/addition/add_arr_val.ets @@ -0,0 +1,31 @@ +/*--- +Copyright (c) 2021-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. +---*/ +{%- for v in vals %} +/*--- +desc: >- + ArkTS provides a number of operators to act on character values: + Character operators that produce a value of type char. +---*/ + +const a: char[] = new char[1] + +function main() { + const v1 = {{v.v1}} + const v2 = {{v.v2}} + + a[0] = {{v.exp}} + assert a[0] == {{v.r}} +} +{%- endfor %} diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/addition/add_arr_val.params.yaml b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/addition/add_arr_val.params.yaml new file mode 100644 index 0000000000000000000000000000000000000000..d0417a7407e3efe00fdbc4ddce612d061de72902 --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/addition/add_arr_val.params.yaml @@ -0,0 +1,48 @@ +# Copyright (c) 2021-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. +--- +vals: + - v1: c'\u0020' + v2: c'\u0021' + exp: 'v1 + v2' + r: c'A' + + - v1: c'\u0020' + v2: c'\u0001' + exp: "v1 + v2 + c' '" + r: c'A' + + - v1: c'\uFFFF' + v2: c'\uFFFF' + exp: "v1 + v2" + r: c'\uFFFE' + + - v1: c'\uFFFF' + v2: c'\u0001' + exp: "v1 + v2" + r: c'\u0000' + + - v1: c'\uFFFF' + v2: c'\u000F' + exp: "v1 + c'\\u000F'" + r: c'\u000E' + + - v1: c'\u1010' + v2: c'\u0101' + exp: "v1 + c'\\u1010' + v2 + c'\\u0101'" + r: c'\u2222' + + - v1: c'∫' + v2: c'\x01' + exp: "v1 + v2" + r: c'∬' diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/addition/add_func_ref.ets b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/addition/add_func_ref.ets new file mode 100644 index 0000000000000000000000000000000000000000..96b9fe2a38f1c080d5bdddf837213a962cec4a49 --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/addition/add_func_ref.ets @@ -0,0 +1,32 @@ +/*--- +Copyright (c) 2021-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. +---*/ +{%- for v in vals %} +/*--- +desc: >- + ArkTS provides a number of operators to act on character values: + Character operators that produce a value of type char. +---*/ + +function add(p: Char, q: Char): Char { + return p + q // unboxing/boxing is expected here +} + +function main() { + const v1 = new Char({{v.v1}}) + const v2 = new Char({{v.v2}}) + + assert ({{v.exp}}) == {{v.r}} +} +{%- endfor %} diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/addition/add_func_ref.params.yaml b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/addition/add_func_ref.params.yaml new file mode 100644 index 0000000000000000000000000000000000000000..86a19326c9441202c86aadfb149cf37e281996ff --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/addition/add_func_ref.params.yaml @@ -0,0 +1,48 @@ +# Copyright (c) 2021-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. +--- +vals: + - v1: c'\u0020' + v2: c'\u0021' + exp: 'add(v1, v2)' + r: c'A' + + - v1: c'\u0020' + v2: c'\u0001' + exp: "add(v1, v2) + c' '" + r: c'A' + + - v1: c'\uFFFF' + v2: c'\uFFFF' + exp: "add(v1, v2)" + r: c'\uFFFE' + + - v1: c'\uFFFF' + v2: c'\u0001' + exp: "add(v1, v2)" + r: c'\u0000' + + - v1: c'\uFFFF' + v2: c'\u000F' + exp: "add(v1, c'\\u000F')" + r: c'\u000E' + + - v1: c'\u1010' + v2: c'\u0101' + exp: "add(v1 + c'\\u1010', v2 + c'\\u0101')" + r: c'\u2222' + + - v1: c'∫' + v2: c'\x01' + exp: "add(v1, v2)" + r: c'∬' diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/addition/add_func_val.ets b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/addition/add_func_val.ets new file mode 100644 index 0000000000000000000000000000000000000000..3e2ef0d2773951a83f85592a772b52a01ae2cdd7 --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/addition/add_func_val.ets @@ -0,0 +1,32 @@ +/*--- +Copyright (c) 2021-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. +---*/ +{%- for v in vals %} +/*--- +desc: >- + ArkTS provides a number of operators to act on character values: + Character operators that produce a value of type char. +---*/ + +function add(p: char, q: char): char { + return p + q +} + +function main() { + const v1 = {{v.v1}} + const v2 = {{v.v2}} + + assert ({{v.exp}}) == {{v.r}} +} +{%- endfor %} diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/addition/add_func_val.params.yaml b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/addition/add_func_val.params.yaml new file mode 100644 index 0000000000000000000000000000000000000000..86a19326c9441202c86aadfb149cf37e281996ff --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/addition/add_func_val.params.yaml @@ -0,0 +1,48 @@ +# Copyright (c) 2021-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. +--- +vals: + - v1: c'\u0020' + v2: c'\u0021' + exp: 'add(v1, v2)' + r: c'A' + + - v1: c'\u0020' + v2: c'\u0001' + exp: "add(v1, v2) + c' '" + r: c'A' + + - v1: c'\uFFFF' + v2: c'\uFFFF' + exp: "add(v1, v2)" + r: c'\uFFFE' + + - v1: c'\uFFFF' + v2: c'\u0001' + exp: "add(v1, v2)" + r: c'\u0000' + + - v1: c'\uFFFF' + v2: c'\u000F' + exp: "add(v1, c'\\u000F')" + r: c'\u000E' + + - v1: c'\u1010' + v2: c'\u0101' + exp: "add(v1 + c'\\u1010', v2 + c'\\u0101')" + r: c'\u2222' + + - v1: c'∫' + v2: c'\x01' + exp: "add(v1, v2)" + r: c'∬' diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/ch_n.ets b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/ch_n.ets new file mode 100644 index 0000000000000000000000000000000000000000..4ca18822978a428003250199184552af0023dcf5 --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/ch_n.ets @@ -0,0 +1,25 @@ +/*--- +Copyright (c) 2021-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. +---*/ + +{% for c in cases %} +/*--- +desc: check addition of two bytes +tags: [compile-only, negative] +---*/ + +function main() { + const v = {{c.exp}} +} +{% endfor %} diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/ch_n.params.yaml b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/ch_n.params.yaml new file mode 100644 index 0000000000000000000000000000000000000000..24bd9072f8a7cb074ac7bcafb2a766d4ba1f42ba --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/ch_n.params.yaml @@ -0,0 +1,27 @@ +# Copyright (c) 2021-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. + +--- +cases: + - exp: c'0' * c'2' + - exp: c'1' / c'1' + - exp: c'2' % c'2' + - exp: c'2' >> c'2' + - exp: c'2' >>> c'2' + - exp: c'2' << c'2' + - exp: c'2' & c'2' + - exp: c'2' && c'2' + - exp: c'2' | c'2' + - exp: c'2' || c'2' + - exp: c'2' ^ c'2' + - exp: "!c'2' && !c'2'" diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/comparison/cmp_ref.ets b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/comparison/cmp_ref.ets new file mode 100644 index 0000000000000000000000000000000000000000..c744a32bd93d3ed4ed5edec5bbc3e62fa04af3e2 --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/comparison/cmp_ref.ets @@ -0,0 +1,30 @@ +/*--- +Copyright (c) 2021-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. +---*/ +{%- for v in vals %} +/*--- +desc: >- + ArkTS provides a number of operators to act on character values: + Comparison operators that produce a value of type boolean. +---*/ + +function main() { + const v1: Char = new Char({{v.v1}}) + const v2: Char = new Char({{v.v2}}) + + {%- for c in v.cases %} + assert (v1 {{c.op}} v2) == {{c.r}} + {%- endfor %} +} +{%- endfor %} diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/comparison/cmp_ref.params.yaml b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/comparison/cmp_ref.params.yaml new file mode 100644 index 0000000000000000000000000000000000000000..432850f238a6c8d1669556041cdd45df78e547e6 --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/comparison/cmp_ref.params.yaml @@ -0,0 +1,53 @@ +# Copyright (c) 2021-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. +--- +vals: + - v1: c'\u0000' + v2: c'\u0000' + cases: + - { op: '==', r: 'true' } + - { op: '!=', r: 'false' } + - { op: '<', r: 'false' } + - { op: '<=', r: 'true' } + - { op: '>', r: 'false' } + - { op: '>=', r: 'true' } + + - v1: c'\uFFFF' + v2: c'\uFFFF' + cases: + - { op: '==', r: 'true' } + - { op: '!=', r: 'false' } + - { op: '<', r: 'false' } + - { op: '<=', r: 'true' } + - { op: '>', r: 'false' } + - { op: '>=', r: 'true' } + + - v1: c'\u000F' + v2: c'\uF000' + cases: + - { op: '==', r: 'false' } + - { op: '!=', r: 'true' } + - { op: '<', r: 'true' } + - { op: '<=', r: 'true' } + - { op: '>', r: 'false' } + - { op: '>=', r: 'false' } + + - v1: c'\u0100' + v2: c'\u00FF' + cases: + - { op: '==', r: 'false' } + - { op: '!=', r: 'true' } + - { op: '<', r: 'false' } + - { op: '<=', r: 'false' } + - { op: '>', r: 'true' } + - { op: '>=', r: 'true' } diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/comparison/cmp_val.ets b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/comparison/cmp_val.ets new file mode 100644 index 0000000000000000000000000000000000000000..08b6bcae9305ba6af01322ffff2cf0e71a939f5e --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/comparison/cmp_val.ets @@ -0,0 +1,30 @@ +/*--- +Copyright (c) 2021-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. +---*/ +{%- for v in vals %} +/*--- +desc: >- + ArkTS provides a number of operators to act on character values: + Comparison operators that produce a value of type boolean. +---*/ + +function main() { + const v1: char = {{v.v1}} + const v2: char = {{v.v2}} + + {%- for c in v.cases %} + assert (v1 {{c.op}} v2) == {{c.r}} + {%- endfor %} +} +{%- endfor %} diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/comparison/cmp_val.params.yaml b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/comparison/cmp_val.params.yaml new file mode 100644 index 0000000000000000000000000000000000000000..432850f238a6c8d1669556041cdd45df78e547e6 --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/comparison/cmp_val.params.yaml @@ -0,0 +1,53 @@ +# Copyright (c) 2021-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. +--- +vals: + - v1: c'\u0000' + v2: c'\u0000' + cases: + - { op: '==', r: 'true' } + - { op: '!=', r: 'false' } + - { op: '<', r: 'false' } + - { op: '<=', r: 'true' } + - { op: '>', r: 'false' } + - { op: '>=', r: 'true' } + + - v1: c'\uFFFF' + v2: c'\uFFFF' + cases: + - { op: '==', r: 'true' } + - { op: '!=', r: 'false' } + - { op: '<', r: 'false' } + - { op: '<=', r: 'true' } + - { op: '>', r: 'false' } + - { op: '>=', r: 'true' } + + - v1: c'\u000F' + v2: c'\uF000' + cases: + - { op: '==', r: 'false' } + - { op: '!=', r: 'true' } + - { op: '<', r: 'true' } + - { op: '<=', r: 'true' } + - { op: '>', r: 'false' } + - { op: '>=', r: 'false' } + + - v1: c'\u0100' + v2: c'\u00FF' + cases: + - { op: '==', r: 'false' } + - { op: '!=', r: 'true' } + - { op: '<', r: 'false' } + - { op: '<=', r: 'false' } + - { op: '>', r: 'true' } + - { op: '>=', r: 'true' } diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/concat/conc2.ets b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/concat/conc2.ets new file mode 100644 index 0000000000000000000000000000000000000000..c2bfe78216dd7be4a0585bb87a402d9f2ddbbf43 --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/concat/conc2.ets @@ -0,0 +1,25 @@ +/*--- +Copyright (c) 2021-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. +---*/ +/*--- +desc: >- + The string concatenation operator '+' (see String Concatenation), which (if a string operand and character + operand are available) converts the character operand to a string and then creates a concatenation of + the two strings as a new string. +---*/ +function main() { +{%- for v in vals %} + assert {{v.expr}} == {{v.res}} +{%- endfor %} +} diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/concat/conc2.params.yaml b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/concat/conc2.params.yaml new file mode 100644 index 0000000000000000000000000000000000000000..aa7474f3a426f69fea204a3cb6296f84feb542a5 --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/concat/conc2.params.yaml @@ -0,0 +1,39 @@ +# Copyright (c) 2021-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. +--- +vals: + - expr: "'a' + c'b' + 'c' + c'd'" + res: '"abcd"' + - expr: "'a' + c'b' + c'c' + c'd'" + res: '"abcd"' + - expr: "c'a' + 'b' + 'c' + c'd'" + res: '"abcd"' + - expr: "c'a' + c'b' + c'c' + c'd'" + res: c'Ɗ' + - expr: "c'a' + c'b' + c'c' + 'd'" + res: '"Ħd"' + - expr: "c'a' + c'b' + 'c' + 'd'" + res: '"Ãcd"' + + - expr: "'a' + new Char(c'b') + 'c' + new Char(c'd')" + res: '"abcd"' + - expr: "'a' + new Char(c'b') + new Char(c'c') + new Char(c'd')" + res: '"abcd"' + - expr: "new Char(c'a') + 'b' + 'c' + new Char(c'd')" + res: '"abcd"' + - expr: "new Char(c'a') + new Char(c'b') + new Char(c'c') + new Char(c'd')" + res: c'Ɗ' + - expr: "new Char(c'a') + new Char(c'b') + new Char(c'c') + 'd'" + res: '"Ħd"' + - expr: "new Char(c'a') + new Char(c'b') + 'c' + 'd'" + res: '"Ãcd"' diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/concat/conc_ref.ets b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/concat/conc_ref.ets new file mode 100644 index 0000000000000000000000000000000000000000..173bea5493cbb8a52f1cf1248d1451ec95ab95d9 --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/concat/conc_ref.ets @@ -0,0 +1,38 @@ +/*--- +Copyright (c) 2021-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. +---*/ +{%- for v in vals %} +/*--- +desc: >- + The string concatenation operator '+' (see String Concatenation), which (if a string operand and character + operand are available) converts the character operand to a string and then creates a concatenation of + the two strings as a new string. +---*/ +function main() { + const v1 = new Char({{v.v1}}) + const v2 = new Char({{v.v2}}) + + assert "" + v1 + v2 == {{v.r1}} + assert v1 + "" + v2 == {{v.r1}} + assert v1 + v2 + "" == {{v.r2}} + + assert "" + {{v.v1}} + v2 == {{v.r1}} + assert {{v.v1}} + "" + v2 == {{v.r1}} + assert {{v.v1}} + v2 + "" == {{v.r2}} + + assert "" + {{v.v1}} + {{v.v2}} == {{v.r1}} + assert {{v.v1}} + "" + {{v.v2}} == {{v.r1}} + assert {{v.v1}} + {{v.v2}} + "" == {{v.r2}} +} +{%- endfor %} diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/concat/conc_ref.params.yaml b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/concat/conc_ref.params.yaml new file mode 100644 index 0000000000000000000000000000000000000000..157a114e3368e5651bb7727aef37eb9a30bcd092 --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/concat/conc_ref.params.yaml @@ -0,0 +1,38 @@ +# Copyright (c) 2021-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. +--- +vals: + - v1: c'\u0020' + v2: c'\u0021' + r1: '" !"' + r2: '"A"' + + - v1: c'\uFFFF' + v2: c'\uFFFF' + r1: '"\uFFFF\uFFFF"' + r2: '"\uFFFE"' + + - v1: c'\uFFFF' + v2: c'\u0000' + r1: '"\uFFFF\u0000"' + r2: '"\uFFFF"' + + - v1: c'\u2200' + v2: c'\u002C' + r1: '"∀,"' + r2: '"∬"' + + - v1: c'1' + v2: c'2' + r1: '"12"' + r2: '"c"' diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/concat/conc_val.ets b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/concat/conc_val.ets new file mode 100644 index 0000000000000000000000000000000000000000..536ea8f31f5e8afcf40e72eed5ae0774500357e6 --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/concat/conc_val.ets @@ -0,0 +1,38 @@ +/*--- +Copyright (c) 2021-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. +---*/ +{%- for v in vals %} +/*--- +desc: >- + The string concatenation operator '+' (see String Concatenation), which (if a string operand and character + operand are available) converts the character operand to a string and then creates a concatenation of + the two strings as a new string. +---*/ +function main() { + let v1 = {{v.v1}} + let v2 = {{v.v2}} + + assert "" + v1 + v2 == {{v.r1}} + assert v1 + "" + v2 == {{v.r1}} + assert v1 + v2 + "" == {{v.r2}} + + assert "" + {{v.v1}} + v2 == {{v.r1}} + assert {{v.v1}} + "" + v2 == {{v.r1}} + assert {{v.v1}} + v2 + "" == {{v.r2}} + + assert "" + {{v.v1}} + {{v.v2}} == {{v.r1}} + assert {{v.v1}} + "" + {{v.v2}} == {{v.r1}} + assert {{v.v1}} + {{v.v2}} + "" == {{v.r2}} +} +{%- endfor %} diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/concat/conc_val.params.yaml b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/concat/conc_val.params.yaml new file mode 100644 index 0000000000000000000000000000000000000000..157a114e3368e5651bb7727aef37eb9a30bcd092 --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/concat/conc_val.params.yaml @@ -0,0 +1,38 @@ +# Copyright (c) 2021-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. +--- +vals: + - v1: c'\u0020' + v2: c'\u0021' + r1: '" !"' + r2: '"A"' + + - v1: c'\uFFFF' + v2: c'\uFFFF' + r1: '"\uFFFF\uFFFF"' + r2: '"\uFFFE"' + + - v1: c'\uFFFF' + v2: c'\u0000' + r1: '"\uFFFF\u0000"' + r2: '"\uFFFF"' + + - v1: c'\u2200' + v2: c'\u002C' + r1: '"∀,"' + r2: '"∬"' + + - v1: c'1' + v2: c'2' + r1: '"12"' + r2: '"c"' diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/conditional/cond_exp_val.ets b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/conditional/cond_exp_val.ets new file mode 100644 index 0000000000000000000000000000000000000000..61004b7e214f9cc7ee48db6e1f6e0b8c8e463d0a --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/conditional/cond_exp_val.ets @@ -0,0 +1,30 @@ +/*--- +Copyright (c) 2021-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. +---*/ +{%- for v in vals %} +/*--- +desc: >- + ArkTS provides a number of operators to act on character values: + Conditional operator ‘?:’ (see Conditional Expressions); +---*/ + +class A { + static b: boolean = {{v.b}} + static r: char = {{v.r}} +} + +function main() { + assert A.r - (A.b ? {{v.v1}} : {{v.v2}}) == c'\u0000' +} +{%- endfor %} diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/conditional/cond_exp_val.params.yaml b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/conditional/cond_exp_val.params.yaml new file mode 100644 index 0000000000000000000000000000000000000000..b0dbf41ae03ec1c29f15d0a19b0158939964c650 --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/conditional/cond_exp_val.params.yaml @@ -0,0 +1,34 @@ +# Copyright (c) 2021-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. +--- +vals: + - v1: c'\u0020' + v2: c'\u0021' + b: 'true' + r: c' ' + + - v1: c'\u0020' + v2: c'\uF041' + b: 'false' + r: c'A' + c'\uF000' + + - v1: c'\uFFFE' + c'\u0023' + v2: c'\u0021' + c'\u0001' + b: 'true' + r: c'!' + + - v1: 65535 as char + v2: 65534 as char + b: 'true' + r: c'\uFFFF' + diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/conditional/cond_fld_val.ets b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/conditional/cond_fld_val.ets new file mode 100644 index 0000000000000000000000000000000000000000..610e3a70a76c960f7797888a3fa4c0b19eff2ac5 --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/conditional/cond_fld_val.ets @@ -0,0 +1,32 @@ +/*--- +Copyright (c) 2021-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. +---*/ +{%- for v in vals %} +/*--- +desc: >- + ArkTS provides a number of operators to act on character values: + Conditional operator ‘?:’ (see Conditional Expressions); +---*/ + +class A { + static b: boolean = {{v.b}} + static v1: char = {{v.v1}} + static v2: char = {{v.v2}} + static r: char = {{v.r}} +} + +function main() { + assert (A.b ? A.v1 : A.v2) == A.r +} +{%- endfor %} diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/conditional/cond_fld_val.params.yaml b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/conditional/cond_fld_val.params.yaml new file mode 100644 index 0000000000000000000000000000000000000000..b94ed9f6a9abd8530c42270cca22292d1dc346cd --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/conditional/cond_fld_val.params.yaml @@ -0,0 +1,28 @@ +# Copyright (c) 2021-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. +--- +vals: + - v1: c'\u0020' + v2: c'\u0021' + b: 'true' + r: c' ' + + - v1: c'\u0020' + v2: c'\uF041' + b: 'false' + r: c'A' + c'\uF000' + + - v1: c'\uFFFE' + c'\u0023' + v2: c'\u0021' + c'\u0001' + b: 'true' + r: c'!' diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/conditional/cond_func_ref.ets b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/conditional/cond_func_ref.ets new file mode 100644 index 0000000000000000000000000000000000000000..ebcefaf9b48b59d613c0dd284b35755cd0e5db36 --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/conditional/cond_func_ref.ets @@ -0,0 +1,32 @@ +/*--- +Copyright (c) 2021-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. +---*/ +{%- for v in vals %} +/*--- +desc: >- + ArkTS provides a number of operators to act on character values: + Conditional operator ‘?:’ (see Conditional Expressions); +---*/ + +function foo(c: boolean, p: Char, q: Char): Char { + return c ? p : q +} + +function main() { + const v1 = new Char({{v.v1}}) + const v2 = new Char({{v.v2}}) + + assert ({{v.exp}}) == {{v.r}} +} +{%- endfor %} diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/conditional/cond_func_ref.params.yaml b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/conditional/cond_func_ref.params.yaml new file mode 100644 index 0000000000000000000000000000000000000000..987a257599f2d925f2d89efa7aadc47510858e53 --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/conditional/cond_func_ref.params.yaml @@ -0,0 +1,38 @@ +# Copyright (c) 2021-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. +--- +vals: + - v1: c'\u0020' + v2: c'\u0021' + exp: foo(true, v1, v2) + r: c' ' + + - v1: c'\u0020' + v2: c'\u0021' + exp: foo(false, v1, v2) + v1 + r: c'A' + + - v1: c'\u0020' + v2: c'\u0021' + exp: '" " + foo(false, v1, v2) + v1' + r: "' ! '" + + - v1: c'\u0020' + v2: c'\u0021' + exp: "c' ' + foo(false, v1, v2) + v1" + r: c'a' + + - v1: c'\u0020' + v2: c'\u0021' + exp: "c' ' + foo(false, v2 + v1, v2 - v1)" + r: v2 diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/conditional/cond_func_val.ets b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/conditional/cond_func_val.ets new file mode 100644 index 0000000000000000000000000000000000000000..af27bd37b6ea1b270c4eece153d79c55827ad621 --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/conditional/cond_func_val.ets @@ -0,0 +1,32 @@ +/*--- +Copyright (c) 2021-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. +---*/ +{%- for v in vals %} +/*--- +desc: >- + ArkTS provides a number of operators to act on character values: + Conditional operator ‘?:’ (see Conditional Expressions); +---*/ + +function foo(c: boolean, p: char, q: char): char { + return c ? p : q +} + +function main() { + const v1 = {{v.v1}} + const v2 = {{v.v2}} + + assert ({{v.exp}}) == {{v.r}} +} +{%- endfor %} diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/conditional/cond_func_val.params.yaml b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/conditional/cond_func_val.params.yaml new file mode 100644 index 0000000000000000000000000000000000000000..9c11aa0213933760135e1eb752ede5c6c9563b46 --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/conditional/cond_func_val.params.yaml @@ -0,0 +1,38 @@ +# Copyright (c) 2021-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. +--- +vals: + - v1: c'\u0020' + v2: c'\u0021' + exp: foo(true, v1, v2) + r: c' ' + + - v1: c'\u0020' + v2: c'\u0021' + exp: foo(false, v1, v2) + v + r: c'A' + + - v1: c'\u0020' + v2: c'\u0021' + exp: '" " + foo(false, v1, v2) + v1' + r: ' ! ' + + - v1: c'\u0020' + v2: c'\u0021' + exp: "c' ' + foo(false, v1, v2) + v1" + r: c'a' + + - v1: c'\u0020' + v2: c'\u0021' + exp: "c' ' + foo(false, v2 + v1, v2 - v1)" + r: v2 diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/decrement/dec_arr_ref.ets b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/decrement/dec_arr_ref.ets new file mode 100644 index 0000000000000000000000000000000000000000..2bcacfe64bb33648165f96ce0a460255dc5b2872 --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/decrement/dec_arr_ref.ets @@ -0,0 +1,34 @@ +/*--- +Copyright (c) 2021-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. +---*/ +{%- for v in vals %} +/*--- +desc: >- + ArkTS provides a number of operators to act on character values: + Character operators that produce a value of type char. +---*/ + +const a: Char[] = new Char[2] + +function main() { + let v1 = new Char({{v.v1}}) + + a[0] = --v1 + v1-- + a[1] = v1 + + assert a[0] == {{v.r1}} + assert a[1] == {{v.r2}} +} +{%- endfor %} diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/decrement/dec_arr_ref.params.yaml b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/decrement/dec_arr_ref.params.yaml new file mode 100644 index 0000000000000000000000000000000000000000..e1cf92dcecc509034befff33703a0920ec3f25ed --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/decrement/dec_arr_ref.params.yaml @@ -0,0 +1,33 @@ +# Copyright (c) 2021-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. +--- +vals: + - v1: c'\u0022' + r1: c'!' + r2: c' ' + + - v1: c'\x00' + r1: c'\uFFFF' + r2: c'\uFFFE' + + - v1: c'\u1110' + r1: c'\u110F' + r2: c'\u110E' + + - v1: c'\u0001' + r1: c'\u0000' + r2: c'\uFFFF' + + - v1: c'∭' + r1: c'∬' + r2: c'∫' diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/decrement/dec_arr_val.ets b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/decrement/dec_arr_val.ets new file mode 100644 index 0000000000000000000000000000000000000000..f8eaca85e3e38712318ff00608022afc25a36008 --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/decrement/dec_arr_val.ets @@ -0,0 +1,34 @@ +/*--- +Copyright (c) 2021-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. +---*/ +{%- for v in vals %} +/*--- +desc: >- + ArkTS provides a number of operators to act on character values: + Character operators that produce a value of type char. +---*/ + +const a: char[] = new char[2] + +function main() { + let v1 = {{v.v1}} + + a[0] = --v1 + v1-- + a[1] = v1 + + assert a[0] == {{v.r1}} + assert a[1] == {{v.r2}} +} +{%- endfor %} diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/decrement/dec_arr_val.params.yaml b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/decrement/dec_arr_val.params.yaml new file mode 100644 index 0000000000000000000000000000000000000000..e1cf92dcecc509034befff33703a0920ec3f25ed --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/decrement/dec_arr_val.params.yaml @@ -0,0 +1,33 @@ +# Copyright (c) 2021-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. +--- +vals: + - v1: c'\u0022' + r1: c'!' + r2: c' ' + + - v1: c'\x00' + r1: c'\uFFFF' + r2: c'\uFFFE' + + - v1: c'\u1110' + r1: c'\u110F' + r2: c'\u110E' + + - v1: c'\u0001' + r1: c'\u0000' + r2: c'\uFFFF' + + - v1: c'∭' + r1: c'∬' + r2: c'∫' diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/decrement/dec_func_ref.ets b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/decrement/dec_func_ref.ets new file mode 100644 index 0000000000000000000000000000000000000000..422f0c7e5d30ac50a4a5d7aaeba581d1c58c5b87 --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/decrement/dec_func_ref.ets @@ -0,0 +1,36 @@ +/*--- +Copyright (c) 2021-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. +---*/ +{%- for v in vals %} +/*--- +desc: >- + ArkTS provides a number of operators to act on character values: + Character operators that produce a value of type char. +---*/ + +function decPre(p: Char): Char { + return --p +} + +function decPost(p: Char): Char { + p-- + return p +} + +function main() { + const v1 = new Char({{v.v1}}) + + assert ({{v.exp}}) == {{v.res}} +} +{%- endfor %} diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/decrement/dec_func_ref.params.yaml b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/decrement/dec_func_ref.params.yaml new file mode 100644 index 0000000000000000000000000000000000000000..48363f1ce9e36a80fb6322187615d1833b5d55d7 --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/decrement/dec_func_ref.params.yaml @@ -0,0 +1,69 @@ +# Copyright (c) 2021-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. +--- +vals: + - v1: c'\u0021' + exp: 'decPre(v1)' + res: c' ' + + - v1: c'\u0022' + exp: 'decPost(v1)' + res: c'!' + + - v1: c'"' + exp: "c' ' + decPre(v1)" + res: c'A' + + - v1: c'\u0020' + exp: "c' ' + decPost(v1)" + res: c'?' + + - v1: c'\u0000' + exp: "decPre(v1)" + res: c'\uFFFF' + + - v1: c'\u0000' + exp: "decPost(v1)" + res: c'\uFFFF' + + - v1: c'\u00FF' + exp: "decPre(c'!' + v1 + v1)" + res: c'\u021E' + + - v1: c'\u0001' + exp: "decPost(v1 - c'!' - v1)" + res: c'\uFFDE' + + - v1: c'\u0F0F' + exp: "decPre(v1 - c'1') - decPre(c'\\uACD9')" + res: c'\u6205' + + - v1: c'\u0F0F' + exp: "decPost(v1 + c'1') + decPost(c'\\uACD9')" + res: c'\uBC17' + + - v1: c'\u1110' + exp: "decPre(c'\\u0000') - decPre(v1)" + res: c'\uEEF0' + + - v1: c'\u1000' + exp: "decPost(c'\\u0000') - decPost(v1)" + res: c'\uF000' + + - v1: c'∬' + exp: "decPre(v1)" + res: c'∫' + + - v1: c'∬' + exp: "decPost(v1)" + res: c'∫' diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/decrement/dec_func_val.ets b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/decrement/dec_func_val.ets new file mode 100644 index 0000000000000000000000000000000000000000..32e4a17ac617296bbd021b555ffff7315f2664bf --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/decrement/dec_func_val.ets @@ -0,0 +1,36 @@ +/*--- +Copyright (c) 2021-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. +---*/ +{%- for v in vals %} +/*--- +desc: >- + ArkTS provides a number of operators to act on character values: + Character operators that produce a value of type char. +---*/ + +function decPre(p: char): char { + return --p +} + +function decPost(p: char): char { + p-- + return p +} + +function main() { + const v1 = {{v.v1}} + + assert ({{v.exp}}) == {{v.res}} +} +{%- endfor %} diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/decrement/dec_func_val.params.yaml b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/decrement/dec_func_val.params.yaml new file mode 100644 index 0000000000000000000000000000000000000000..48363f1ce9e36a80fb6322187615d1833b5d55d7 --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/decrement/dec_func_val.params.yaml @@ -0,0 +1,69 @@ +# Copyright (c) 2021-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. +--- +vals: + - v1: c'\u0021' + exp: 'decPre(v1)' + res: c' ' + + - v1: c'\u0022' + exp: 'decPost(v1)' + res: c'!' + + - v1: c'"' + exp: "c' ' + decPre(v1)" + res: c'A' + + - v1: c'\u0020' + exp: "c' ' + decPost(v1)" + res: c'?' + + - v1: c'\u0000' + exp: "decPre(v1)" + res: c'\uFFFF' + + - v1: c'\u0000' + exp: "decPost(v1)" + res: c'\uFFFF' + + - v1: c'\u00FF' + exp: "decPre(c'!' + v1 + v1)" + res: c'\u021E' + + - v1: c'\u0001' + exp: "decPost(v1 - c'!' - v1)" + res: c'\uFFDE' + + - v1: c'\u0F0F' + exp: "decPre(v1 - c'1') - decPre(c'\\uACD9')" + res: c'\u6205' + + - v1: c'\u0F0F' + exp: "decPost(v1 + c'1') + decPost(c'\\uACD9')" + res: c'\uBC17' + + - v1: c'\u1110' + exp: "decPre(c'\\u0000') - decPre(v1)" + res: c'\uEEF0' + + - v1: c'\u1000' + exp: "decPost(c'\\u0000') - decPost(v1)" + res: c'\uF000' + + - v1: c'∬' + exp: "decPre(v1)" + res: c'∫' + + - v1: c'∬' + exp: "decPost(v1)" + res: c'∫' diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/increment/inc_arr_ref.ets b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/increment/inc_arr_ref.ets new file mode 100644 index 0000000000000000000000000000000000000000..2acd9331dab6c3614787d93f6cdc4416b711542c --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/increment/inc_arr_ref.ets @@ -0,0 +1,34 @@ +/*--- +Copyright (c) 2021-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. +---*/ +{%- for v in vals %} +/*--- +desc: >- + ArkTS provides a number of operators to act on character values: + Character operators that produce a value of type char. +---*/ + +const a: Char[] = new Char[2] + +function main() { + let v1 = new Char({{v.v1}}) + + a[0] = ++v1 + v1++ + a[1] = v1 + + assert a[0] == {{v.r1}} + assert a[1] == {{v.r2}} +} +{%- endfor %} diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/increment/inc_arr_ref.params.yaml b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/increment/inc_arr_ref.params.yaml new file mode 100644 index 0000000000000000000000000000000000000000..99c330c86746d75153ab4a74c9d7e9097128a981 --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/increment/inc_arr_ref.params.yaml @@ -0,0 +1,37 @@ +# Copyright (c) 2021-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. +--- +vals: + - v1: c'\u0020' + r1: c'!' + r2: c'"' + + - v1: c'\x00' + r1: c'\x01' + r2: c'\x02' + + - v1: c'\uFFFF' + r1: c'\u0000' + r2: c'\u0001' + + - v1: c'\u007F' + r1: c'\u0080' + r2: c'\u0081; + + - v1: c'\u00FF' + r1: c'\u0100' + r2: c'\u0101; + + - v1: c'∫' + r1: c'∬' + r2: c'∭' diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/increment/inc_arr_val.ets b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/increment/inc_arr_val.ets new file mode 100644 index 0000000000000000000000000000000000000000..0266760cfff87d9ec14efa55e4c5ec2a755c8c62 --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/increment/inc_arr_val.ets @@ -0,0 +1,34 @@ +/*--- +Copyright (c) 2021-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. +---*/ +{%- for v in vals %} +/*--- +desc: >- + ArkTS provides a number of operators to act on character values: + Character operators that produce a value of type char. +---*/ + +const a: char[] = new char[2] + +function main() { + let v1 = {{v.v1}} + + a[0] = ++v1 + v1++ + a[1] = v1 + + assert a[0] == {{v.r1}} + assert a[1] == {{v.r2}} +} +{%- endfor %} diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/increment/inc_arr_val.params.yaml b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/increment/inc_arr_val.params.yaml new file mode 100644 index 0000000000000000000000000000000000000000..99c330c86746d75153ab4a74c9d7e9097128a981 --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/increment/inc_arr_val.params.yaml @@ -0,0 +1,37 @@ +# Copyright (c) 2021-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. +--- +vals: + - v1: c'\u0020' + r1: c'!' + r2: c'"' + + - v1: c'\x00' + r1: c'\x01' + r2: c'\x02' + + - v1: c'\uFFFF' + r1: c'\u0000' + r2: c'\u0001' + + - v1: c'\u007F' + r1: c'\u0080' + r2: c'\u0081; + + - v1: c'\u00FF' + r1: c'\u0100' + r2: c'\u0101; + + - v1: c'∫' + r1: c'∬' + r2: c'∭' diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/increment/inc_func_ref.ets b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/increment/inc_func_ref.ets new file mode 100644 index 0000000000000000000000000000000000000000..471ba513144072c1ad610159981921e4cb09bc7b --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/increment/inc_func_ref.ets @@ -0,0 +1,36 @@ +/*--- +Copyright (c) 2021-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. +---*/ +{%- for v in vals %} +/*--- +desc: >- + ArkTS provides a number of operators to act on character values: + Character operators that produce a value of type char. +---*/ + +function incPre(p: Char): Char { + return ++p +} + +function incPost(p: Char): Char { + p++ + return p +} + +function main() { + const v1 = new Char({{v.v1}}) + + assert ({{v.exp}}) == {{v.res}} +} +{%- endfor %} diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/increment/inc_func_ref.params.yaml b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/increment/inc_func_ref.params.yaml new file mode 100644 index 0000000000000000000000000000000000000000..d72c666673928b66f9664cdb55851209d076949d --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/increment/inc_func_ref.params.yaml @@ -0,0 +1,69 @@ +# Copyright (c) 2021-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. +--- +vals: + - v1: c'\u0020' + exp: 'incPre(v1)' + res: c'!' + + - v1: c'\u0020' + exp: 'incPost(v1)' + res: c'!' + + - v1: c'\u0020' + exp: "c' ' + incPre(v1)" + res: c'A' + + - v1: c'\u0020' + exp: "c' ' + incPost(v1)" + res: c'A' + + - v1: c'\uFFFF' + exp: "incPre(v1)" + res: c'\x00' + + - v1: c'\uFFFF' + exp: "incPost(v1)" + res: c'\x00' + + - v1: c'\uFFFF' + exp: "incPre(c'!' + v1 + v1)" + res: c'\u0020' + + - v1: c'\uFFFF' + exp: "incPost(c'!' + v1 + v1)" + res: c'\u0020' + + - v1: c'\u0F0F' + exp: "incPre(v1 + c'1') + incPre(c'\\uACD9')" + res: c'\uBC1B' + + - v1: c'\u0F0F' + exp: "incPost(v1 + c'1') + incPost(c'\\uACD9')" + res: c'\uBC1B' + + - v1: c'\u007F' + exp: "incPre(c'\\u0000') + incPre(v1)" + res: c'\u0081' + + - v1: c'\u007F' + exp: "incPost(c'\\u0000') + incPost(v1)" + res: c'\u0081' + + - v1: c'∫' + exp: "incPre(v1)" + res: c'∬' + + - v1: c'∫' + exp: "incPost(v1)" + res: c'∬' diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/increment/inc_func_val.ets b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/increment/inc_func_val.ets new file mode 100644 index 0000000000000000000000000000000000000000..9c26217d293747f07165700ac1437a67ad5aa64e --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/increment/inc_func_val.ets @@ -0,0 +1,36 @@ +/*--- +Copyright (c) 2021-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. +---*/ +{%- for v in vals %} +/*--- +desc: >- + ArkTS provides a number of operators to act on character values: + Character operators that produce a value of type char. +---*/ + +function incPre(p: char): char { + return ++p +} + +function incPost(p: char): char { + p++ + return p +} + +function main() { + const v1 = {{v.v1}} + + assert ({{v.exp}}) == {{v.res}} +} +{%- endfor %} diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/increment/inc_func_val.params.yaml b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/increment/inc_func_val.params.yaml new file mode 100644 index 0000000000000000000000000000000000000000..d72c666673928b66f9664cdb55851209d076949d --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/increment/inc_func_val.params.yaml @@ -0,0 +1,69 @@ +# Copyright (c) 2021-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. +--- +vals: + - v1: c'\u0020' + exp: 'incPre(v1)' + res: c'!' + + - v1: c'\u0020' + exp: 'incPost(v1)' + res: c'!' + + - v1: c'\u0020' + exp: "c' ' + incPre(v1)" + res: c'A' + + - v1: c'\u0020' + exp: "c' ' + incPost(v1)" + res: c'A' + + - v1: c'\uFFFF' + exp: "incPre(v1)" + res: c'\x00' + + - v1: c'\uFFFF' + exp: "incPost(v1)" + res: c'\x00' + + - v1: c'\uFFFF' + exp: "incPre(c'!' + v1 + v1)" + res: c'\u0020' + + - v1: c'\uFFFF' + exp: "incPost(c'!' + v1 + v1)" + res: c'\u0020' + + - v1: c'\u0F0F' + exp: "incPre(v1 + c'1') + incPre(c'\\uACD9')" + res: c'\uBC1B' + + - v1: c'\u0F0F' + exp: "incPost(v1 + c'1') + incPost(c'\\uACD9')" + res: c'\uBC1B' + + - v1: c'\u007F' + exp: "incPre(c'\\u0000') + incPre(v1)" + res: c'\u0081' + + - v1: c'\u007F' + exp: "incPost(c'\\u0000') + incPost(v1)" + res: c'\u0081' + + - v1: c'∫' + exp: "incPre(v1)" + res: c'∬' + + - v1: c'∫' + exp: "incPost(v1)" + res: c'∬' diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/subtraction/sub_arr_ref.ets b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/subtraction/sub_arr_ref.ets new file mode 100644 index 0000000000000000000000000000000000000000..f3b8a0845a3c788d65bb5e8b97aea6704f85293f --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/subtraction/sub_arr_ref.ets @@ -0,0 +1,31 @@ +/*--- +Copyright (c) 2021-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. +---*/ +{%- for v in vals %} +/*--- +desc: >- + ArkTS provides a number of operators to act on character values: + Character operators that produce a value of type char. +---*/ + +const a: Char[] = new Char[1] + +function main() { + const v1 = new Char({{v.v1}}) + const v2 = new Char({{v.v2}}) + + a[0] = {{v.exp}} + assert a[0] == {{v.r}} +} +{%- endfor %} diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/subtraction/sub_arr_ref.params.yaml b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/subtraction/sub_arr_ref.params.yaml new file mode 100644 index 0000000000000000000000000000000000000000..6521acad47d60eb4d2cbec655d99c639cb6d1fa1 --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/subtraction/sub_arr_ref.params.yaml @@ -0,0 +1,48 @@ +# Copyright (c) 2021-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. +--- +vals: + - v1: c'\u0020' + v2: c'\u0041' + exp: 'v2 - v1' + r: c'!' + + - v1: c'\u0041' + v2: c'\u0001' + exp: "v1 - v2 - c' '" + r: c' ' + + - v1: c'\uFFFF' + v2: c'\uFFFF' + exp: 'v1 - v2' + r: c'\u0000' + + - v1: c'\uFFFF' + v2: c'\u0000' + exp: 'v2 - v1' + r: c'\u0001' + + - v1: c'\uFFFF' + v2: c'\u000F' + exp: "c'\\u000F' - v1" + r: c'\u0010' + + - v1: c'\u1010' + v2: c'\u0101' + exp: "v1 - c'\\u0101' - v2 - c'\\u1010'" + r: c'\uFDFE' + + - v1: c'∬' + v2: c'\x01' + exp: 'v1 - v2' + r: c'∫' diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/subtraction/sub_arr_val.ets b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/subtraction/sub_arr_val.ets new file mode 100644 index 0000000000000000000000000000000000000000..889f670f9160b83a62706cc2f6372898a6b3d3b8 --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/subtraction/sub_arr_val.ets @@ -0,0 +1,31 @@ +/*--- +Copyright (c) 2021-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. +---*/ +{%- for v in vals %} +/*--- +desc: >- + ArkTS provides a number of operators to act on character values: + Character operators that produce a value of type char. +---*/ + +const a: char[] = new char[1] + +function main() { + const v1 = {{v.v1}} + const v2 = {{v.v2}} + + a[0] = {{v.exp}} + assert a[0] == {{v.r}} +} +{%- endfor %} diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/subtraction/sub_arr_val.params.yaml b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/subtraction/sub_arr_val.params.yaml new file mode 100644 index 0000000000000000000000000000000000000000..6521acad47d60eb4d2cbec655d99c639cb6d1fa1 --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/subtraction/sub_arr_val.params.yaml @@ -0,0 +1,48 @@ +# Copyright (c) 2021-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. +--- +vals: + - v1: c'\u0020' + v2: c'\u0041' + exp: 'v2 - v1' + r: c'!' + + - v1: c'\u0041' + v2: c'\u0001' + exp: "v1 - v2 - c' '" + r: c' ' + + - v1: c'\uFFFF' + v2: c'\uFFFF' + exp: 'v1 - v2' + r: c'\u0000' + + - v1: c'\uFFFF' + v2: c'\u0000' + exp: 'v2 - v1' + r: c'\u0001' + + - v1: c'\uFFFF' + v2: c'\u000F' + exp: "c'\\u000F' - v1" + r: c'\u0010' + + - v1: c'\u1010' + v2: c'\u0101' + exp: "v1 - c'\\u0101' - v2 - c'\\u1010'" + r: c'\uFDFE' + + - v1: c'∬' + v2: c'\x01' + exp: 'v1 - v2' + r: c'∫' diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/subtraction/sub_func_ref.ets b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/subtraction/sub_func_ref.ets new file mode 100644 index 0000000000000000000000000000000000000000..c12a5ad80fc5ebd8b202319ba16e120fb706004b --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/subtraction/sub_func_ref.ets @@ -0,0 +1,32 @@ +/*--- +Copyright (c) 2021-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. +---*/ +{%- for v in vals %} +/*--- +desc: >- + ArkTS provides a number of operators to act on character values: + Character operators that produce a value of type char. +---*/ + +function sub(p: Char, q: Char): Char { + return p - q +} + +function main() { + const v1 = new Char({{v.v1}}) + const v2 = new Char({{v.v2}}) + + assert ({{v.exp}}) == {{v.r}} +} +{%- endfor %} diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/subtraction/sub_func_ref.params.yaml b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/subtraction/sub_func_ref.params.yaml new file mode 100644 index 0000000000000000000000000000000000000000..38c8a3a2b2c24c0d9dd3522d486bd8004466f62f --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/subtraction/sub_func_ref.params.yaml @@ -0,0 +1,48 @@ +# Copyright (c) 2021-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. +--- +vals: + - v1: c'\u0020' + v2: c'\u0041' + exp: 'sub(v2, v1)' + r: c'!' + + - v1: c'\u0041' + v2: c'\u0001' + exp: "sub(v1, v2) - c' '" + r: c' ' + + - v1: c'\uFFFF' + v2: c'\uFFFF' + exp: 'sub(v1, v2)' + r: c'\u0000' + + - v1: c'\uFFFF' + v2: c'\u0000' + exp: 'sub(v2, v1)' + r: c'\u0001' + + - v1: c'\uFFFF' + v2: c'\u000F' + exp: "sub(c'\\u000F', v1)" + r: c'\u0010' + + - v1: c'\u1010' + v2: c'\u0101' + exp: "sub(v1 - c'\\u0101', v2 - c'\\u1010')" + r: c'\u1E1E' + + - v1: c'∬' + v2: c'\x01' + exp: 'sub(v1, v2)' + r: c'∫' diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/subtraction/sub_func_val.ets b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/subtraction/sub_func_val.ets new file mode 100644 index 0000000000000000000000000000000000000000..ad928ef5bda3ce8820edec728453753f20f916b2 --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/subtraction/sub_func_val.ets @@ -0,0 +1,32 @@ +/*--- +Copyright (c) 2021-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. +---*/ +{%- for v in vals %} +/*--- +desc: >- + ArkTS provides a number of operators to act on character values: + Character operators that produce a value of type char. +---*/ + +function sub(p: char, q: char): char { + return p - q +} + +function main() { + const v1 = {{v.v1}} + const v2 = {{v.v2}} + + assert ({{v.exp}}) == {{v.r}} +} +{%- endfor %} diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/subtraction/sub_func_val.params.yaml b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/subtraction/sub_func_val.params.yaml new file mode 100644 index 0000000000000000000000000000000000000000..38c8a3a2b2c24c0d9dd3522d486bd8004466f62f --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/subtraction/sub_func_val.params.yaml @@ -0,0 +1,48 @@ +# Copyright (c) 2021-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. +--- +vals: + - v1: c'\u0020' + v2: c'\u0041' + exp: 'sub(v2, v1)' + r: c'!' + + - v1: c'\u0041' + v2: c'\u0001' + exp: "sub(v1, v2) - c' '" + r: c' ' + + - v1: c'\uFFFF' + v2: c'\uFFFF' + exp: 'sub(v1, v2)' + r: c'\u0000' + + - v1: c'\uFFFF' + v2: c'\u0000' + exp: 'sub(v2, v1)' + r: c'\u0001' + + - v1: c'\uFFFF' + v2: c'\u000F' + exp: "sub(c'\\u000F', v1)" + r: c'\u0010' + + - v1: c'\u1010' + v2: c'\u0101' + exp: "sub(v1 - c'\\u0101', v2 - c'\\u1010')" + r: c'\u1E1E' + + - v1: c'∬' + v2: c'\x01' + exp: 'sub(v1, v2)' + r: c'∫' diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/unary/unary_ref.ets b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/unary/unary_ref.ets new file mode 100644 index 0000000000000000000000000000000000000000..5fc15f990b30ab1040359faaee597b8b5c363741 --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/unary/unary_ref.ets @@ -0,0 +1,35 @@ +/*--- +Copyright (c) 2021-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. +---*/ +{%- for v in vals %} +/*--- +desc: >- + ArkTS provides a number of operators to act on character values: + Character operators that produce a value of type char. +---*/ + +function minus(p: Char): Char { + return -p +} + +function plus(p: Char): Char { + return +p +} + +function main() { + const v1 = new Char({{v.v1}}) + + assert ({{v.exp}}) == {{v.r}} +} +{%- endfor %} diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/unary/unary_ref.params.yaml b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/unary/unary_ref.params.yaml new file mode 100644 index 0000000000000000000000000000000000000000..c4baf0ac2bc358f4094af8c7f7a503be870175da --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/unary/unary_ref.params.yaml @@ -0,0 +1,41 @@ +# Copyright (c) 2021-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. +--- +vals: + - v1: c'\u0020' + exp: 'minus(plus(v1)) - plus(minus(v1))' + r: c'\u0000' + + - v1: c'∬' + exp: 'plus(v1)' + r: c'∬' + + - v1: c'∬' + exp: 'minus(v1)' + r: c'\uDDD4' + + - v1: c'\uFFFF' + exp: 'minus(v1)' + r: c'\u0001' + + - v1: c'\uFFFF' + exp: 'plus(v1)' + r: c'\uFFFF' + + - v1: c'\u0000' + exp: 'minus(v1)' + r: c'\u0000' + + - v1: c'\u0000' + exp: 'plus(v1)' + r: c'\u0000' diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/unary/unary_val.ets b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/unary/unary_val.ets new file mode 100644 index 0000000000000000000000000000000000000000..d4f9b8ea3f82293bf0cc45a186d7e3af206eb234 --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/unary/unary_val.ets @@ -0,0 +1,35 @@ +/*--- +Copyright (c) 2021-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. +---*/ +{%- for v in vals %} +/*--- +desc: >- + ArkTS provides a number of operators to act on character values: + Character operators that produce a value of type char. +---*/ + +function minus(p: char): char { + return -p +} + +function plus(p: char): char { + return +p +} + +function main() { + const v1 = {{v.v1}} + + assert ({{v.exp}}) == {{v.r}} +} +{%- endfor %} diff --git a/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/unary/unary_val.params.yaml b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/unary/unary_val.params.yaml new file mode 100644 index 0000000000000000000000000000000000000000..c4baf0ac2bc358f4094af8c7f7a503be870175da --- /dev/null +++ b/plugins/ets/tests/ets-templates/03.types/07.value_types/05.character_types_and_operations/unary/unary_val.params.yaml @@ -0,0 +1,41 @@ +# Copyright (c) 2021-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. +--- +vals: + - v1: c'\u0020' + exp: 'minus(plus(v1)) - plus(minus(v1))' + r: c'\u0000' + + - v1: c'∬' + exp: 'plus(v1)' + r: c'∬' + + - v1: c'∬' + exp: 'minus(v1)' + r: c'\uDDD4' + + - v1: c'\uFFFF' + exp: 'minus(v1)' + r: c'\u0001' + + - v1: c'\uFFFF' + exp: 'plus(v1)' + r: c'\uFFFF' + + - v1: c'\u0000' + exp: 'minus(v1)' + r: c'\u0000' + + - v1: c'\u0000' + exp: 'plus(v1)' + r: c'\u0000' diff --git a/scripts/sdk/build_sdk.sh b/scripts/sdk/build_sdk.sh index 0edbb1aeb654e61ea6f51ff6458ab0eea55e471f..6361f6d1d4ee3fdab5cd9e118a58a7db31810095 100755 --- a/scripts/sdk/build_sdk.sh +++ b/scripts/sdk/build_sdk.sh @@ -158,7 +158,7 @@ ts_linter() { # Clean up rm "$TGZ" - rm "$LINTER_ROOT"/package-lock.json + rm -f "$LINTER_ROOT"/package-lock.json rm -rf "$LINTER_ROOT"/build rm -rf "$LINTER_ROOT"/bundle rm -rf "$LINTER_ROOT"/dist diff --git a/tests/tests-u-runner/runner/plugins/ets/ets-cts-ignored.txt b/tests/tests-u-runner/runner/plugins/ets/ets-cts-ignored.txt index 63e4c0c49232734230940012901102777cc5a7f5..f31d42afdb9beb12278bf547a1fc89127c52f664 100644 --- a/tests/tests-u-runner/runner/plugins/ets/ets-cts-ignored.txt +++ b/tests/tests-u-runner/runner/plugins/ets/ets-cts-ignored.txt @@ -451,14 +451,6 @@ 07.expressions/01.evaluation_of_expressions/02.normal_and_abrupt_completion_of_expression_evaluation/ase1.ets # end of verifier problems # runtime fails: panda#11542 -03.types/07.value_types/01.integer_types_and_operations/postfix_decrement/postfix_decrement_byte_3.ets -03.types/07.value_types/01.integer_types_and_operations/postfix_decrement/postfix_decrement_short_3.ets -03.types/07.value_types/01.integer_types_and_operations/postfix_increment/postfix_increment_byte_4.ets -03.types/07.value_types/01.integer_types_and_operations/postfix_increment/postfix_increment_short_4.ets -03.types/07.value_types/01.integer_types_and_operations/prefix_decrement/prefix_decrement_byte_3.ets -03.types/07.value_types/01.integer_types_and_operations/prefix_decrement/prefix_decrement_short_3.ets -03.types/07.value_types/01.integer_types_and_operations/prefix_increment/prefix_increment_byte_4.ets -03.types/07.value_types/01.integer_types_and_operations/prefix_increment/prefix_increment_short_4.ets 03.types/07.value_types/01.integer_types_and_operations/right_shift/right_shift_long_10.ets 03.types/07.value_types/01.integer_types_and_operations/unsigned_right_shift/unsigned_right_shift_byte_7.ets 03.types/07.value_types/01.integer_types_and_operations/unsigned_right_shift/unsigned_right_shift_short_7.ets @@ -986,7 +978,6 @@ 03.types/07.value_types/01.integer_types_and_operations/not_equal/not_equal_ushort_7.ets 03.types/07.value_types/01.integer_types_and_operations/not_equal/not_equal_ushort_8.ets 03.types/07.value_types/01.integer_types_and_operations/not_equal/not_equal_ushort_9.ets -03.types/07.value_types/01.integer_types_and_operations/postfix_decrement/postfix_decrement_char_2.ets 03.types/07.value_types/01.integer_types_and_operations/postfix_decrement/postfix_decrement_ubyte_0.ets 03.types/07.value_types/01.integer_types_and_operations/postfix_decrement/postfix_decrement_ubyte_1.ets 03.types/07.value_types/01.integer_types_and_operations/postfix_decrement/postfix_decrement_ubyte_2.ets @@ -1008,7 +999,6 @@ 03.types/07.value_types/01.integer_types_and_operations/postfix_decrement/postfix_decrement_ushort_2.ets 03.types/07.value_types/01.integer_types_and_operations/postfix_decrement/postfix_decrement_ushort_3.ets 03.types/07.value_types/01.integer_types_and_operations/postfix_decrement/postfix_decrement_ushort_4.ets -03.types/07.value_types/01.integer_types_and_operations/postfix_increment/postfix_increment_char_3.ets 03.types/07.value_types/01.integer_types_and_operations/postfix_increment/postfix_increment_ubyte_0.ets 03.types/07.value_types/01.integer_types_and_operations/postfix_increment/postfix_increment_ubyte_1.ets 03.types/07.value_types/01.integer_types_and_operations/postfix_increment/postfix_increment_ubyte_2.ets @@ -1029,7 +1019,6 @@ 03.types/07.value_types/01.integer_types_and_operations/postfix_increment/postfix_increment_ushort_2.ets 03.types/07.value_types/01.integer_types_and_operations/postfix_increment/postfix_increment_ushort_3.ets 03.types/07.value_types/01.integer_types_and_operations/postfix_increment/postfix_increment_ushort_4.ets -03.types/07.value_types/01.integer_types_and_operations/prefix_decrement/prefix_decrement_char_2.ets 03.types/07.value_types/01.integer_types_and_operations/prefix_decrement/prefix_decrement_ubyte_0.ets 03.types/07.value_types/01.integer_types_and_operations/prefix_decrement/prefix_decrement_ubyte_1.ets 03.types/07.value_types/01.integer_types_and_operations/prefix_decrement/prefix_decrement_ubyte_2.ets @@ -1050,7 +1039,6 @@ 03.types/07.value_types/01.integer_types_and_operations/prefix_decrement/prefix_decrement_ushort_2.ets 03.types/07.value_types/01.integer_types_and_operations/prefix_decrement/prefix_decrement_ushort_3.ets 03.types/07.value_types/01.integer_types_and_operations/prefix_decrement/prefix_decrement_ushort_4.ets -03.types/07.value_types/01.integer_types_and_operations/prefix_increment/prefix_increment_char_3.ets 03.types/07.value_types/01.integer_types_and_operations/prefix_increment/prefix_increment_ubyte_0.ets 03.types/07.value_types/01.integer_types_and_operations/prefix_increment/prefix_increment_ubyte_1.ets 03.types/07.value_types/01.integer_types_and_operations/prefix_increment/prefix_increment_ubyte_2.ets @@ -1921,6 +1909,123 @@ 05.generics/05.parameterized_declarations/type_arguments_of_parameterized_declarations/method_args1_13.ets # end of verifier fails +# es2panda fails: panda#14140 +03.types/07.value_types/05.character_types_and_operations/ch_n_0.ets +03.types/07.value_types/05.character_types_and_operations/ch_n_1.ets +03.types/07.value_types/05.character_types_and_operations/ch_n_10.ets +03.types/07.value_types/05.character_types_and_operations/ch_n_2.ets +03.types/07.value_types/05.character_types_and_operations/ch_n_3.ets +03.types/07.value_types/05.character_types_and_operations/ch_n_4.ets +03.types/07.value_types/05.character_types_and_operations/ch_n_5.ets +03.types/07.value_types/05.character_types_and_operations/ch_n_6.ets +03.types/07.value_types/05.character_types_and_operations/ch_n_8.ets +# end of es2panda fails + +# es2panda fails: panda#14110 +03.types/07.value_types/05.character_types_and_operations/decrement/dec_func_ref_6.ets +03.types/07.value_types/05.character_types_and_operations/decrement/dec_func_ref_7.ets +03.types/07.value_types/05.character_types_and_operations/decrement/dec_func_ref_8.ets +03.types/07.value_types/05.character_types_and_operations/decrement/dec_func_ref_9.ets +03.types/07.value_types/05.character_types_and_operations/decrement/dec_func_val_6.ets +03.types/07.value_types/05.character_types_and_operations/decrement/dec_func_val_7.ets +03.types/07.value_types/05.character_types_and_operations/decrement/dec_func_val_8.ets +03.types/07.value_types/05.character_types_and_operations/decrement/dec_func_val_9.ets +03.types/07.value_types/05.character_types_and_operations/increment/inc_arr_ref_3.ets +03.types/07.value_types/05.character_types_and_operations/increment/inc_arr_ref_4.ets +03.types/07.value_types/05.character_types_and_operations/increment/inc_arr_val_3.ets +03.types/07.value_types/05.character_types_and_operations/increment/inc_arr_val_4.ets +03.types/07.value_types/05.character_types_and_operations/increment/inc_func_ref_6.ets +03.types/07.value_types/05.character_types_and_operations/increment/inc_func_ref_7.ets +03.types/07.value_types/05.character_types_and_operations/increment/inc_func_ref_8.ets +03.types/07.value_types/05.character_types_and_operations/increment/inc_func_ref_9.ets +03.types/07.value_types/05.character_types_and_operations/increment/inc_func_val_6.ets +03.types/07.value_types/05.character_types_and_operations/increment/inc_func_val_7.ets +03.types/07.value_types/05.character_types_and_operations/increment/inc_func_val_8.ets +03.types/07.value_types/05.character_types_and_operations/increment/inc_func_val_9.ets +# end of es2panda fails + +# es2panda fails: panda#14105 +03.types/07.value_types/05.character_types_and_operations/addition/add_arr_ref_0.ets +03.types/07.value_types/05.character_types_and_operations/addition/add_arr_ref_1.ets +03.types/07.value_types/05.character_types_and_operations/addition/add_arr_ref_2.ets +03.types/07.value_types/05.character_types_and_operations/addition/add_arr_ref_3.ets +03.types/07.value_types/05.character_types_and_operations/addition/add_arr_ref_4.ets +03.types/07.value_types/05.character_types_and_operations/addition/add_arr_ref_5.ets +03.types/07.value_types/05.character_types_and_operations/addition/add_arr_ref_6.ets +03.types/07.value_types/05.character_types_and_operations/addition/add_arr_val_2.ets +03.types/07.value_types/05.character_types_and_operations/addition/add_arr_val_3.ets +03.types/07.value_types/05.character_types_and_operations/addition/add_arr_val_4.ets +03.types/07.value_types/05.character_types_and_operations/addition/add_func_ref_0.ets +03.types/07.value_types/05.character_types_and_operations/addition/add_func_ref_1.ets +03.types/07.value_types/05.character_types_and_operations/addition/add_func_ref_2.ets +03.types/07.value_types/05.character_types_and_operations/addition/add_func_ref_3.ets +03.types/07.value_types/05.character_types_and_operations/addition/add_func_ref_4.ets +03.types/07.value_types/05.character_types_and_operations/addition/add_func_ref_5.ets +03.types/07.value_types/05.character_types_and_operations/addition/add_func_ref_6.ets +03.types/07.value_types/05.character_types_and_operations/addition/add_func_val_0.ets +03.types/07.value_types/05.character_types_and_operations/addition/add_func_val_1.ets +03.types/07.value_types/05.character_types_and_operations/addition/add_func_val_2.ets +03.types/07.value_types/05.character_types_and_operations/addition/add_func_val_3.ets +03.types/07.value_types/05.character_types_and_operations/addition/add_func_val_4.ets +03.types/07.value_types/05.character_types_and_operations/addition/add_func_val_5.ets +03.types/07.value_types/05.character_types_and_operations/addition/add_func_val_6.ets +03.types/07.value_types/05.character_types_and_operations/subtraction/sub_arr_ref_0.ets +03.types/07.value_types/05.character_types_and_operations/subtraction/sub_arr_ref_1.ets +03.types/07.value_types/05.character_types_and_operations/subtraction/sub_arr_ref_2.ets +03.types/07.value_types/05.character_types_and_operations/subtraction/sub_arr_ref_3.ets +03.types/07.value_types/05.character_types_and_operations/subtraction/sub_arr_ref_4.ets +03.types/07.value_types/05.character_types_and_operations/subtraction/sub_arr_ref_5.ets +03.types/07.value_types/05.character_types_and_operations/subtraction/sub_arr_ref_6.ets +03.types/07.value_types/05.character_types_and_operations/subtraction/sub_arr_val_3.ets +03.types/07.value_types/05.character_types_and_operations/subtraction/sub_arr_val_4.ets +03.types/07.value_types/05.character_types_and_operations/subtraction/sub_arr_val_5.ets +03.types/07.value_types/05.character_types_and_operations/subtraction/sub_func_ref_0.ets +03.types/07.value_types/05.character_types_and_operations/subtraction/sub_func_ref_1.ets +03.types/07.value_types/05.character_types_and_operations/subtraction/sub_func_ref_2.ets +03.types/07.value_types/05.character_types_and_operations/subtraction/sub_func_ref_3.ets +03.types/07.value_types/05.character_types_and_operations/subtraction/sub_func_ref_4.ets +03.types/07.value_types/05.character_types_and_operations/subtraction/sub_func_ref_5.ets +03.types/07.value_types/05.character_types_and_operations/subtraction/sub_func_ref_6.ets +03.types/07.value_types/05.character_types_and_operations/subtraction/sub_func_val_0.ets +03.types/07.value_types/05.character_types_and_operations/subtraction/sub_func_val_1.ets +03.types/07.value_types/05.character_types_and_operations/subtraction/sub_func_val_2.ets +03.types/07.value_types/05.character_types_and_operations/subtraction/sub_func_val_3.ets +03.types/07.value_types/05.character_types_and_operations/subtraction/sub_func_val_4.ets +03.types/07.value_types/05.character_types_and_operations/subtraction/sub_func_val_5.ets +03.types/07.value_types/05.character_types_and_operations/subtraction/sub_func_val_6.ets +03.types/07.value_types/05.character_types_and_operations/concat/conc_ref_0.ets +03.types/07.value_types/05.character_types_and_operations/concat/conc_ref_1.ets +03.types/07.value_types/05.character_types_and_operations/concat/conc_ref_2.ets +03.types/07.value_types/05.character_types_and_operations/concat/conc_ref_3.ets +03.types/07.value_types/05.character_types_and_operations/concat/conc_ref_4.ets +03.types/07.value_types/05.character_types_and_operations/concat/conc_val_0.ets +03.types/07.value_types/05.character_types_and_operations/concat/conc_val_1.ets +03.types/07.value_types/05.character_types_and_operations/concat/conc_val_2.ets +03.types/07.value_types/05.character_types_and_operations/concat/conc_val_3.ets +03.types/07.value_types/05.character_types_and_operations/concat/conc_val_4.ets +03.types/07.value_types/05.character_types_and_operations/conditional/cond_exp_val_2.ets +03.types/07.value_types/05.character_types_and_operations/conditional/cond_fld_val_2.ets +03.types/07.value_types/05.character_types_and_operations/conditional/cond_func_ref_4.ets +03.types/07.value_types/05.character_types_and_operations/conditional/cond_func_val_1.ets +03.types/07.value_types/05.character_types_and_operations/conditional/cond_func_val_2.ets +03.types/07.value_types/05.character_types_and_operations/conditional/cond_func_val_4.ets +03.types/07.value_types/05.character_types_and_operations/unary/unary_ref_0.ets +03.types/07.value_types/05.character_types_and_operations/unary/unary_ref_1.ets +03.types/07.value_types/05.character_types_and_operations/unary/unary_ref_2.ets +03.types/07.value_types/05.character_types_and_operations/unary/unary_ref_3.ets +03.types/07.value_types/05.character_types_and_operations/unary/unary_ref_4.ets +03.types/07.value_types/05.character_types_and_operations/unary/unary_ref_5.ets +03.types/07.value_types/05.character_types_and_operations/unary/unary_ref_6.ets +03.types/07.value_types/05.character_types_and_operations/unary/unary_val_0.ets +03.types/07.value_types/05.character_types_and_operations/unary/unary_val_1.ets +03.types/07.value_types/05.character_types_and_operations/unary/unary_val_2.ets +03.types/07.value_types/05.character_types_and_operations/unary/unary_val_3.ets +03.types/07.value_types/05.character_types_and_operations/unary/unary_val_4.ets +03.types/07.value_types/05.character_types_and_operations/unary/unary_val_5.ets +03.types/07.value_types/05.character_types_and_operations/unary/unary_val_6.ets +03.types/07.value_types/05.character_types_and_operations/concat/conc2.ets +# end of es2panda fails + # es2panda fails: panda#13203 09.classes/01.class_declaration/06.implementing_interface_properties/getter_setter_implementation.ets 10.interfaces/05.interface_properties/getter_setter_form.ets @@ -1928,10 +2033,3 @@ 10.interfaces/05.interface_properties/readonly_simple_form_0.ets 10.interfaces/05.interface_properties/simple_form.ets # end of es2panda fails - -# es2panda fail: panda#13730 -04.names_declarations_and_scopes/08.function_declarations/03.optional_parameters/opt_param_n_0.ets -04.names_declarations_and_scopes/08.function_declarations/03.optional_parameters/opt_param_n_2.ets -04.names_declarations_and_scopes/08.function_declarations/03.optional_parameters/opt_param_n_10.ets -# end of es2panda fails -