1 //===- llvm/unittest/DebugInfo/DWARFLocationExpressionTest.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/DebugInfo/DWARF/DWARFLocationExpression.h"
10 #include "llvm/Support/ScopedPrinter.h"
11 #include "gtest/gtest.h"
14 using object::SectionedAddress
;
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}}));
25 TEST(DWARFLocationExpression
, StreamingOperator
) {
26 EXPECT_EQ("None: 1, 2", to_string(DWARFLocationExpression
{None
, {1, 2}}));
28 "[0x0000000000000042, 0x0000000000000047): 1",
29 to_string(DWARFLocationExpression
{DWARFAddressRange
{0x42, 0x47}, {1}}));