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 16const a: string = 1 + 123123123111311 + 3 + "a a" + 111 + 221 + 3113.0; 17const b: string = 1.23 + "hello" + 4; 18const c: string = 0.123e5 + "world" + 10; 19const d: string = 1e100 + "large float" + 100; 20const e: string = 3.14 + "pi" + 25; 21const f: string = 1.1 + 2.2 + "plus floats" + 10; 22const g: string = 1000 + " small float" + 1; 23const h: string = 3.0 + "equal float" + 5; 24const i: string = 0.000000123 + "tiny float" + 9; 25const j: string = 10.0 + 1.234 + " numbers together" + 2; 26const k: string = 1.0 + "just one" + 0.5; 27const l: string = 1e-100 + "tiny float in scientific" + 10000; 28const m: string = 1e+100 + " extremely large float" + 0; 29const n: string = (1.5 * 2.5) + " result of multiplication" + 3; 30const o: string = 0.123456789 + " precise decimal" + 12; 31const p: string = (0.1 + 0.2) + " rounding check" + 0.5; 32const q: string = 1000000.12345 + " million" + 500; 33const r: string = 1000 + "large number" + 99.99; 34const s: string = 0.000001 + "minuscule number" + 0.00001; 35const t: string = 1.2 + "concatenation" + 5000; 36const u: string = 0 + "zero start" + 1.999; 37const v: string = 123456789 + " number is large" + 1.2345; 38const x: string = 1.7976931348623157e308 + " max float" + 100; 39const y: string = -1.7976931348623157e308 + " min float" + 100; 40const z: string = 2.2250738585072014e-308 + " smallest positive float" + 0.0001; 41 42enum Color { 43 A = a as string, 44 B = b as String, 45 C = c, 46 D = d, 47 E = e, 48 F = f, 49 G = g, 50 H = h, 51 I = i, 52 J = j, 53 K = k, 54 L = l, 55 M = m, 56 N = n, 57 O = o, 58 P = p, 59 Q = q, 60 R = r, 61 S = s, 62 T = t, 63 U = u, 64 V = v, 65 X = x, 66 Y = y, 67 Z = z, 68} 69 70function main() { 71 assertEQ(Color.A.toString(), a) 72 assertEQ(Color.B.toString(), b) 73 assertEQ(Color.C.toString(), c) 74 assertEQ(Color.D.toString(), d) 75 assertEQ(Color.E.toString(), e) 76 assertEQ(Color.F.toString(), f) 77 assertEQ(Color.G.toString(), g) 78 assertEQ(Color.H.toString(), h) 79 assertEQ(Color.I.toString(), i) 80 assertEQ(Color.J.toString(), j) 81 assertEQ(Color.K.toString(), k) 82 assertEQ(Color.L.toString(), l) 83 assertEQ(Color.M.toString(), m) 84 assertEQ(Color.N.toString(), n) 85 assertEQ(Color.O.toString(), o) 86 assertEQ(Color.P.toString(), p) 87 assertEQ(Color.Q.toString(), q) 88 assertEQ(Color.R.toString(), r) 89 assertEQ(Color.S.toString(), s) 90 assertEQ(Color.T.toString(), t) 91 assertEQ(Color.U.toString(), u) 92 assertEQ(Color.V.toString(), v) 93 assertEQ(Color.X.toString(), x) 94 assertEQ(Color.Y.toString(), y) 95 assertEQ(Color.Z.toString(), z) 96} 97