When removing a function from the function set and adding it to deferred, we
[llvm.git] / unittests / ADT / FoldingSet.cpp
bloba18a0df95716679da6b6017eac0b8b54c32fde49
1 //===- llvm/unittest/ADT/FoldingSetTest.cpp -------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // FoldingSet unit tests.
12 //===----------------------------------------------------------------------===//
14 #include "gtest/gtest.h"
15 #include "llvm/ADT/FoldingSet.h"
16 #include <string>
18 using namespace llvm;
20 namespace {
22 // Unaligned string test.
23 TEST(FoldingSetTest, UnalignedStringTest) {
24 SCOPED_TRACE("UnalignedStringTest");
26 FoldingSetNodeID a, b;
27 // An aligned string
28 std::string str1= "a test string";
29 a.AddString(str1);
31 // An unaligned string
32 std::string str2 = ">" + str1;
33 b.AddString(str2.c_str() + 1);
35 EXPECT_EQ(a.ComputeHash(), b.ComputeHash());