• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===- llvm/unittest/ADT/DenseSetTest.cpp - DenseSet unit tests --*- C++ -*-===//
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 #include "gtest/gtest.h"
11 #include "llvm/ADT/DenseSet.h"
12 
13 using namespace llvm;
14 
15 namespace {
16 
17 // Test fixture
18 class DenseSetTest : public testing::Test {
19 };
20 
21 // Test hashing with a set of only two entries.
TEST_F(DenseSetTest,DoubleEntrySetTest)22 TEST_F(DenseSetTest, DoubleEntrySetTest) {
23   llvm::DenseSet<unsigned> set(2);
24   set.insert(0);
25   set.insert(1);
26   // Original failure was an infinite loop in this call:
27   EXPECT_EQ(0u, set.count(2));
28 }
29 
30 }
31