1 //===- llvm/unittest/ADT/FoldingSetTest.cpp -------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // FoldingSet unit tests.
12 //===----------------------------------------------------------------------===//
14 #include "gtest/gtest.h"
15 #include "llvm/ADT/FoldingSet.h"
22 // Unaligned string test.
23 TEST(FoldingSetTest
, UnalignedStringTest
) {
24 SCOPED_TRACE("UnalignedStringTest");
26 FoldingSetNodeID a
, b
;
28 std::string str1
= "a test string";
31 // An unaligned string
32 std::string str2
= ">" + str1
;
33 b
.AddString(str2
.c_str() + 1);
35 EXPECT_EQ(a
.ComputeHash(), b
.ComputeHash());