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"
15 TEST(DWARFLocationExpression
, Equality
) {
16 EXPECT_EQ((DWARFLocationExpression
{std::nullopt
, {}}),
17 (DWARFLocationExpression
{std::nullopt
, {}}));
18 EXPECT_NE((DWARFLocationExpression
{DWARFAddressRange
{1, 47}, {}}),
19 (DWARFLocationExpression
{DWARFAddressRange
{1, 48}, {}}));
20 EXPECT_NE((DWARFLocationExpression
{DWARFAddressRange
{1, 47}, {}}),
21 (DWARFLocationExpression
{DWARFAddressRange
{1, 47}, {42}}));
24 TEST(DWARFLocationExpression
, StreamingOperator
) {
25 EXPECT_EQ("None: 1, 2",
26 to_string(DWARFLocationExpression
{std::nullopt
, {1, 2}}));
28 "[0x0000000000000042, 0x0000000000000047): 1",
29 to_string(DWARFLocationExpression
{DWARFAddressRange
{0x42, 0x47}, {1}}));