blob: a18a0df95716679da6b6017eac0b8b54c32fde49 [file] [log] [blame]
Dale Johannesena197cba2010-11-19 23:23:22 +00001//===- 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.
11//
12//===----------------------------------------------------------------------===//
13
14#include "gtest/gtest.h"
15#include "llvm/ADT/FoldingSet.h"
16#include <string>
17
18using namespace llvm;
19
20namespace {
21
22// Unaligned string test.
23TEST(FoldingSetTest, UnalignedStringTest) {
24 SCOPED_TRACE("UnalignedStringTest");
25
26 FoldingSetNodeID a, b;
27 // An aligned string
28 std::string str1= "a test string";
29 a.AddString(str1);
30
31 // An unaligned string
32 std::string str2 = ">" + str1;
33 b.AddString(str2.c_str() + 1);
34
35 EXPECT_EQ(a.ComputeHash(), b.ComputeHash());
36}
37
38}
39