[llvm-commits] [llvm] r119870 - in /llvm/trunk/unittests: ADT/FoldingSet.cpp CMakeLists.txt
Dale Johannesen
dalej at apple.com
Fri Nov 19 15:23:22 PST 2010
Author: johannes
Date: Fri Nov 19 17:23:22 2010
New Revision: 119870
URL: http://llvm.org/viewvc/llvm-project?rev=119870&view=rev
Log:
Add test for PR 8111. By Frits van Bommel.
Added:
llvm/trunk/unittests/ADT/FoldingSet.cpp
Modified:
llvm/trunk/unittests/CMakeLists.txt
Added: llvm/trunk/unittests/ADT/FoldingSet.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/FoldingSet.cpp?rev=119870&view=auto
==============================================================================
--- llvm/trunk/unittests/ADT/FoldingSet.cpp (added)
+++ llvm/trunk/unittests/ADT/FoldingSet.cpp Fri Nov 19 17:23:22 2010
@@ -0,0 +1,39 @@
+//===- llvm/unittest/ADT/FoldingSetTest.cpp -------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// FoldingSet unit tests.
+//
+//===----------------------------------------------------------------------===//
+
+#include "gtest/gtest.h"
+#include "llvm/ADT/FoldingSet.h"
+#include <string>
+
+using namespace llvm;
+
+namespace {
+
+// Unaligned string test.
+TEST(FoldingSetTest, UnalignedStringTest) {
+ SCOPED_TRACE("UnalignedStringTest");
+
+ FoldingSetNodeID a, b;
+ // An aligned string
+ std::string str1= "a test string";
+ a.AddString(str1);
+
+ // An unaligned string
+ std::string str2 = ">" + str1;
+ b.AddString(str2.c_str() + 1);
+
+ EXPECT_EQ(a.ComputeHash(), b.ComputeHash());
+}
+
+}
+
Modified: llvm/trunk/unittests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/CMakeLists.txt?rev=119870&r1=119869&r2=119870&view=diff
==============================================================================
--- llvm/trunk/unittests/CMakeLists.txt (original)
+++ llvm/trunk/unittests/CMakeLists.txt Fri Nov 19 17:23:22 2010
@@ -43,6 +43,7 @@
ADT/DeltaAlgorithmTest.cpp
ADT/DenseMapTest.cpp
ADT/DenseSetTest.cpp
+ ADT/FoldingSet.cpp
ADT/ilistTest.cpp
ADT/ImmutableSetTest.cpp
ADT/IntervalMapTest.cpp
More information about the llvm-commits
mailing list