• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 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 */
15import {BusinessError} from "@ohos.base";
16import * as lib from "staticTest";
17
18loadLibrary("ani_static");
19
20function test_sumSync() {
21    const result = lib.IBase.sumSync(10, 20);
22    assertEQ(result, 200);
23}
24
25function test_addSync() {
26    const result = lib.IBase.addSync(10, 20);
27    assertEQ(result, 30);
28}
29
30function test_new_class() {
31    let test = new lib.IBase("hello");
32    assertEQ(test.get(), "hello");
33}
34
35function test_new_class_with_two_args() {
36    let test_1 = new lib.IBase("hello", "test");
37    assertEQ(test_1.get(), "test");
38}
39
40function main() {
41    console.log("##############start#############");
42    const suite = new ArkTestsuite("IBase Tests");
43
44    suite.addTest("test sumSync", test_sumSync);
45    suite.addTest("test addSync", test_addSync);
46    suite.addTest("test new class", test_new_class);
47    suite.addTest("test new class with two args", test_new_class_with_two_args);
48
49    exit(suite.run());
50}
51