blob: d651be09c5302118c9577567507618a2959b603c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/blink/renderer/platform/heap/gc_info.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace blink {
TEST(GCInfoTest, InitialEmpty) {
GCInfoTable table;
EXPECT_EQ(0u, table.GcInfoIndex());
}
TEST(GCInfoTest, ResizeToMaxIndex) {
GCInfoTable table;
GCInfo info = {nullptr, nullptr, nullptr, false, false};
size_t slot = 0;
for (size_t i = 0; i < (GCInfoTable::kMaxIndex - 1); i++) {
slot = 0;
table.EnsureGCInfoIndex(&info, &slot);
EXPECT_LT(0u, slot);
EXPECT_EQ(&info, table.GCInfoFromIndex(slot));
}
}
} // namespace blink
|