• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 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 
16 #include <cstdint>
17 #include <gtest/gtest.h>
18 #include <string>
19 #include <vector>
20 
21 #include "aot_compiler_client.h"
22 #include "aot_compiler_service.h"
23 #include "aot_compiler_error_utils.h"
24 #include "aot_compiler_load_callback.h"
25 #include "iservice_registry.h"
26 #include "system_ability_definition.h"
27 
28 using namespace testing::ext;
29 
30 namespace OHOS::ArkCompiler {
31 class AotCompilerErrorUtilsTest : public testing::Test {
32 public:
AotCompilerErrorUtilsTest()33     AotCompilerErrorUtilsTest() {}
~AotCompilerErrorUtilsTest()34     virtual ~AotCompilerErrorUtilsTest() {}
35 
SetUpTestCase()36     static void SetUpTestCase() {}
TearDownTestCase()37     static void TearDownTestCase() {}
SetUp()38     void SetUp() override {}
TearDown()39     void TearDown() override {}
40 };
41 
42 /**
43  * @tc.name: AotCompilerErrorUtilsTest_001
44  * @tc.desc: AotCompilerErrorUtil::GetErrorMessage(errCode)
45  * @tc.type: Func
46 */
47 HWTEST_F(AotCompilerErrorUtilsTest, AotCompilerErrorUtilsTest_001, TestSize.Level0)
48 {
49     AotCompilerErrorUtil aotErrorUtils;
50     std::string errMsg1;
51     std::string errMsg2;
52     errMsg1 = aotErrorUtils.GetErrorMessage(ERR_OK);
53     errMsg2 = aotErrorUtils.GetErrorMessage(INVALID_ERR_CODE);
54     EXPECT_STREQ(errMsg1.c_str(), "success");
55     EXPECT_STREQ(errMsg2.c_str(), "invalid errCode");
56 }
57 } // namespace OHOS::ArkCompiler