Export of internal Abseil changes.
-- 421902a6ea836e4e59bed86eed68ab9ed992295a by Shaindel Schwartz <shaindel@google.com>: Remove setting and checking of max_load_factor. Setting max_load_factor is a no-op. Resolves #290. PiperOrigin-RevId: 243104530 -- bdbd409faf92ce4f6a1cacf16a063098dd0907d3 by Andy Soffer <asoffer@google.com>: Update authors. PiperOrigin-RevId: 242725194 GitOrigin-RevId: 421902a6ea836e4e59bed86eed68ab9ed992295a Change-Id: I09666564fb2a94f16b9d3443fb2f6219c3bcc412
This commit is contained in:
parent
dbae8764fb
commit
0b545b4601
1 changed files with 0 additions and 26 deletions
|
@ -1364,37 +1364,31 @@ TEST(Table, ConstructFromInitList) {
|
||||||
|
|
||||||
TEST(Table, CopyConstruct) {
|
TEST(Table, CopyConstruct) {
|
||||||
IntTable t;
|
IntTable t;
|
||||||
t.max_load_factor(.321f);
|
|
||||||
t.emplace(0);
|
t.emplace(0);
|
||||||
EXPECT_EQ(1, t.size());
|
EXPECT_EQ(1, t.size());
|
||||||
{
|
{
|
||||||
IntTable u(t);
|
IntTable u(t);
|
||||||
EXPECT_EQ(1, u.size());
|
EXPECT_EQ(1, u.size());
|
||||||
EXPECT_EQ(t.max_load_factor(), u.max_load_factor());
|
|
||||||
EXPECT_THAT(*u.find(0), 0);
|
EXPECT_THAT(*u.find(0), 0);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
IntTable u{t};
|
IntTable u{t};
|
||||||
EXPECT_EQ(1, u.size());
|
EXPECT_EQ(1, u.size());
|
||||||
EXPECT_EQ(t.max_load_factor(), u.max_load_factor());
|
|
||||||
EXPECT_THAT(*u.find(0), 0);
|
EXPECT_THAT(*u.find(0), 0);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
IntTable u = t;
|
IntTable u = t;
|
||||||
EXPECT_EQ(1, u.size());
|
EXPECT_EQ(1, u.size());
|
||||||
EXPECT_EQ(t.max_load_factor(), u.max_load_factor());
|
|
||||||
EXPECT_THAT(*u.find(0), 0);
|
EXPECT_THAT(*u.find(0), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Table, CopyConstructWithAlloc) {
|
TEST(Table, CopyConstructWithAlloc) {
|
||||||
StringTable t;
|
StringTable t;
|
||||||
t.max_load_factor(.321f);
|
|
||||||
t.emplace("a", "b");
|
t.emplace("a", "b");
|
||||||
EXPECT_EQ(1, t.size());
|
EXPECT_EQ(1, t.size());
|
||||||
StringTable u(t, Alloc<std::pair<std::string, std::string>>());
|
StringTable u(t, Alloc<std::pair<std::string, std::string>>());
|
||||||
EXPECT_EQ(1, u.size());
|
EXPECT_EQ(1, u.size());
|
||||||
EXPECT_EQ(t.max_load_factor(), u.max_load_factor());
|
|
||||||
EXPECT_THAT(*u.find("a"), Pair("a", "b"));
|
EXPECT_THAT(*u.find("a"), Pair("a", "b"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1412,88 +1406,68 @@ TEST(Table, AllocWithExplicitCtor) {
|
||||||
TEST(Table, MoveConstruct) {
|
TEST(Table, MoveConstruct) {
|
||||||
{
|
{
|
||||||
StringTable t;
|
StringTable t;
|
||||||
t.max_load_factor(.321f);
|
|
||||||
const float lf = t.max_load_factor();
|
|
||||||
t.emplace("a", "b");
|
t.emplace("a", "b");
|
||||||
EXPECT_EQ(1, t.size());
|
EXPECT_EQ(1, t.size());
|
||||||
|
|
||||||
StringTable u(std::move(t));
|
StringTable u(std::move(t));
|
||||||
EXPECT_EQ(1, u.size());
|
EXPECT_EQ(1, u.size());
|
||||||
EXPECT_EQ(lf, u.max_load_factor());
|
|
||||||
EXPECT_THAT(*u.find("a"), Pair("a", "b"));
|
EXPECT_THAT(*u.find("a"), Pair("a", "b"));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
StringTable t;
|
StringTable t;
|
||||||
t.max_load_factor(.321f);
|
|
||||||
const float lf = t.max_load_factor();
|
|
||||||
t.emplace("a", "b");
|
t.emplace("a", "b");
|
||||||
EXPECT_EQ(1, t.size());
|
EXPECT_EQ(1, t.size());
|
||||||
|
|
||||||
StringTable u{std::move(t)};
|
StringTable u{std::move(t)};
|
||||||
EXPECT_EQ(1, u.size());
|
EXPECT_EQ(1, u.size());
|
||||||
EXPECT_EQ(lf, u.max_load_factor());
|
|
||||||
EXPECT_THAT(*u.find("a"), Pair("a", "b"));
|
EXPECT_THAT(*u.find("a"), Pair("a", "b"));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
StringTable t;
|
StringTable t;
|
||||||
t.max_load_factor(.321f);
|
|
||||||
const float lf = t.max_load_factor();
|
|
||||||
t.emplace("a", "b");
|
t.emplace("a", "b");
|
||||||
EXPECT_EQ(1, t.size());
|
EXPECT_EQ(1, t.size());
|
||||||
|
|
||||||
StringTable u = std::move(t);
|
StringTable u = std::move(t);
|
||||||
EXPECT_EQ(1, u.size());
|
EXPECT_EQ(1, u.size());
|
||||||
EXPECT_EQ(lf, u.max_load_factor());
|
|
||||||
EXPECT_THAT(*u.find("a"), Pair("a", "b"));
|
EXPECT_THAT(*u.find("a"), Pair("a", "b"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Table, MoveConstructWithAlloc) {
|
TEST(Table, MoveConstructWithAlloc) {
|
||||||
StringTable t;
|
StringTable t;
|
||||||
t.max_load_factor(.321f);
|
|
||||||
const float lf = t.max_load_factor();
|
|
||||||
t.emplace("a", "b");
|
t.emplace("a", "b");
|
||||||
EXPECT_EQ(1, t.size());
|
EXPECT_EQ(1, t.size());
|
||||||
StringTable u(std::move(t), Alloc<std::pair<std::string, std::string>>());
|
StringTable u(std::move(t), Alloc<std::pair<std::string, std::string>>());
|
||||||
EXPECT_EQ(1, u.size());
|
EXPECT_EQ(1, u.size());
|
||||||
EXPECT_EQ(lf, u.max_load_factor());
|
|
||||||
EXPECT_THAT(*u.find("a"), Pair("a", "b"));
|
EXPECT_THAT(*u.find("a"), Pair("a", "b"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Table, CopyAssign) {
|
TEST(Table, CopyAssign) {
|
||||||
StringTable t;
|
StringTable t;
|
||||||
t.max_load_factor(.321f);
|
|
||||||
t.emplace("a", "b");
|
t.emplace("a", "b");
|
||||||
EXPECT_EQ(1, t.size());
|
EXPECT_EQ(1, t.size());
|
||||||
StringTable u;
|
StringTable u;
|
||||||
u = t;
|
u = t;
|
||||||
EXPECT_EQ(1, u.size());
|
EXPECT_EQ(1, u.size());
|
||||||
EXPECT_EQ(t.max_load_factor(), u.max_load_factor());
|
|
||||||
EXPECT_THAT(*u.find("a"), Pair("a", "b"));
|
EXPECT_THAT(*u.find("a"), Pair("a", "b"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Table, CopySelfAssign) {
|
TEST(Table, CopySelfAssign) {
|
||||||
StringTable t;
|
StringTable t;
|
||||||
t.max_load_factor(.321f);
|
|
||||||
const float lf = t.max_load_factor();
|
|
||||||
t.emplace("a", "b");
|
t.emplace("a", "b");
|
||||||
EXPECT_EQ(1, t.size());
|
EXPECT_EQ(1, t.size());
|
||||||
t = *&t;
|
t = *&t;
|
||||||
EXPECT_EQ(1, t.size());
|
EXPECT_EQ(1, t.size());
|
||||||
EXPECT_EQ(lf, t.max_load_factor());
|
|
||||||
EXPECT_THAT(*t.find("a"), Pair("a", "b"));
|
EXPECT_THAT(*t.find("a"), Pair("a", "b"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Table, MoveAssign) {
|
TEST(Table, MoveAssign) {
|
||||||
StringTable t;
|
StringTable t;
|
||||||
t.max_load_factor(.321f);
|
|
||||||
const float lf = t.max_load_factor();
|
|
||||||
t.emplace("a", "b");
|
t.emplace("a", "b");
|
||||||
EXPECT_EQ(1, t.size());
|
EXPECT_EQ(1, t.size());
|
||||||
StringTable u;
|
StringTable u;
|
||||||
u = std::move(t);
|
u = std::move(t);
|
||||||
EXPECT_EQ(1, u.size());
|
EXPECT_EQ(1, u.size());
|
||||||
EXPECT_EQ(lf, u.max_load_factor());
|
|
||||||
EXPECT_THAT(*u.find("a"), Pair("a", "b"));
|
EXPECT_THAT(*u.find("a"), Pair("a", "b"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue