1 | //===-- ABITest.cpp -------------------------------------------------------===// |
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | #include "lldb/Target/ABI.h" |
10 | #include "gtest/gtest.h" |
11 | |
12 | using namespace lldb_private; |
13 | |
14 | TEST(MCBasedABI, MapRegisterName) { |
15 | auto map = [](std::string name) { |
16 | MCBasedABI::MapRegisterName(reg&: name, from_prefix: "foo" , to_prefix: "bar" ); |
17 | return name; |
18 | }; |
19 | EXPECT_EQ("bar" , map("foo" )); |
20 | EXPECT_EQ("bar0" , map("foo0" )); |
21 | EXPECT_EQ("bar47" , map("foo47" )); |
22 | EXPECT_EQ("foo47x" , map("foo47x" )); |
23 | EXPECT_EQ("fooo47" , map("fooo47" )); |
24 | EXPECT_EQ("bar47" , map("bar47" )); |
25 | } |
26 | |
27 | |