chromium/third_party/abseil-cpp/absl/strings/internal/cordz_info_statistics_test.cc

// Copyright 2021 The Abseil Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include <iostream>
#include <random>
#include <vector>

#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "absl/base/config.h"
#include "absl/crc/internal/crc_cord_state.h"
#include "absl/strings/cord.h"
#include "absl/strings/internal/cord_internal.h"
#include "absl/strings/internal/cord_rep_btree.h"
#include "absl/strings/internal/cord_rep_crc.h"
#include "absl/strings/internal/cord_rep_flat.h"
#include "absl/strings/internal/cordz_info.h"
#include "absl/strings/internal/cordz_sample_token.h"
#include "absl/strings/internal/cordz_statistics.h"
#include "absl/strings/internal/cordz_update_scope.h"
#include "absl/strings/internal/cordz_update_tracker.h"
#include "absl/synchronization/internal/thread_pool.h"
#include "absl/synchronization/notification.h"

namespace absl {
ABSL_NAMESPACE_BEGIN
namespace cord_internal {

// Do not print statistics contents, the matcher prints them as needed.
inline void PrintTo(const CordzStatistics& stats, std::ostream* s) {}

namespace {

Ge;

// Creates a flat of the specified allocated size
CordRepFlat* Flat(size_t size) {}

// Creates an external of the specified length
CordRepExternal* External(size_t length = 512) {}

// Creates a substring on the provided rep of length - 1
CordRepSubstring* Substring(CordRep* rep) {}

// Reference count helper
struct RefHelper {};

// Sizeof helper. Returns the allocated size of `p`, excluding any child
// elements for substring, concat and ring cord reps.
template <typename T>
size_t SizeOf(const T* rep) {}

template <>
size_t SizeOf(const CordRepFlat* rep) {}

template <>
size_t SizeOf(const CordRepExternal* rep) {}

// Computes fair share memory used in a naive 'we dare to recurse' way.
double FairShareImpl(CordRep* rep, size_t ref) {}

// Returns the fair share memory size from `ShareFhareImpl()` as a size_t.
size_t FairShare(CordRep* rep, size_t ref = 1) {}

// Samples the cord and returns CordzInfo::GetStatistics()
CordzStatistics SampleCord(CordRep* rep) {}

MATCHER_P(EqStatistics, stats, "Statistics equal expected values") {}

TEST(CordzInfoStatisticsTest, Flat) {}

TEST(CordzInfoStatisticsTest, SharedFlat) {}

TEST(CordzInfoStatisticsTest, External) {}

TEST(CordzInfoStatisticsTest, SharedExternal) {}

TEST(CordzInfoStatisticsTest, Substring) {}

TEST(CordzInfoStatisticsTest, SharedSubstring) {}

TEST(CordzInfoStatisticsTest, BtreeLeaf) {}

TEST(CordzInfoStatisticsTest, BtreeNodeShared) {}

TEST(CordzInfoStatisticsTest, Crc) {}

TEST(CordzInfoStatisticsTest, EmptyCrc) {}

TEST(CordzInfoStatisticsTest, ThreadSafety) {}

}  // namespace
}  // namespace cord_internal
ABSL_NAMESPACE_END
}  // namespace absl