/* * Copyright (c) 2024 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. */ function byte_test(): void { let byte_: byte = 42; let Byte_: Byte = new Byte(42 as byte); { // Casting to primitive types let byte_byte = byte_ as byte; let byte_short = byte_ as short; let byte_char = byte_ as char; let byte_int = byte_ as int; let byte_long = byte_ as long; let byte_float = byte_ as float; let byte_double = byte_ as double; let Byte_byte = Byte_ as byte; let Byte_short = Byte_ as short; let Byte_int = Byte_ as int; let Byte_long = Byte_ as long; let Byte_float = Byte_ as float; let Byte_double = Byte_ as double; } { // Casting to reference type let byte_Byte = byte_ as Byte; let Byte_Byte = Byte_ as Byte; let Byte_Object = Byte_ as Object; } } function short_test(): void { let short_: short = 42; let Short_: Short = new Short(42 as short); { // Casting to primitive types let short_byte = short_ as byte; let short_short = short_ as short; let short_char = short_ as char; let short_int = short_ as int; let short_long = short_ as long; let short_float = short_ as float; let short_double = short_ as double; let Short_short = Short_ as short; let Short_int = Short_ as int; let Short_long = Short_ as long; let Short_float = Short_ as float; let Short_double = Short_ as double; } { // Casting to reference type let short_Short = short_ as Short; let Short_Short = Short_ as Short; let Short_Object = Short_ as Object; } } function char_test(): void { let char_: char = 42; let Char_: Char = new Char(42 as char); { // Casting to primitive types let char_byte = char_ as byte; let char_short = char_ as short; let char_char = char_ as char; let char_int = char_ as int; let char_long = char_ as long; let char_float = char_ as float; let char_double = char_ as double; let Char_char = Char_ as char; let Char_int = Char_ as int; let Char_long = Char_ as long; let Char_float = Char_ as float; let Char_double = Char_ as double; } { // Casting to reference type let char_Char = char_ as Char; let Char_Char = Char_ as Char; let Char_Object = Char_ as Object; } } function int_test(): void { let int_: int = 42; let Int_: Int = new Int(42 as int); { // Casting to primitive types let int_byte = int_ as byte; let int_short = int_ as short; let int_char = int_ as char; let int_int = int_ as int; let int_long = int_ as long; let int_float = int_ as float; let int_double = int_ as double; let Int_int = Int_ as int; let Int_long = Int_ as long; let Int_float = Int_ as float; let Int_double = Int_ as double; } { // Casting to reference type let int_Int = int_ as Int; let Int_Int = Int_ as Int; let Int_Object = Int_ as Object; } } function long_test(): void { let long_: long = 42; let Long_: Long = new Long(42 as long); { // Casting to primitive types let long_byte = long_ as byte; let long_short = long_ as short; let long_char = long_ as char; let long_int = long_ as int; let long_long = long_ as long; let long_float = long_ as float; let long_double = long_ as double; let Long_long = Long_ as long; let Long_float = Long_ as float; let Long_double = Long_ as double; } { // Casting to reference type let long_Long = long_ as Long; let Long_Long = Long_ as Long; let Long_Object = Long_ as Object; } } function float_test(): void { let float_: float = 42; let Float_: Float = new Float(42 as float); { // Casting to primitive types let float_byte = float_ as byte; let float_short = float_ as short; let float_char = float_ as char; let float_int = float_ as int; let float_long = float_ as long; let float_float = float_ as float; let float_double = float_ as double; let Float_float = Float_ as float; let Float_double = Float_ as double; } { // Casting to reference type let float_Float = float_ as Float; let Float_Float = Float_ as Float; let Float_Object = Float_ as Object; } } function double_test(): void { let double_: double = 42; let Double_: Double = new Double(42 as double); { // Casting to primitive types let double_byte = double_ as byte; let double_short = double_ as short; let double_char = double_ as char; let double_int = double_ as int; let double_long = double_ as long; let double_float = double_ as float; let double_double = double_ as double; let Double_double = Double_ as double; } { // Casting to reference type let double_Double = double_ as Double; let Double_Double = Double_ as Double; let Double_Object = Double_ as Object; } } function boolean_test(): void { let boolean_: boolean = true; let Boolean_: Boolean = new Boolean(true); { // Casting to primitive types let boolean_boolean = boolean_ as boolean; let Boolean_boolean = Boolean_ as boolean; } { // Casting to reference type let boolean_Boolean = boolean_ as Boolean; let Boolean_Boolean = Boolean_ as Boolean; let Boolean_Object = Boolean_ as Object; } }