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 */ 15 16 #include <cstdlib> 17 #include <gtest/gtest.h> 18 #include <iostream> 19 #include <string> 20 #include <vector> 21 #include "abc2program_driver.h" 22 #include "abc2program_test_utils.h" 23 #include "common/abc_file_utils.h" 24 #include "dump_utils.h" 25 #include "modifiers.h" 26 27 using namespace testing::ext; 28 29 namespace panda::abc2program { 30 const std::string CALL_ARGS_ABC_TEST_FILE_NAME = GRAPH_TEST_ABC_DIR "ReleaseEnableColumnNumberCallargs.abc"; 31 const std::string CALL_ARGS_DUMP_RESULT_FILE_NAME = GRAPH_TEST_ABC_DIR "ReleaseEnableColumnNumberCallargs.txt"; 32 const std::string CALL_ARGS_DUMP_EXPECTED_FILE_NAME = 33 GRAPH_TEST_ABC_DUMP_DIR "release-column-number/ReleaseEnableColumnNumberCallargsExpected.txt"; 34 35 const std::string CALL_THIS_ABC_TEST_FILE_NAME = GRAPH_TEST_ABC_DIR "ReleaseEnableColumnNumberCallthis.abc"; 36 const std::string CALL_THIS_DUMP_RESULT_FILE_NAME = GRAPH_TEST_ABC_DIR "ReleaseEnableColumnNumberCallthis.txt"; 37 const std::string CALL_THIS_DUMP_EXPECTED_FILE_NAME = 38 GRAPH_TEST_ABC_DUMP_DIR "release-column-number/ReleaseEnableColumnNumberCallthisExpected.txt"; 39 40 class Abc2ProgramColumnNumberTest : public testing::Test { 41 public: SetUpTestCase(void)42 static void SetUpTestCase(void) {} TearDownTestCase(void)43 static void TearDownTestCase(void) {} SetUp()44 void SetUp() {} 45 TearDown()46 void TearDown() {} 47 48 Abc2ProgramDriver driver_; 49 const pandasm::Program *prog_ = nullptr; 50 }; 51 52 /** 53 * @tc.name: abc2program_release_column_number_callthis_test 54 * @tc.desc: check dump result in release mode. 55 * @tc.type: FUNC 56 * @tc.require: IADG92 57 */ 58 HWTEST_F(Abc2ProgramColumnNumberTest, abc2program_release_column_number_callthis_test, TestSize.Level1) 59 { 60 driver_.Compile(CALL_THIS_ABC_TEST_FILE_NAME); 61 driver_.Dump(CALL_THIS_DUMP_RESULT_FILE_NAME); 62 EXPECT_TRUE(Abc2ProgramTestUtils::ValidateDumpResult(CALL_THIS_DUMP_RESULT_FILE_NAME, 63 CALL_THIS_DUMP_EXPECTED_FILE_NAME)); 64 Abc2ProgramTestUtils::RemoveDumpResultFile(CALL_THIS_DUMP_RESULT_FILE_NAME); 65 } 66 67 HWTEST_F(Abc2ProgramColumnNumberTest, abc2program_release_column_number_callargs_test, TestSize.Level1) 68 { 69 driver_.Compile(CALL_ARGS_ABC_TEST_FILE_NAME); 70 driver_.Dump(CALL_ARGS_DUMP_RESULT_FILE_NAME); 71 EXPECT_TRUE(Abc2ProgramTestUtils::ValidateDumpResult(CALL_ARGS_DUMP_RESULT_FILE_NAME, 72 CALL_ARGS_DUMP_EXPECTED_FILE_NAME)); 73 Abc2ProgramTestUtils::RemoveDumpResultFile(CALL_ARGS_DUMP_RESULT_FILE_NAME); 74 } 75 }; // panda::abc2program