• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===- llvm/unittest/DebugInfo/DWARFLocationExpressionTest.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 "llvm/DebugInfo/DWARF/DWARFLocationExpression.h"
10 #include "llvm/Support/ScopedPrinter.h"
11 #include "gtest/gtest.h"
12 
13 using namespace llvm;
14 using object::SectionedAddress;
15 
TEST(DWARFLocationExpression,Equality)16 TEST(DWARFLocationExpression, Equality) {
17   EXPECT_EQ((DWARFLocationExpression{None, {}}),
18             (DWARFLocationExpression{None, {}}));
19   EXPECT_NE((DWARFLocationExpression{DWARFAddressRange{1, 47}, {}}),
20             (DWARFLocationExpression{DWARFAddressRange{1, 48}, {}}));
21   EXPECT_NE((DWARFLocationExpression{DWARFAddressRange{1, 47}, {}}),
22             (DWARFLocationExpression{DWARFAddressRange{1, 47}, {42}}));
23 }
24 
TEST(DWARFLocationExpression,StreamingOperator)25 TEST(DWARFLocationExpression, StreamingOperator) {
26   EXPECT_EQ("None: 1, 2", to_string(DWARFLocationExpression{None, {1, 2}}));
27   EXPECT_EQ(
28       "[0x0000000000000042, 0x0000000000000047): 1",
29       to_string(DWARFLocationExpression{DWARFAddressRange{0x42, 0x47}, {1}}));
30 }
31