1/* 2 * Copyright (c) 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 16function fooBoolean() : Boolean { 17 return true; 18} 19 20function fooByte() : Byte { 21 return 1; 22} 23 24function fooShort() : Short { 25 return 1; 26} 27 28function fooChar() : Char { 29 return "c"; 30} 31 32 33function fooInt() : Int { 34 return 1; 35} 36 37function fooLong() : Long { 38 return 1; 39} 40 41function fooFloat() : Float { 42 return 1; 43} 44 45function fooDouble() : Double { 46 return 1; 47} 48 49 50enum Color { Green = 1 , Red = 2, Blue = 3 } 51 52function fooEnum() : Color{ 53 return Color.Green; 54} 55 56function main() { 57 let c : Boolean = true; 58 let val : Boolean = fooBoolean() 59 assert(val == c) 60 61 let c1 : Byte = 1; 62 let val1 : Byte = fooByte() 63 assert(val1 == c1) 64 65 let c2 : Short = 1; 66 let val2 : Short = fooShort() 67 assert(val2 == c2) 68 69 let c3 : Char = 'c'; 70 let val3 : Char = fooChar() 71 assert(val3 == c3) 72 73 let c4 : Int = 1; 74 let val4 : Int = fooInt() 75 assert(val4 == c4) 76 77 let c5 : Long = 1; 78 let val5 : Long = fooLong() 79 assert(val5 == c5) 80 81 let c6 : Float = 1; 82 let val6 : Float = fooFloat() 83 assert(val6 == c6) 84 85 86 let c7 : Double = 1; 87 let val7 : Double = fooDouble() 88 assert(val7 == c7) 89 90 let c8 : Color = Color.Green; 91 let val8 : Color = fooEnum(); 92 assert(c8 == val8) 93}