summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ADT
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/unittests/ADT')
-rw-r--r--llvm/unittests/ADT/FoldingSet.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/llvm/unittests/ADT/FoldingSet.cpp b/llvm/unittests/ADT/FoldingSet.cpp
index 927ef313cb9..69646388119 100644
--- a/llvm/unittests/ADT/FoldingSet.cpp
+++ b/llvm/unittests/ADT/FoldingSet.cpp
@@ -35,6 +35,27 @@ TEST(FoldingSetTest, UnalignedStringTest) {
EXPECT_EQ(a.ComputeHash(), b.ComputeHash());
}
+TEST(FoldingSetTest, LongLongComparison) {
+ struct LongLongContainer : FoldingSetNode {
+ unsigned long long A, B;
+ LongLongContainer(unsigned long long A, unsigned long long B)
+ : A(A), B(B) {}
+ void Profile(FoldingSetNodeID &ID) const {
+ ID.AddInteger(A);
+ ID.AddInteger(B);
+ }
+ };
+
+ LongLongContainer C1((1ULL << 32) + 1, 1ULL);
+ LongLongContainer C2(1ULL, (1ULL << 32) + 1);
+
+ FoldingSet<LongLongContainer> Set;
+
+ EXPECT_EQ(&C1, Set.GetOrInsertNode(&C1));
+ EXPECT_EQ(&C2, Set.GetOrInsertNode(&C2));
+ EXPECT_EQ(2U, Set.size());
+}
+
struct TrivialPair : public FoldingSetNode {
unsigned Key = 0;
unsigned Value = 0;
OpenPOWER on IntegriCloud