1/* 2 * Copyright (c) 2023-2025 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16let global_boolean_: boolean = new Boolean(true); 17let global_byte_: byte = new Byte(20 as byte); 18let global_char_: char = new Char(c'a'); 19let global_double_: double = new Double(2.2222222222); 20let global_float_: float = new Float(2.22 as float); 21let global_int_: int = new Int(200000); 22let global_long_: long = new Long(2147483647); 23let global_short_: short = new Short(20 as short); 24 25class A { 26 public boolean_: boolean = new Boolean(true); 27 public byte_: byte = new Byte(20 as byte); 28 public char_: char = new Char(c'a'); 29 public double_: double = new Double(2.2222222222); 30 public float_: float = new Float(2.22 as float); 31 public int_: int = new Int(200000); 32 public long_: long = new Long(2147483647); 33 public short_: short = new Short(20 as short); 34} 35 36function main() { 37 assertEQ(global_boolean_, true) 38 assertEQ(global_byte_, 20) 39 assertEQ(global_char_, c'a') 40 assertEQ(global_double_, 2.2222222222) 41 assertEQ(global_float_, 2.22 as float) 42 assertEQ(global_int_, 200000) 43 assertEQ(global_long_, 2147483647) 44 assertEQ(global_short_, 20) 45 46 let a = new A(); 47 assertEQ(a.boolean_, true) 48 assertEQ(a.byte_, 20) 49 assertEQ(a.char_, c'a') 50 assertEQ(a.double_, 2.2222222222) 51 assertEQ(a.float_, 2.22 as float) 52 assertEQ(a.int_, 200000) 53 assertEQ(a.long_, 2147483647) 54 assertEQ(a.short_, 20) 55} 56