1/* 2 * Copyright (c) 2023-2024 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(1.797+308); 20let global_float_: float = new Float(2.22 as float); 21let global_int_: int = new Int(200000); 22let global_long_: long = new Long(200000000000); 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(1.797+308); 30 public float_: float = new Float(2.22 as float); 31 public int_: int = new Int(200000); 32 public long_: long = new Long(200000000000); 33 public short_: short = new Short(20 as short); 34} 35 36function main() { 37 assert global_boolean_ == true; 38 assert global_byte_ == 20; 39 assert global_char_ == c'a'; 40 assert global_double_ == 1.797+308; 41 assert global_float_ == 2.22 as float; 42 assert global_int_ == 200000; 43 assert global_long_ == 200000000000; 44 assert global_short_ == 20; 45 46 let a = new A(); 47 assert a.boolean_ == true; 48 assert a.byte_ == 20; 49 assert a.char_ == c'a'; 50 assert a.double_ == 1.797+308; 51 assert a.float_ == 2.22 as float; 52 assert a.int_ == 200000; 53 assert a.long_ == 200000000000; 54 assert a.short_ == 20; 55} 56