[Alignment][NFC] Use Align with TargetLowering::setMinFunctionAlignment
[llvm-core.git] / unittests / ADT / ImmutableMapTest.cpp
blobfa61816d213cf64027f6edf184fedec75626cc4a
1 //===----------- ImmutableMapTest.cpp - ImmutableMap unit tests ------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "llvm/ADT/ImmutableMap.h"
10 #include "gtest/gtest.h"
12 using namespace llvm;
14 namespace {
16 TEST(ImmutableMapTest, EmptyIntMapTest) {
17 ImmutableMap<int, int>::Factory f;
19 EXPECT_TRUE(f.getEmptyMap() == f.getEmptyMap());
20 EXPECT_FALSE(f.getEmptyMap() != f.getEmptyMap());
21 EXPECT_TRUE(f.getEmptyMap().isEmpty());
23 ImmutableMap<int, int> S = f.getEmptyMap();
24 EXPECT_EQ(0u, S.getHeight());
25 EXPECT_TRUE(S.begin() == S.end());
26 EXPECT_FALSE(S.begin() != S.end());
29 TEST(ImmutableMapTest, MultiElemIntMapTest) {
30 ImmutableMap<int, int>::Factory f;
31 ImmutableMap<int, int> S = f.getEmptyMap();
33 ImmutableMap<int, int> S2 = f.add(f.add(f.add(S, 3, 10), 4, 11), 5, 12);
35 EXPECT_TRUE(S.isEmpty());
36 EXPECT_FALSE(S2.isEmpty());
38 EXPECT_EQ(nullptr, S.lookup(3));
39 EXPECT_EQ(nullptr, S.lookup(9));
41 EXPECT_EQ(10, *S2.lookup(3));
42 EXPECT_EQ(11, *S2.lookup(4));
43 EXPECT_EQ(12, *S2.lookup(5));
45 EXPECT_EQ(5, S2.getMaxElement()->first);
46 EXPECT_EQ(3U, S2.getHeight());