#include "absl/synchronization/internal/graphcycles.h"
#include <climits>
#include <map>
#include <random>
#include <unordered_set>
#include <utility>
#include <vector>
#include "gtest/gtest.h"
#include "absl/base/macros.h"
#include "absl/log/check.h"
#include "absl/log/log.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace synchronization_internal {
Nodes;
struct Edge { … };
Edges;
RandomEngine;
IdMap;
static GraphId Get(const IdMap& id, int num) { … }
static bool IsReachable(Edges *edges, int from, int to,
std::unordered_set<int> *seen) { … }
static void PrintEdges(Edges *edges) { … }
static void PrintGCEdges(Nodes *nodes, const IdMap &id, GraphCycles *gc) { … }
static void PrintTransitiveClosure(Nodes *nodes, Edges *edges) { … }
static void PrintGCTransitiveClosure(Nodes *nodes, const IdMap &id,
GraphCycles *gc) { … }
static void CheckTransitiveClosure(Nodes *nodes, Edges *edges, const IdMap &id,
GraphCycles *gc) { … }
static void CheckEdges(Nodes *nodes, Edges *edges, const IdMap &id,
GraphCycles *gc) { … }
static void CheckInvariants(const GraphCycles &gc) { … }
static int RandomNode(RandomEngine* rng, Nodes *nodes) { … }
static int RandomEdge(RandomEngine* rng, Edges *edges) { … }
static int EdgeIndex(Edges *edges, int from, int to) { … }
TEST(GraphCycles, RandomizedTest) { … }
class GraphCyclesTest : public ::testing::Test { … };
TEST_F(GraphCyclesTest, NoCycle) { … }
TEST_F(GraphCyclesTest, SimpleCycle) { … }
TEST_F(GraphCyclesTest, IndirectCycle) { … }
TEST_F(GraphCyclesTest, LongPath) { … }
TEST_F(GraphCyclesTest, RemoveNode) { … }
TEST_F(GraphCyclesTest, ManyEdges) { … }
TEST(GraphCycles, IntegerOverflow) { … }
}
ABSL_NAMESPACE_END
}