mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 12:12:47 +01:00
4c1f132b0c
llvm-svn: 173505
42 lines
1.1 KiB
C++
42 lines
1.1 KiB
C++
//===- unittest/ADT/MapVectorTest.cpp - MapVector 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/MapVector.h"
|
|
#include <utility>
|
|
|
|
using namespace llvm;
|
|
|
|
TEST(MapVectorTest, insert) {
|
|
MapVector<int, int> MV;
|
|
std::pair<MapVector<int, int>::iterator, bool> R;
|
|
|
|
R = MV.insert(std::make_pair(1, 2));
|
|
ASSERT_EQ(R.first, MV.begin());
|
|
EXPECT_EQ(R.first->first, 1);
|
|
EXPECT_EQ(R.first->second, 2);
|
|
EXPECT_TRUE(R.second);
|
|
|
|
R = MV.insert(std::make_pair(1, 3));
|
|
ASSERT_EQ(R.first, MV.begin());
|
|
EXPECT_EQ(R.first->first, 1);
|
|
EXPECT_EQ(R.first->second, 2);
|
|
EXPECT_FALSE(R.second);
|
|
|
|
R = MV.insert(std::make_pair(4, 5));
|
|
ASSERT_NE(R.first, MV.end());
|
|
EXPECT_EQ(R.first->first, 4);
|
|
EXPECT_EQ(R.first->second, 5);
|
|
EXPECT_TRUE(R.second);
|
|
|
|
EXPECT_EQ(MV.size(), 2u);
|
|
EXPECT_EQ(MV[1], 2);
|
|
EXPECT_EQ(MV[4], 5);
|
|
}
|