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 #include "ecmascript/tests/test_helper.h"
16 
17 #include "ecmascript/compiler/aot_file/aot_version.h"
18 
19 namespace panda::test {
20 using FileHeaderBase = panda::ecmascript::base::FileHeaderBase;
21 class AotVersionTest : public testing::Test {
22 public:
23     void SetUp() override
24     {
25     }
26 
27     void TearDown() override
28     {
29     }
30 };
31 
32 
HWTEST_F_L0(AotVersionTest, GetAOTVersion)33 HWTEST_F_L0(AotVersionTest, GetAOTVersion)
34 {
35     std::string version = "";
36     int32_t ret = panda::ecmascript::GetAOTVersion(version);
37     std::string aotVersionActual = panda::ecmascript::AOTFileVersion::GetAOTVersion();
38     EXPECT_EQ(version.size(), FileHeaderBase::VERSION_SIZE * ecmascript::AOTFileVersion::VERSION_MULTIPLE_SIZE - 1);
39     EXPECT_EQ(ret, 0);
40     EXPECT_STREQ(version.c_str(), aotVersionActual.c_str());
41 }
42 }