Bump version to 19.1.0-rc3
[llvm-project.git] / llvm / unittests / BinaryFormat / ELFTest.cpp
blob5dbf6ff8d5c900d436550e8ad555c877f60b6890
1 //===- ELFTest.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 //===----------------------------------------------------------------------===//
9 #include "llvm/BinaryFormat/ELF.h"
10 #include "gtest/gtest.h"
12 using namespace llvm;
13 using namespace llvm::ELF;
15 namespace {
16 TEST(ELFTest, OSABI) {
17 EXPECT_EQ(ELFOSABI_GNU, convertNameToOSABI("gnu"));
18 EXPECT_EQ(ELFOSABI_FREEBSD, convertNameToOSABI("freebsd"));
19 EXPECT_EQ(ELFOSABI_STANDALONE, convertNameToOSABI("standalone"));
20 EXPECT_EQ(ELFOSABI_NONE, convertNameToOSABI("none"));
21 // Test unrecognized strings.
22 EXPECT_EQ(ELFOSABI_NONE, convertNameToOSABI(""));
23 EXPECT_EQ(ELFOSABI_NONE, convertNameToOSABI("linux"));
25 EXPECT_EQ("gnu", convertOSABIToName(ELFOSABI_GNU));
26 EXPECT_EQ("freebsd", convertOSABIToName(ELFOSABI_FREEBSD));
27 EXPECT_EQ("standalone", convertOSABIToName(ELFOSABI_STANDALONE));
28 EXPECT_EQ("none", convertOSABIToName(ELFOSABI_NONE));
29 // Test unrecognized values.
30 EXPECT_EQ("none", convertOSABIToName(0xfe));
32 } // namespace