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..018d14813c52b8aefe86b6f771c8b7685c0c2c7d 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 @@ -96,7 +96,7 @@ EtsObject *EtsClassWrapper::Unwrap(InteropCtx *ctx, napi_value js_value) return res; } - InteropCtx::ThrowJSTypeError(env, std::string("Value is not assignable to ") + ets_class_->GetDescriptor()); + InteropCtx::ThrowJSTypeError(env, std::string("js_value is not assignable to ") + ets_class_->GetDescriptor()); return nullptr; } diff --git a/plugins/ets/runtime/interop_js/ets_proxy/ets_class_wrapper.h b/plugins/ets/runtime/interop_js/ets_proxy/ets_class_wrapper.h index c7675e3c2e49855c6bb11d581050c7a90960d1c9..02dd6f4b617175f61f80eb8304f905b34a8ba863 100644 --- a/plugins/ets/runtime/interop_js/ets_proxy/ets_class_wrapper.h +++ b/plugins/ets/runtime/interop_js/ets_proxy/ets_class_wrapper.h @@ -78,7 +78,7 @@ public: void SetJSBuiltinMatcher(std::function &&matcher) { - js_builtin_matcher_ = matcher; + js_builtin_matcher_ = std::move(matcher); } napi_value Wrap(InteropCtx *ctx, EtsObject *ets_object); diff --git a/plugins/ets/runtime/interop_js/ets_vm_plugin.cpp b/plugins/ets/runtime/interop_js/ets_vm_plugin.cpp index 66add1e76d116c985d20828e0f750eb4801ce8ff..c967f8d54c4ac9b134c42d54d70a9d7cf8a89601 100644 --- a/plugins/ets/runtime/interop_js/ets_vm_plugin.cpp +++ b/plugins/ets/runtime/interop_js/ets_vm_plugin.cpp @@ -29,6 +29,7 @@ namespace panda::ets::interop::js { static napi_value Version(napi_env env, [[maybe_unused]] napi_callback_info info) { + ASSERT_SCOPED_NATIVE_CODE(); constexpr std::string_view MSG = "0.1"; napi_value result; @@ -40,11 +41,14 @@ static napi_value Version(napi_env env, [[maybe_unused]] napi_callback_info info static napi_value Fatal([[maybe_unused]] napi_env env, [[maybe_unused]] napi_callback_info info) { + ASSERT_SCOPED_NATIVE_CODE(); InteropCtx::Fatal("etsVm.Fatal"); } static napi_value GetEtsFunction(napi_env env, napi_callback_info info) { + ASSERT_SCOPED_NATIVE_CODE(); + size_t js_argc = 0; NAPI_CHECK_FATAL(napi_get_cb_info(env, info, &js_argc, nullptr, nullptr, nullptr)); if (js_argc != 2) { @@ -76,6 +80,8 @@ static napi_value GetEtsFunction(napi_env env, napi_callback_info info) static napi_value GetEtsClass(napi_env env, napi_callback_info info) { + ASSERT_SCOPED_NATIVE_CODE(); + size_t js_argc = 0; NAPI_CHECK_FATAL(napi_get_cb_info(env, info, &js_argc, nullptr, nullptr, nullptr)); @@ -94,6 +100,8 @@ static napi_value GetEtsClass(napi_env env, napi_callback_info info) static napi_value Call(napi_env env, napi_callback_info info) { + ASSERT_SCOPED_NATIVE_CODE(); + size_t argc = 0; [[maybe_unused]] napi_status status; status = napi_get_cb_info(env, info, &argc, nullptr, nullptr, nullptr); @@ -111,6 +119,8 @@ static napi_value Call(napi_env env, napi_callback_info info) static napi_value CallWithCopy(napi_env env, napi_callback_info info) { + ASSERT_SCOPED_NATIVE_CODE(); + size_t argc = 0; [[maybe_unused]] napi_status status; status = napi_get_cb_info(env, info, &argc, nullptr, nullptr, nullptr); diff --git a/plugins/ets/runtime/interop_js/intrinsics/std_js_jsruntime.cpp b/plugins/ets/runtime/interop_js/intrinsics/std_js_jsruntime.cpp index 8ca5e2111bf5d46d93fcd73d04c0e23914e1a236..298dc9fee51c764fe77f5f61319f562a72c09a7f 100644 --- a/plugins/ets/runtime/interop_js/intrinsics/std_js_jsruntime.cpp +++ b/plugins/ets/runtime/interop_js/intrinsics/std_js_jsruntime.cpp @@ -22,81 +22,82 @@ namespace panda::ets::interop::js { namespace notimpl { -[[noreturn]] static void NotImplementedHook() +[[noreturn]] static void NotImplementedHook(int nr) { - LOG(FATAL, ETS) << "NotImplementedHook called for JSRuntime intrinsic"; + LOG(FATAL, ETS) << "NotImplementedHook called for JSRuntime intrinsic, nr=" << nr; UNREACHABLE(); } -template +template static R NotImplementedAdapter([[maybe_unused]] Args... args) { - NotImplementedHook(); + NotImplementedHook(NR); } static const IntrinsicsAPI S_INTRINSICS_API = { // clang-format off - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, - NotImplementedAdapter, + NotImplementedAdapter<0>, + NotImplementedAdapter<1>, + NotImplementedAdapter<2>, + NotImplementedAdapter<3>, + NotImplementedAdapter<4>, + NotImplementedAdapter<5>, + NotImplementedAdapter<6>, + NotImplementedAdapter<7>, + NotImplementedAdapter<8>, + NotImplementedAdapter<9>, + NotImplementedAdapter<10>, + NotImplementedAdapter<11>, + NotImplementedAdapter<12>, + NotImplementedAdapter<13>, + NotImplementedAdapter<14>, + NotImplementedAdapter<15>, + NotImplementedAdapter<16>, + NotImplementedAdapter<17>, + NotImplementedAdapter<18>, + NotImplementedAdapter<19>, + NotImplementedAdapter<20>, + NotImplementedAdapter<21>, + NotImplementedAdapter<22>, + NotImplementedAdapter<23>, + NotImplementedAdapter<24>, + NotImplementedAdapter<25>, + NotImplementedAdapter<26>, + NotImplementedAdapter<27>, + NotImplementedAdapter<28>, + NotImplementedAdapter<29>, + NotImplementedAdapter<30>, + NotImplementedAdapter<31>, + NotImplementedAdapter<32>, + NotImplementedAdapter<33>, + NotImplementedAdapter<34>, + NotImplementedAdapter<35>, + NotImplementedAdapter<36>, + NotImplementedAdapter<37>, + NotImplementedAdapter<38>, + NotImplementedAdapter<39>, + NotImplementedAdapter<40>, + NotImplementedAdapter<41>, + NotImplementedAdapter<42>, + NotImplementedAdapter<43>, + NotImplementedAdapter<44>, + NotImplementedAdapter<45>, + NotImplementedAdapter<46>, + NotImplementedAdapter<47>, + NotImplementedAdapter<48>, + NotImplementedAdapter<49>, + NotImplementedAdapter<50>, + NotImplementedAdapter<51>, + NotImplementedAdapter<52>, + NotImplementedAdapter<53>, + NotImplementedAdapter<54>, + NotImplementedAdapter<55>, + NotImplementedAdapter<56>, + NotImplementedAdapter<57>, + NotImplementedAdapter<58>, + NotImplementedAdapter<59>, + NotImplementedAdapter<60>, + NotImplementedAdapter<61>, // clang-format on }; @@ -217,9 +218,14 @@ JSValue *JSRuntimeCreateObjectIntrinsic() return S_INTRINSICS_API->JSRuntimeCreateObject(); } -uint8_t JSRuntimeInstanceOfIntrinsic(JSValue *object, JSValue *ctor) +uint8_t JSRuntimeInstanceOfDynamicIntrinsic(JSValue *object, JSValue *ctor) { - return S_INTRINSICS_API->JSRuntimeInstanceOf(object, ctor); + return S_INTRINSICS_API->JSRuntimeInstanceOfDynamic(object, ctor); +} + +uint8_t JSRuntimeInstanceOfStaticIntrinsic(JSValue *object, EtsClass *cls) +{ + return S_INTRINSICS_API->JSRuntimeInstanceOfStatic(object, cls); } uint8_t JSRuntimeInitJSCallClassIntrinsic(EtsString *cls_name) diff --git a/plugins/ets/runtime/interop_js/intrinsics/std_js_jsruntime.yaml b/plugins/ets/runtime/interop_js/intrinsics/std_js_jsruntime.yaml index 0ea011027f477908b183e93ca5a76058833f1b7e..10426b88a260ff515393e3d37b963bbda6e54780 100644 --- a/plugins/ets/runtime/interop_js/intrinsics/std_js_jsruntime.yaml +++ b/plugins/ets/runtime/interop_js/intrinsics/std_js_jsruntime.yaml @@ -18,6 +18,9 @@ coretypes: - managed_class: std.core.void mirror_class: panda::ets::EtsVoid +- managed_class: std.core.Type + mirror_class: panda::ets::EtsClass + - managed_class: std.core.String mirror_class: panda::ets::EtsString @@ -255,15 +258,26 @@ intrinsics: impl: panda::ets::interop::js::intrinsics::JSRuntimeCreateObjectIntrinsic clear_flags: [ ] - - name: JSRuntimeInstanceOf + - name: JSRuntimeInstanceOfDynamic space: ets class_name: std.interop.js.JSRuntime - method_name: instanceOf + method_name: instanceOfDynamic static: true signature: ret: u1 args: [ std.interop.js.JSValue, std.interop.js.JSValue ] - impl: panda::ets::interop::js::intrinsics::JSRuntimeInstanceOfIntrinsic + impl: panda::ets::interop::js::intrinsics::JSRuntimeInstanceOfDynamicIntrinsic + clear_flags: [ ] + + - name: JSRuntimeInstanceOfStatic + space: ets + class_name: std.interop.js.JSRuntime + method_name: instanceOfStatic + static: true + signature: + ret: u1 + args: [ std.interop.js.JSValue, std.core.Type ] + impl: panda::ets::interop::js::intrinsics::JSRuntimeInstanceOfStaticIntrinsic clear_flags: [ ] - name: JSRuntimeInitJSCallClass diff --git a/plugins/ets/runtime/interop_js/intrinsics_api.h b/plugins/ets/runtime/interop_js/intrinsics_api.h index 2bba02a4df7d1cbb8600cb1585934cb56f4b19fc..a163b2032e5afa1d46225cb17a90c2743e6e184f 100644 --- a/plugins/ets/runtime/interop_js/intrinsics_api.h +++ b/plugins/ets/runtime/interop_js/intrinsics_api.h @@ -51,7 +51,8 @@ struct IntrinsicsAPI { JSValue *(*JSRuntimeGetNull)(); JSValue *(*JSRuntimeGetGlobal)(); JSValue *(*JSRuntimeCreateObject)(); - uint8_t (*JSRuntimeInstanceOf)(JSValue *object, JSValue *ctor); + uint8_t (*JSRuntimeInstanceOfDynamic)(JSValue *object, JSValue *ctor); + uint8_t (*JSRuntimeInstanceOfStatic)(JSValue *object, EtsClass *cls); uint8_t (*JSRuntimeInitJSCallClass)(EtsString *cls_name); uint8_t (*JSRuntimeInitJSNewClass)(EtsString *cls_name); JSValue *(*JSRuntimeCreateLambdaProxy)(EtsObject *lambda); diff --git a/plugins/ets/runtime/interop_js/intrinsics_api_impl.cpp b/plugins/ets/runtime/interop_js/intrinsics_api_impl.cpp index 779bd0e1a394c0ca5c6834b439a8f0b7521997a3..dc1c18f91b5bf97c0b2d4a20c04e5a66d790eb7b 100644 --- a/plugins/ets/runtime/interop_js/intrinsics_api_impl.cpp +++ b/plugins/ets/runtime/interop_js/intrinsics_api_impl.cpp @@ -18,6 +18,7 @@ #include "plugins/ets/runtime/interop_js/interop_common.h" #include "plugins/ets/runtime/interop_js/intrinsics_api.h" #include "plugins/ets/runtime/interop_js/intrinsics_api_impl.h" +#include "plugins/ets/runtime/interop_js/logger.h" #include "plugins/ets/runtime/interop_js/napi_env_scope.h" #include "plugins/ets/runtime/types/ets_string.h" #include "plugins/ets/runtime/types/ets_void.h" @@ -232,7 +233,7 @@ static JSValue *JSRuntimeCreateObject() return JSValue::CreateRefValue(coro, ctx, obj, napi_object); } -uint8_t JSRuntimeInstanceOf(JSValue *object, JSValue *ctor) +static uint8_t JSRuntimeInstanceOfDynamic(JSValue *object, JSValue *ctor) { auto coro = EtsCoroutine::GetCurrent(); auto ctx = InteropCtx::Current(coro); @@ -250,6 +251,44 @@ uint8_t JSRuntimeInstanceOf(JSValue *object, JSValue *ctor) return static_cast(res); } +static uint8_t JSRuntimeInstanceOfStatic(JSValue *ets_js_value, EtsClass *ets_class) +{ + ASSERT(ets_class != nullptr); + + if (ets_js_value == nullptr) { + return 0; + } + + auto coro = EtsCoroutine::GetCurrent(); + auto ctx = InteropCtx::Current(coro); + auto env = ctx->GetJSEnv(); + + Class *cls = ets_class->GetRuntimeClass(); + if (!cls->IsInitialized() && !IsStdClass(cls)) { + // 'js_value' haven't been created from the uninitialized class + return 0; + } + + // Check if object has SharedReference + ets_proxy::SharedReference *shared_ref = [=] { + NapiScope js_handle_scope(env); + napi_value js_value = ets_js_value->GetNapiValue(env); + return ctx->GetSharedRefStorage()->GetReference(env, js_value); + }(); + + if (shared_ref != nullptr) { + EtsObject *ets_object = shared_ref->GetEtsObject(ctx); + return static_cast(ets_class->IsAssignableFrom(ets_object->GetClass())); + } + + if (IsStdClass(cls)) { + // TODO(v.cherkashin): Add support compat types, #13577 + INTEROP_LOG(FATAL) << __func__ << " doesn't support compat types"; + } + + return 0; +} + static JSValue *JSRuntimeCreateLambdaProxy(EtsObject *ets_callable) { auto coro = EtsCoroutine::GetCurrent(); @@ -315,33 +354,37 @@ static JSValue *JSRuntimeLoadModule(EtsString *module) auto env = ctx->GetJSEnv(); PandaString module_name = module->GetMutf8(); - auto [mod, func] = ResolveModuleName(module_name); - - NapiScope js_handle_scope(env); - - napi_value require_fn; - NAPI_CHECK_FATAL(napi_get_named_property(env, GetGlobal(env), func.data(), &require_fn)); - - INTEROP_FATAL_IF(GetValueType(env, require_fn) != napi_function); napi_value mod_obj; + { - napi_value js_name; - NAPI_CHECK_FATAL(napi_create_string_utf8(env, mod.data(), NAPI_AUTO_LENGTH, &js_name)); - std::array args = {js_name}; - napi_value recv; - NAPI_CHECK_FATAL(napi_get_undefined(env, &recv)); - auto status = (napi_call_function(env, recv, require_fn, args.size(), args.data(), &mod_obj)); - - if (status == napi_pending_exception) { - napi_value exp; - NAPI_CHECK_FATAL(napi_get_and_clear_last_exception(env, &exp)); - NAPI_CHECK_FATAL(napi_fatal_exception(env, exp)); - std::abort(); + ScopedNativeCodeThread native_scope(coro); + auto [mod, func] = ResolveModuleName(module_name); + + NapiScope js_handle_scope(env); + + napi_value require_fn; + NAPI_CHECK_FATAL(napi_get_named_property(env, GetGlobal(env), func.data(), &require_fn)); + + INTEROP_FATAL_IF(GetValueType(env, require_fn) != napi_function); + { + napi_value js_name; + NAPI_CHECK_FATAL(napi_create_string_utf8(env, mod.data(), NAPI_AUTO_LENGTH, &js_name)); + std::array args = {js_name}; + napi_value recv; + NAPI_CHECK_FATAL(napi_get_undefined(env, &recv)); + auto status = (napi_call_function(env, recv, require_fn, args.size(), args.data(), &mod_obj)); + + if (status == napi_pending_exception) { + napi_value exp; + NAPI_CHECK_FATAL(napi_get_and_clear_last_exception(env, &exp)); + NAPI_CHECK_FATAL(napi_fatal_exception(env, exp)); + std::abort(); + } + + INTEROP_FATAL_IF(status != napi_ok); } - - INTEROP_FATAL_IF(status != napi_ok); + INTEROP_FATAL_IF(IsUndefined(env, mod_obj)); } - INTEROP_FATAL_IF(IsUndefined(env, mod_obj)); return JSValue::CreateRefValue(coro, ctx, mod_obj, napi_object); } @@ -679,7 +722,8 @@ const IntrinsicsAPI G_INTRINSICS_API = { JSRuntimeGetNull, JSRuntimeGetGlobal, JSRuntimeCreateObject, - JSRuntimeInstanceOf, + JSRuntimeInstanceOfDynamic, + JSRuntimeInstanceOfStatic, JSRuntimeInitJSCallClass, JSRuntimeInitJSNewClass, JSRuntimeCreateLambdaProxy, diff --git a/plugins/ets/stdlib/std/interop/js/JSRuntime.ets b/plugins/ets/stdlib/std/interop/js/JSRuntime.ets index 3221a9ec737abdb800718c592eb5477cd8f661cf..c3df55eb8a31a59aa5d133334a580a95bc3ecc1e 100644 --- a/plugins/ets/stdlib/std/interop/js/JSRuntime.ets +++ b/plugins/ets/stdlib/std/interop/js/JSRuntime.ets @@ -211,10 +211,14 @@ export final class JSRuntime { JSRuntime.checkIntrinsicMethod(); } - public static instanceOf(object: JSValue, ctor: JSValue): boolean { + public static instanceOfDynamic(object: JSValue, ctor: JSValue): boolean { JSRuntime.checkIntrinsicMethod(); } - + + public static instanceOfStatic(object: JSValue, cls: Type): boolean { + JSRuntime.checkIntrinsicMethod(); + } + public static strictEqual(lsh: JSValue, rhs: JSValue): boolean { JSRuntime.checkIntrinsicMethod(); } 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/plugins/ets/tests/interop_js/gtest_plugin/gtest_launcher.js b/plugins/ets/tests/interop_js/gtest_plugin/gtest_launcher.js index 3a09e63b7ff353bb380d9a9607ebcdaf89bcb184..16685f81daa93a015104d9845f05d89851c65356 100644 --- a/plugins/ets/tests/interop_js/gtest_plugin/gtest_launcher.js +++ b/plugins/ets/tests/interop_js/gtest_plugin/gtest_launcher.js @@ -59,8 +59,8 @@ function main() { let penv = process.env; const etsVmRes = globalThis.gtest.etsVm.createRuntime({ - "log-level": "info", - "log-components": "ets_interop_js", + "log-level": "error", + "log-components": "all", "boot-panda-files": penv.ARK_ETS_STDLIB_PATH + ":" + penv.ARK_ETS_INTEROP_JS_GTEST_ABC_PATH, "panda-files": penv.ARK_ETS_INTEROP_JS_GTEST_ABC_PATH, "gc-trigger-type": "heap-trigger", diff --git a/plugins/ets/tests/interop_js/tests/CMakeLists.txt b/plugins/ets/tests/interop_js/tests/CMakeLists.txt index 19db6415f08da2406a71cad84261e11a7ff965c4..a91b1047c64e8c744acd6d7c1876ca38e992ad6d 100644 --- a/plugins/ets/tests/interop_js/tests/CMakeLists.txt +++ b/plugins/ets/tests/interop_js/tests/CMakeLists.txt @@ -28,7 +28,6 @@ file(WRITE ${ETS_CONFIG} " \"${PANDA_ROOT}/plugins/ets/tests/interop_js/tests/number_subtypes/module.js\": {\"language\": \"js\", \"hasDecl\": false},\n" " \"${PANDA_ROOT}/plugins/ets/tests/interop_js/tests/strict_equality/strict_equality.js\": {\"language\": \"js\", \"hasDecl\": false},\n" " \"${PANDA_ROOT}/plugins/ets/tests/interop_js/tests/class_composite/js/class_composite.js\": {\"language\": \"js\", \"hasDecl\": false},\n" - " \"${PANDA_ROOT}/plugins/ets/tests/interop_js/tests/dynamic_instanceof/dynamic_instanceof.js\": {\"language\": \"js\", \"hasDecl\": false},\n" " \"${PANDA_ROOT}/plugins/ets/tests/interop_js/tests/checked/example/strings.js\": {\"language\": \"js\", \"hasDecl\": false},\n" " \"${PANDA_ROOT}/plugins/ets/tests/interop_js/tests/checked/js_call/js_call.js\": {\"language\": \"js\", \"hasDecl\": false},\n" " \"${PANDA_ROOT}/plugins/ets/tests/interop_js/tests/checked/obj_call/obj_call.js\": {\"language\": \"js\", \"hasDecl\": false},\n" @@ -51,7 +50,9 @@ file(WRITE ${ETS_CONFIG_DECL} " },\n" " \"dynamicPaths\": {\n" " \"${PANDA_ROOT}/plugins/ets/tests/interop_js/tests/number_subtypes/module\": {\"language\": \"js\", \"hasDecl\": true},\n" - " \"${PANDA_ROOT}/plugins/ets/tests/interop_js/tests/class_composite/js/class_composite\": {\"language\": \"js\", \"hasDecl\": true}\n" + " \"${PANDA_ROOT}/plugins/ets/tests/interop_js/tests/class_composite/js/class_composite\": {\"language\": \"js\", \"hasDecl\": true},\n" + " \"${PANDA_ROOT}/plugins/ets/tests/interop_js/tests/instanceof/js/instanceof\": {\"language\": \"js\", \"hasDecl\": true},\n" + " \"${PANDA_ROOT}/plugins/ets/tests/interop_js/tests/instanceof/js/instanceof.js\": {\"language\": \"js\", \"hasDecl\": false}\n" " }\n" " }\n" "}\n" @@ -130,10 +131,10 @@ panda_ets_interop_js_gtest(ets_interop_js_class_composite_decl ETS_CONFIG ${ETS_CONFIG_DECL} ) -panda_ets_interop_js_gtest(ets_interop_js_dynamic_instanceof - CPP_SOURCES ${INTEROP_JS_TESTS_SOURCE_DIR}/dynamic_instanceof/dynamic_instanceof.cpp - ETS_SOURCES ${INTEROP_JS_TESTS_SOURCE_DIR}/dynamic_instanceof/dynamic_instanceof.ets - ETS_CONFIG ${ETS_CONFIG} +panda_ets_interop_js_gtest(ets_interop_js__instanceof + CPP_SOURCES ${INTEROP_JS_TESTS_SOURCE_DIR}/instanceof/instanceof.cpp + ETS_SOURCES ${INTEROP_JS_TESTS_SOURCE_DIR}/instanceof/instanceof.ets + ETS_CONFIG ${ETS_CONFIG_DECL} ) panda_ets_interop_js_gtest(ets_interop_dynamic_with_lambda diff --git a/plugins/ets/tests/interop_js/tests/dynamic_instanceof/dynamic_instanceof.cpp b/plugins/ets/tests/interop_js/tests/dynamic_instanceof/dynamic_instanceof.cpp deleted file mode 100644 index b8d789067823155806f8f924e4b6e118fe121eba..0000000000000000000000000000000000000000 --- a/plugins/ets/tests/interop_js/tests/dynamic_instanceof/dynamic_instanceof.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Copyright (c) 2021-2022 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. - */ - -#include -#include "ets_interop_js_gtest.h" - -namespace panda::ets::interop::js::testing { - -class EtsInteropInstanceOf : public EtsInteropTest {}; - -TEST_F(EtsInteropInstanceOf, Test1) -{ - auto ret = CallEtsMethod("Test1"); - ASSERT_EQ(ret, true); -} - -TEST_F(EtsInteropInstanceOf, Test2) -{ - auto ret = CallEtsMethod("Test2"); - ASSERT_EQ(ret, true); -} - -TEST_F(EtsInteropInstanceOf, Test3) -{ - auto ret = CallEtsMethod("Test3"); - ASSERT_EQ(ret, true); -} - -TEST_F(EtsInteropInstanceOf, Test4) -{ - auto ret = CallEtsMethod("Test4"); - ASSERT_EQ(ret, true); -} - -TEST_F(EtsInteropInstanceOf, Test5) -{ - auto ret = CallEtsMethod("Test5"); - ASSERT_EQ(ret, true); -} - -TEST_F(EtsInteropInstanceOf, Test6) -{ - auto ret = CallEtsMethod("Test6"); - ASSERT_EQ(ret, true); -} - -} // namespace panda::ets::interop::js::testing diff --git a/plugins/ets/tests/interop_js/tests/instanceof/instanceof.cpp b/plugins/ets/tests/interop_js/tests/instanceof/instanceof.cpp new file mode 100644 index 0000000000000000000000000000000000000000..abb89da0c56358d01f3f434a1fce58e9647e20cb --- /dev/null +++ b/plugins/ets/tests/interop_js/tests/instanceof/instanceof.cpp @@ -0,0 +1,113 @@ +/** + * Copyright (c) 2021-2022 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. + */ + +#include +#include "ets_interop_js_gtest.h" + +namespace panda::ets::interop::js::testing { + +class EtsInteropInstanceOf : public EtsInteropTest {}; + +/* + * ============================================= + * === Tests _instanceof_object === + * ============================================= + */ +TEST_F(EtsInteropInstanceOf, Test_object_instanceof_object) +{ + ASSERT_EQ(true, CallEtsMethod("Test_object_instanceof_object")); +} + +TEST_F(EtsInteropInstanceOf, Test_etstype_instanceof_object) +{ + ASSERT_EQ(true, CallEtsMethod("Test_etstype_instanceof_object")); +} + +TEST_F(EtsInteropInstanceOf, Test_jsvalue_instanceof_object) +{ + ASSERT_EQ(true, CallEtsMethod("Test_jsvalue_instanceof_object")); +} + +TEST_F(EtsInteropInstanceOf, Test_dynvalue_instanceof_object) +{ + ASSERT_EQ(true, CallEtsMethod("Test_dynvalue_instanceof_object")); +} + +TEST_F(EtsInteropInstanceOf, Test_dyndecl_instanceof_object) +{ + ASSERT_EQ(true, CallEtsMethod("Test_dyndecl_instanceof_object")); +} + +/* + * ============================================== + * === Tests _instanceof_etstype === + * ============================================== + */ +TEST_F(EtsInteropInstanceOf, Test_object_instanceof_etstype) +{ + ASSERT_EQ(true, CallEtsMethod("Test_object_instanceof_etstype")); +} + +TEST_F(EtsInteropInstanceOf, Test_etstype_instanceof_etstype) +{ + ASSERT_EQ(true, CallEtsMethod("Test_etstype_instanceof_etstype")); +} + +TEST_F(EtsInteropInstanceOf, Test_jsvalue_instanceof_etstype) +{ + ASSERT_EQ(true, CallEtsMethod("Test_jsvalue_instanceof_etstype")); +} + +TEST_F(EtsInteropInstanceOf, Test_dynvalue_instanceof_etstype) +{ + ASSERT_EQ(true, CallEtsMethod("Test_dynvalue_instanceof_etstype")); +} + +TEST_F(EtsInteropInstanceOf, Test_dyndecl_instanceof_etstype) +{ + ASSERT_EQ(true, CallEtsMethod("Test_dyndecl_instanceof_etstype")); +} + +/* + * ============================================== + * === Tests _instanceof_dyndecl === + * ============================================== + */ +TEST_F(EtsInteropInstanceOf, Test_object_instanceof_dyndecl) +{ + ASSERT_EQ(true, CallEtsMethod("Test_object_instanceof_dyndecl")); +} + +TEST_F(EtsInteropInstanceOf, Test_etstype_instanceof_dyndecl) +{ + ASSERT_EQ(true, CallEtsMethod("Test_etstype_instanceof_dyndecl")); +} + +TEST_F(EtsInteropInstanceOf, Test_jsvalue_instanceof_dyndecl) +{ + ASSERT_EQ(true, CallEtsMethod("Test_jsvalue_instanceof_dyndecl")); +} + +TEST_F(EtsInteropInstanceOf, Test_dynvalue_instanceof_dyndecl) +{ + ASSERT_EQ(true, CallEtsMethod("Test_dynvalue_instanceof_dyndecl")); +} + +TEST_F(EtsInteropInstanceOf, Test_dyndecl_instanceof_dyndecl) +{ + ASSERT_EQ(true, CallEtsMethod("Test_dyndecl_instanceof_dyndecl")); +} + +} // namespace panda::ets::interop::js::testing diff --git a/plugins/ets/tests/interop_js/tests/instanceof/instanceof.ets b/plugins/ets/tests/interop_js/tests/instanceof/instanceof.ets new file mode 100644 index 0000000000000000000000000000000000000000..0fd0b92ec786eec6c95faf3e2631f702ec79f049 --- /dev/null +++ b/plugins/ets/tests/interop_js/tests/instanceof/instanceof.ets @@ -0,0 +1,321 @@ +/* + * 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. + */ + +import { + AValue, + CValue, + js_avalue, + js_cvalue, + js_fn, +} from "/plugins/ets/tests/interop_js/tests/instanceof/js/instanceof.js" +import { + ADecl, + BDecl, + CDecl, + DDecl, + as_jsvalue, + get_js_errror, +} from "/plugins/ets/tests/interop_js/tests/instanceof/js/instanceof" + + +class A {} +class B extends BDecl {} +class C extends A {} + + +function err_log(op: String) { + console.println("Bug operation: " + op); +} + + + +/* + * ===================================== + * Tests _instanceof_object + * ===================================== + */ + +function Test_object_instanceof_object(): boolean { + let o = new Object(); + if (!(o instanceof Object)) { + err_log("o instanceof Object"); + return false; + } + return true; +} + +function Test_etstype_instanceof_object(): boolean { + let a = new A(); + if (!(a instanceof Object)) { + err_log("a instanceof Object"); + return false; + } + return true; +} + +function Test_jsvalue_instanceof_object(): boolean { + // Check js object as left argument + if (!(js_avalue instanceof Object)) { + err_log("js_avalue instanceof Object"); + return false; + } + let js_avalue_x = as_jsvalue(js_avalue); + if (!(js_avalue_x instanceof Object)) { + err_log("js_avalue_x instanceof Object"); + return false; + } + + // Check ets object as left argumet + let a = new A(); + let a_jsvalue: JSValue = as_jsvalue(a); + if (!(a_jsvalue instanceof Object)) { + err_log("a_jsvalue instanceof Object"); + return false; + } + return true; +} + +function Test_dynvalue_instanceof_object(): boolean { + let avalue: AValue = new AValue(); + if (!(avalue instanceof Object)) { + err_log("avalue instanceof Object"); + return false; + } + let cvalue: CValue = new CValue(); + if (!(cvalue instanceof Object)) { + err_log("cvalue instanceof Object"); + return false; + } + return true; +} + +function Test_dyndecl_instanceof_object(): boolean { + let adecl = new ADecl(); + if (!(adecl instanceof Object)) { + err_log("adecl instanceof Object"); + return false; + } + return true; +} + + + +/* + * ============================================== + * === Tests _instanceof_etstype === + * ============================================== + */ + +function Test_object_instanceof_etstype(): boolean { + let o = new Object(); + if (o instanceof A) { + err_log("o instanceof A"); + return false; + } + return true; +} + +function Test_etstype_instanceof_etstype(): boolean { + let a = new A(); + if (!(a instanceof A)) { + err_log("a instanceof A"); + return false; + } + // TODO(v.cherkashin): Enable when inheritance from declared type will be implemented, #13552 + //let b = new B(); + //if (!(b instanceof A)) { + // err_log("b instanceof A"); + // return false; + //} + let c = new C(); + if (!(c instanceof A)) { + err_log("c instanceof A"); + return false; + } + return true; +} + +function Test_jsvalue_instanceof_etstype(): boolean { + // Check js object as left argument + if (js_avalue instanceof A) { + err_log("js_avalue instanceof A"); + return false; + } + let js_avalue_x = as_jsvalue(js_avalue); + if (js_avalue_x instanceof A) { + err_log("js_avalue_x instanceof A"); + return false; + } + + // Check ets object as left argumet + let a = new A(); + let a_jsvalue: JSValue = as_jsvalue(a); + if (!(a_jsvalue instanceof A)) { + err_log("a_jsvalue instanceof A"); + return false; + } + // TODO(v.cherkashin): Enable when inheritance from declared type will be implemented, #13552 + //if (a_jsvalue instanceof B) { + // err_log("a_jsvalue instanceof B"); + // return false; + //} + let c = new C(); + let c_jsvalue: JSValue = as_jsvalue(c); + if (!(c_jsvalue instanceof A)) { + err_log("c_jsvalue instanceof A"); + return false; + } + return true; +} + +function Test_dynvalue_instanceof_etstype(): boolean { + let avalue: AValue = new AValue(); + if (avalue instanceof A) { + err_log("avalue instanceof A"); + return false; + } + // TODO(v.cherkashin): Enable when inheritance from declared type will be implemented, #13552 + //let cvalue: CValue = new CValue(); + //if (!(cvalue instanceof B)) { + // err_log("cvalue instanceof B"); + // return false; + //} + return true; +} + +function Test_dyndecl_instanceof_etstype(): boolean { + let adecl = new ADecl(); + if (adecl instanceof A) { + err_log("adecl instanceof A"); + return false; + } + let ddecl = new DDecl(); + if (!(ddecl instanceof A)) { + err_log("ddecl instanceof A"); + return false; + } + + // Check compat class + let ets_error = new Error("ets error message") + let ets_error_jsval: JSValue = ets_error; + if (!(ets_error_jsval instanceof Error)) { + err_log("ets_error_jsval instanceof Error"); + return false; + } + + let js_error: Error = get_js_errror("error message"); + if (!(js_error instanceof Error)) { + err_log("js_error instanceof Error"); + return false; + } + // TODO(v.cherkashin): Enable when processing the compat types will be implemented, #13577 + //let js_error_jsval: JSValue = js_error; + //if (!(js_error_jsval instanceof Error)) { + // err_log("js_error_jsval instanceof Error"); + // return false; + //} + return true; +} + + +/* + * ============================================== + * === Tests _instanceof_dyndecl === + * ============================================== + */ + +function Test_object_instanceof_dyndecl(): boolean { + // Check 'object instanceof dyndecl' + let o = new Object(); + if (o instanceof BDecl) { + err_log("o instanceof BDecl"); + return false; + } + return true; +} + +function Test_etstype_instanceof_dyndecl(): boolean { + // Check 'etstype instanceof dyndecl' + let a = new A(); + if (a instanceof BDecl) { + err_log("a instanceof BDecl"); + return false; + } + //TODO(v.cherkashin): Enable when inheritance with declared type will be implemented, #13552 + //let b = new B(); + //if (!(b instanceof BDecl)) { + // err_log("b instanceof BDecl"); + // return false; + //} + return true; +} + +function Test_jsvalue_instanceof_dyndecl(): boolean { + // Check 'jsvalue instanceof dyndecl' + if (js_avalue instanceof BDecl) { + err_log("js_avalue instanceof BDecl"); + return false; + } + if (!(js_cvalue instanceof BDecl)) { + err_log("js_cvalue instanceof BDecl"); + return false; + } + return true; +} + +function Test_dynvalue_instanceof_dyndecl(): boolean { + // Check 'dynvalue instanceof dyndecl' + let avalue: AValue = new AValue(); + if (avalue instanceof BDecl) { + err_log("avalue instanceof BDecl"); + return false; + } + let cvalue: CValue = new CValue(); + if (!(cvalue instanceof BDecl)) { + err_log("cvalue instanceof BDecl"); + return false; + } + return true; +} + +function Test_dyndecl_instanceof_dyndecl(): boolean { + let adecl: ADecl = new ADecl(); + if (adecl instanceof BDecl) { + err_log("adecl instanceof BDecl"); + return false; + } + let bdecl: BDecl = new BDecl(); + if (!(bdecl instanceof BDecl)) { + err_log("bdecl instanceof BDecl"); + return false; + } + let cdecl: CDecl = new CDecl(); + if (cdecl instanceof BDecl) { + err_log("cdecl instanceof BDecl"); + return false; + } + if (!(cdecl instanceof ADecl)) { + err_log("cdecl instanceof ADecl"); + return false; + } + + // Check 'js_fn instanceof dyndecl' + if (js_fn instanceof BDecl) { + err_log("js_fn instanceof BDecl"); + return false; + } + + return true; +} diff --git a/plugins/ets/tests/interop_js/tests/dynamic_instanceof/dynamic_instanceof.js b/plugins/ets/tests/interop_js/tests/instanceof/js/instanceof.ets similarity index 72% rename from plugins/ets/tests/interop_js/tests/dynamic_instanceof/dynamic_instanceof.js rename to plugins/ets/tests/interop_js/tests/instanceof/js/instanceof.ets index 348d0b5afc54c44150887744dd1f9fa26a37a37c..7fa70137a98c9242649259960b359ceb447dcbec 100644 --- a/plugins/ets/tests/interop_js/tests/dynamic_instanceof/dynamic_instanceof.js +++ b/plugins/ets/tests/interop_js/tests/instanceof/js/instanceof.ets @@ -12,25 +12,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -"use strict"; -class A { +export declare class ADecl {} +export declare class BDecl {} +export declare class CDecl {} +export declare class DDecl {} -}; - -class B { - -}; - -class C extends A { - -}; - -function jsfunc() { - return new A(); -} - -exports.A = A; -exports.B = B; -exports.C = C; -exports.jsfunc = jsfunc; +export declare function as_jsvalue(x: JSValue): JSValue; +export declare function get_js_errror(msg: String): Error; diff --git a/plugins/ets/tests/interop_js/tests/dynamic_instanceof/dynamic_instanceof.ets b/plugins/ets/tests/interop_js/tests/instanceof/js/instanceof.js similarity index 40% rename from plugins/ets/tests/interop_js/tests/dynamic_instanceof/dynamic_instanceof.ets rename to plugins/ets/tests/interop_js/tests/instanceof/js/instanceof.js index 4a37d585804d300dc7ee83cc6e6b41cc79d14cf4..d6fde40366ba39413e50351ddec7b174377f7ae6 100644 --- a/plugins/ets/tests/interop_js/tests/dynamic_instanceof/dynamic_instanceof.ets +++ b/plugins/ets/tests/interop_js/tests/instanceof/js/instanceof.js @@ -1,4 +1,4 @@ -/* +/** * 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. @@ -12,59 +12,47 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +"use strict"; -import { A, B, C, jsfunc } from "/plugins/ets/tests/interop_js/tests/dynamic_instanceof/dynamic_instanceof.js" -function Test1(): boolean { - let a = new A(); - let res = a instanceof A; - if (res) { - return true; - } - return false; -} -function Test2(): boolean { - let a = new A(); - let res = a instanceof B; - if (res) { - return false; - } - return true; -} +let A = globalThis.gtest.etsVm.getClass("LA;"); + +class ADecl {}; +class BDecl {}; +class CDecl extends ADecl {}; +class DDecl extends A {} + +class AValue {} +class CValue extends BDecl {}; -function Test3(): boolean { - let x = jsfunc(); - if (x instanceof A) { - return true; - } else { - return false; - } +function js_fn() { + return new ADecl(); } -function Test4(): boolean { - let x = jsfunc(); - if (x instanceof B) { - return false; - } else { - return true; - } +function as_jsvalue(x) { + return x; } -function Test5(): boolean { - let c = new C(); - if (c instanceof A) { - return true; - } else { - return false; - } +function get_js_errror(msg) { + return new Error(msg); } -function Test6(): boolean { - let c = new C(); - if (c instanceof B) { - return false; - } else { - return true; - } +let js_avalue = new AValue(); +let js_cvalue = new CValue(); + + + +module.exports = { + AValue, + CValue, + ADecl, + BDecl, + CDecl, + DDecl, + js_avalue, + js_cvalue, + as_jsvalue, + js_fn, + get_js_errror, } diff --git a/plugins/ets/tests/interop_js/tests/test_intrins/frontend_test_intrins.ets b/plugins/ets/tests/interop_js/tests/test_intrins/frontend_test_intrins.ets index 5a04942c6db503ae8391cce6053cf15c81606846..d4d83a0c5cb569be675736e98f4038c9c635ffb5 100644 --- a/plugins/ets/tests/interop_js/tests/test_intrins/frontend_test_intrins.ets +++ b/plugins/ets/tests/interop_js/tests/test_intrins/frontend_test_intrins.ets @@ -147,7 +147,7 @@ function test_builtin_array_multidim(): boolean { function test_builtin_array_instanceof(): boolean { let v: int[] = [111, 222]; let ctor = JSRuntime.getGlobal().Array; - return JSRuntime.instanceOf(Identity(v), ctor); + return JSRuntime.instanceOfDynamic(Identity(v), ctor); } function test_init_array_component(): boolean { // TODO(vpukhov): relies on jscast BadClass[] @@ -374,4 +374,4 @@ function test_finalizers(): boolean { assert JSRuntime.getNumSharedJSValues() == num_refs_pre; } return true; -} \ No newline at end of file +} diff --git a/plugins/ets/tests/interop_js/tests/test_intrins/test_intrins.ets b/plugins/ets/tests/interop_js/tests/test_intrins/test_intrins.ets index 7791b0516ad572f4798deaa6eb76ee3be3c9fd45..868b373f4557a0cbcca124dc734878391bd26bf5 100644 --- a/plugins/ets/tests/interop_js/tests/test_intrins/test_intrins.ets +++ b/plugins/ets/tests/interop_js/tests/test_intrins/test_intrins.ets @@ -25,7 +25,7 @@ class jscall { // Remove after JSValue cast fix: signature type suffixes - native static void$(top: JSValue, qname: String): void; + native static void$(top: JSValue, qname: String): void; native static void$a(top: JSValue, qname: String, v0: JSValue): void; native static void$an(top: JSValue, qname: String, a0: JSValue, a1: double): void; native static void$n(top: JSValue, qname: String, v0: double): void; @@ -205,7 +205,7 @@ function test_builtin_array_multidim(): boolean { function test_builtin_array_instanceof(): boolean { let v: int[] = [111, 222]; let ctor = JSRuntime.getPropertyJSValue(jsvars.global, "Array"); - return JSRuntime.instanceOf(jscall.any$Ai(jsvars.m, ".Identity", v), ctor); + return JSRuntime.instanceOfDynamic(jscall.any$Ai(jsvars.m, ".Identity", v), ctor); } function test_init_array_component(): boolean { let v: JSValue[] = [JSRuntime.getNull()]; diff --git a/runtime/include/thread_scopes.h b/runtime/include/thread_scopes.h index 4c27e9f4e3ba9f3825a6695d7f9e08524031baf8..133321409802734f59ec313f926c2d3adaf4e27a 100644 --- a/runtime/include/thread_scopes.h +++ b/runtime/include/thread_scopes.h @@ -20,6 +20,50 @@ namespace panda { +#ifndef NDEBUG +class ScopedAssertManagedCode { +public: + explicit ScopedAssertManagedCode() + { + ASSERT_MANAGED_CODE(); + } + + ~ScopedAssertManagedCode() + { + ASSERT_MANAGED_CODE(); + } + +private: + NO_COPY_SEMANTIC(ScopedAssertManagedCode); + NO_MOVE_SEMANTIC(ScopedAssertManagedCode); +}; + +class ScopedAssertNativeCode { +public: + explicit ScopedAssertNativeCode() + { + ASSERT_NATIVE_CODE(); + } + + ~ScopedAssertNativeCode() + { + ASSERT_NATIVE_CODE(); + } + +private: + NO_COPY_SEMANTIC(ScopedAssertNativeCode); + NO_MOVE_SEMANTIC(ScopedAssertNativeCode); +}; + +// NOLINTBEGIN(cppcoreguidelines-macro-usage) +#define ASSERT_SCOPED_MANAGED_CODE() ::panda::ScopedAssertManagedCode MERGE_WORDS(managed_scope_, __LINE__) +#define ASSERT_SCOPED_NATIVE_CODE() ::panda::ScopedAssertNativeCode MERGE_WORDS(native_scope_, __LINE__) +#else // NDEBUG +#define ASSERT_SCOPED_MANAGED_CODE() +#define ASSERT_SCOPED_NATIVE_CODE() +#endif // NDEBUG +// NOLINTEND(cppcoreguidelines-macro-usage) + class PANDA_PUBLIC_API ScopedNativeCodeThread { public: explicit ScopedNativeCodeThread(ManagedThread *thread) : thread_(thread) 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 -