1 /* 2 * Copyright (c) 2022 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 <gtest/gtest.h> 17 18 #include "libpandabase/utils/bit_field.h" 19 #include "libpandabase/utils/cframe_layout.h" 20 21 namespace panda::test { 22 23 HWTEST(CFrameLayoutTest, AlignSpillCountTest, testing::ext::TestSize.Level0) 24 { 25 CFrameLayout cfl1(Arch::AARCH64, 4U); 26 ASSERT_EQ(cfl1.GetSpillsCount(), 5U); 27 28 CFrameLayout cfl2(Arch::X86_64, 0U); 29 ASSERT_EQ(cfl2.GetSpillsCount(), 0U); 30 31 CFrameLayout cfl3(Arch::AARCH32, 2U); 32 ASSERT_EQ(cfl3.GetSpillsCount(), 7U); 33 34 CFrameLayout cfl4(Arch::AARCH32, 1U); 35 ASSERT_EQ(cfl4.GetSpillsCount(), 5U); 36 37 CFrameLayout cfl5(Arch::X86, 5U); 38 ASSERT_EQ(cfl5.GetSpillsCount(), 5U); 39 } 40 41 } // namespace panda::test