• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2024-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
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'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    assertEQ(val, c)
60
61    let c1 : Byte = 1;
62    let val1 : Byte = fooByte()
63    assertEQ(val1, c1)
64
65    let c2 : Short = 1;
66    let val2 : Short = fooShort()
67    assertEQ(val2, c2)
68
69    let c3 : Char = c'c';
70    let val3 : Char = fooChar()
71    assertEQ(val3, c3)
72
73    let c4 : Int = 1;
74    let val4 : Int = fooInt()
75    assertEQ(val4, c4)
76
77    let c5 : Long = 1;
78    let val5 : Long = fooLong()
79    assertEQ(val5, c5)
80
81    let c6 : Float = 1;
82    let val6 : Float = fooFloat()
83    assertEQ(val6, c6)
84
85
86    let c7 : Double = 1;
87    let val7 : Double = fooDouble()
88    assertEQ(val7, c7)
89
90    let c8 : Color = Color.Green;
91    let val8 : Color = fooEnum();
92    assertEQ(c8, val8)
93}
94