• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2023-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 main(): void {
17    const failures: int = 0;
18    const test1First : boolean[] = [true];
19    const test1Second : boolean[] = [true];
20    const test2First : boolean[] = [true, true];
21    const test2Second : boolean[] = [false, false];
22    const test3First : boolean[] = [];
23    const test3Second : boolean[] = [];
24    const test4First : boolean[] = [true, false];
25    const test4Second : boolean[] = [];
26    const test5First : boolean[] = [];
27    const test5Second : boolean[] = [false, true, false];
28
29    const test1Expected : boolean[] = [true, true];
30    const test2Expected : boolean[] = [true, true, false, false];
31    const test3Expected : boolean[] = [];
32    const test4Expected : boolean[] = [true, false];
33    const test5Expected : boolean[] = [false, true, false];
34
35    assertEQ(failures, 0)
36
37    assertEQ(test1First[0], true)
38    assertEQ(test1Second[0], true)
39
40    assertEQ(test2First[0], true)
41    assertEQ(test2First[1], true)
42    assertEQ(test2Second[0], false)
43    assertEQ(test2Second[1], false)
44
45    assertEQ(test3First.length, 0)
46    assertEQ(test3Second.length, 0)
47
48    assertEQ(test4First[0], true)
49    assertEQ(test4First[1], false)
50    assertEQ(test4Second.length, 0)
51
52    assertEQ(test5First.length, 0)
53    assertEQ(test5Second[0], false)
54    assertEQ(test5Second[1], true)
55    assertEQ(test5Second[2], false)
56
57    assertEQ(test1Expected[0], true)
58    assertEQ(test1Expected[1], true)
59
60    assertEQ(test2Expected[0], true)
61    assertEQ(test2Expected[1], true)
62    assertEQ(test2Expected[2], false)
63    assertEQ(test2Expected[3], false)
64
65    assertEQ(test3Expected.length, 0)
66
67    assertEQ(test4Expected[0], true)
68    assertEQ(test4Expected[1], false)
69
70    assertEQ(test5Expected[0], false)
71    assertEQ(test5Expected[1], true)
72    assertEQ(test5Expected[2], false)
73}
74