1 //===- SymbolicFileTest.cpp - Tests for SymbolicFile.cpp ------------------===//
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
7 //===----------------------------------------------------------------------===//
9 #include "llvm/Object/SymbolicFile.h"
10 #include "llvm/Support/raw_ostream.h"
11 #include "llvm/TargetParser/Host.h"
12 #include "gtest/gtest.h"
15 TEST(Object
, DataRefImplOstream
) {
17 llvm::raw_string_ostream
OS(s
);
18 llvm::object::DataRefImpl Data
;
19 Data
.d
.a
= 0xeeee0000;
20 Data
.d
.b
= 0x0000ffff;
22 static_assert(sizeof Data
.p
== sizeof(uint64_t) ||
23 sizeof Data
.p
== sizeof(uint32_t),
24 "Test expected pointer type to be 32 or 64-bit.");
28 if (sizeof Data
.p
== sizeof(uint64_t)) {
29 Expected
= llvm::sys::IsLittleEndianHost
30 ? "(0xffffeeee0000 (0xeeee0000, 0x0000ffff))"
31 : "(0xeeee00000000ffff (0xeeee0000, 0x0000ffff))";
34 Expected
= "(0xeeee0000 (0xeeee0000, 0x0000ffff))";
39 EXPECT_EQ(Expected
, s
);