diff options
author | Stuart Hastings <stuart@apple.com> | 2009-05-01 20:47:53 +0000 |
---|---|---|
committer | Stuart Hastings <stuart@apple.com> | 2009-05-01 20:47:53 +0000 |
commit | f0e4cac7ebdee07639bd1fc3eadf204f45868556 (patch) | |
tree | d2cc82e2df8982355bfebf30d9166e8271f4c595 /unittests | |
parent | 1af789f74cf951919d70e13f8a3abe114d5e1b6e (diff) | |
download | external_llvm-f0e4cac7ebdee07639bd1fc3eadf204f45868556.zip external_llvm-f0e4cac7ebdee07639bd1fc3eadf204f45868556.tar.gz external_llvm-f0e4cac7ebdee07639bd1fc3eadf204f45868556.tar.bz2 |
Prevent looping when DenseSet is abused.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70572 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/ADT/DenseSetTest.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/unittests/ADT/DenseSetTest.cpp b/unittests/ADT/DenseSetTest.cpp new file mode 100644 index 0000000..7a35f52 --- /dev/null +++ b/unittests/ADT/DenseSetTest.cpp @@ -0,0 +1,30 @@ +//===- llvm/unittest/ADT/DenseSetTest.cpp - DenseSet unit tests --*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "gtest/gtest.h" +#include <llvm/ADT/DenseSet.h> + +using namespace llvm; + +namespace { + +// Test fixture +class DenseSetTest : public testing::Test { +}; + +// Test hashing with a set of only two entries. +TEST_F(DenseSetTest, DoubleEntrySetTest) { + llvm::DenseSet<unsigned> set(2); + set.insert(0); + set.insert(1); + // Original failure was an infinite loop in this call: + EXPECT_EQ(0, set.count(2)); +} + +} |