1/*
2 * Copyright (c) 2022-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 main(): void {
17    let str: String = "hello\nworld\n";
18    assert str.charAt(2) == c'l';
19    assert str.length == 12;
20    assert str.charAt(str.length as int - 1) == c'\n';
21
22    let a: String = "abc";
23    let b: String = "ace";
24    let c: String = "abc";
25    assert !a.equals(b);
26    assert a.equals(c);
27    assert !b.equals(c);
28
29    let n2: int = 41;
30    let n3: long = 42;
31    let n4: float = 43.43;
32    let n5: double = 44.44;
33    let n6: double = random();
34    let n7: double = random() + 42;
35    assert n6 >= 0.0 && n6 <= 1.0;
36    assert n7 >= 42.0 && n7 <= 43.0;
37
38    let s1: String = "This ";
39    let s2: String = "is ";
40    let s3: String = "another ";
41    let s4: String = "string";
42    let s5: String = "This is another string";
43    assert (s1 + s2 + s3 + s4).equals(s5);
44}
45