You've already forked linux-packaging-mono
acceptance-tests
data
debian
docs
external
Newtonsoft.Json
api-doc-tools
api-snapshot
aspnetwebstack
binary-reference-assemblies
bockbuild
boringssl
cecil
cecil-legacy
corefx
corert
helix-binaries
ikdasm
ikvm
illinker-test-assets
linker
llvm
bindings
cmake
docs
examples
include
lib
projects
resources
runtimes
scripts
test
tools
unittests
ADT
APFloatTest.cpp.REMOVED.git-id
APIntTest.cpp
APSIntTest.cpp
ArrayRefTest.cpp
BitVectorTest.cpp
BitmaskEnumTest.cpp
BreadthFirstIteratorTest.cpp
BumpPtrListTest.cpp
CMakeLists.txt
DAGDeltaAlgorithmTest.cpp
DeltaAlgorithmTest.cpp
DenseMapTest.cpp
DenseSetTest.cpp
DepthFirstIteratorTest.cpp
EquivalenceClassesTest.cpp
FoldingSet.cpp
FunctionRefTest.cpp
HashingTest.cpp
IListBaseTest.cpp
IListIteratorTest.cpp
IListNodeBaseTest.cpp
IListNodeTest.cpp
IListSentinelTest.cpp
IListTest.cpp
ImmutableMapTest.cpp
ImmutableSetTest.cpp
IntEqClassesTest.cpp
IntervalMapTest.cpp
IntrusiveRefCntPtrTest.cpp
IteratorTest.cpp
MakeUniqueTest.cpp
MapVectorTest.cpp
MappedIteratorTest.cpp
OptionalTest.cpp
PackedVectorTest.cpp
PointerEmbeddedIntTest.cpp
PointerIntPairTest.cpp
PointerSumTypeTest.cpp
PointerUnionTest.cpp
PostOrderIteratorTest.cpp
PriorityWorklistTest.cpp
RangeAdapterTest.cpp
SCCIteratorTest.cpp
STLExtrasTest.cpp
ScopeExitTest.cpp
SequenceTest.cpp
SetVectorTest.cpp
SimpleIListTest.cpp
SmallPtrSetTest.cpp
SmallStringTest.cpp
SmallVectorTest.cpp
SparseBitVectorTest.cpp
SparseMultiSetTest.cpp
SparseSetTest.cpp
StringExtrasTest.cpp
StringMapTest.cpp
StringRefTest.cpp
StringSwitchTest.cpp
TestGraph.h
TinyPtrVectorTest.cpp
TripleTest.cpp
TwineTest.cpp
VariadicFunctionTest.cpp
Analysis
AsmParser
BinaryFormat
Bitcode
CodeGen
DebugInfo
ExecutionEngine
FuzzMutate
IR
LineEditor
Linker
MC
MI
Object
ObjectYAML
Option
ProfileData
Support
Target
Transforms
XRay
tools
CMakeLists.txt
utils
.arcconfig
.clang-format
.clang-tidy
.gitattributes
.gitignore
CMakeLists.txt
CODE_OWNERS.TXT
CREDITS.TXT
LICENSE.TXT
LLVMBuild.txt
README.txt
RELEASE_TESTERS.TXT
configure
llvm.spec.in
nuget-buildtasks
nunit-lite
roslyn-binaries
rx
xunit-binaries
how-to-bump-roslyn-binaries.md
ikvm-native
libgc
llvm
m4
man
mcs
mk
mono
msvc
po
runtime
samples
scripts
support
tools
COPYING.LIB
LICENSE
Makefile.am
Makefile.in
NEWS
README.md
acinclude.m4
aclocal.m4
autogen.sh
code_of_conduct.md
compile
config.guess
config.h.in
config.rpath
config.sub
configure.REMOVED.git-id
configure.ac.REMOVED.git-id
depcomp
install-sh
ltmain.sh.REMOVED.git-id
missing
mkinstalldirs
mono-uninstalled.pc.in
test-driver
winconfig.h
75 lines
1.6 KiB
C++
75 lines
1.6 KiB
C++
![]() |
//=== llvm/unittest/ADT/BreadthFirstIteratorTest.cpp - BFS iterator tests -===//
|
||
|
//
|
||
|
// The LLVM Compiler Infrastructure
|
||
|
//
|
||
|
// This file is distributed under the University of Illinois Open Source
|
||
|
// License. See LICENSE.TXT for details.
|
||
|
//
|
||
|
//===----------------------------------------------------------------------===//
|
||
|
|
||
|
#include "llvm/ADT/BreadthFirstIterator.h"
|
||
|
#include "TestGraph.h"
|
||
|
#include "gtest/gtest.h"
|
||
|
|
||
|
using namespace llvm;
|
||
|
|
||
|
namespace llvm {
|
||
|
|
||
|
TEST(BreadthFristIteratorTest, Basic) {
|
||
|
typedef bf_iterator<Graph<4>> BFIter;
|
||
|
|
||
|
Graph<4> G;
|
||
|
G.AddEdge(0, 1);
|
||
|
G.AddEdge(0, 2);
|
||
|
G.AddEdge(1, 3);
|
||
|
|
||
|
auto It = BFIter::begin(G);
|
||
|
auto End = BFIter::end(G);
|
||
|
EXPECT_EQ(It.getLevel(), 0U);
|
||
|
EXPECT_EQ(*It, G.AccessNode(0));
|
||
|
++It;
|
||
|
EXPECT_EQ(It.getLevel(), 1U);
|
||
|
EXPECT_EQ(*It, G.AccessNode(1));
|
||
|
++It;
|
||
|
EXPECT_EQ(It.getLevel(), 1U);
|
||
|
EXPECT_EQ(*It, G.AccessNode(2));
|
||
|
++It;
|
||
|
EXPECT_EQ(It.getLevel(), 2U);
|
||
|
EXPECT_EQ(*It, G.AccessNode(3));
|
||
|
++It;
|
||
|
EXPECT_EQ(It, End);
|
||
|
}
|
||
|
|
||
|
TEST(BreadthFristIteratorTest, Cycle) {
|
||
|
typedef bf_iterator<Graph<4>> BFIter;
|
||
|
|
||
|
Graph<4> G;
|
||
|
G.AddEdge(0, 1);
|
||
|
G.AddEdge(1, 0);
|
||
|
G.AddEdge(1, 2);
|
||
|
G.AddEdge(2, 1);
|
||
|
G.AddEdge(2, 1);
|
||
|
G.AddEdge(2, 3);
|
||
|
G.AddEdge(3, 2);
|
||
|
G.AddEdge(3, 1);
|
||
|
G.AddEdge(3, 0);
|
||
|
|
||
|
auto It = BFIter::begin(G);
|
||
|
auto End = BFIter::end(G);
|
||
|
EXPECT_EQ(It.getLevel(), 0U);
|
||
|
EXPECT_EQ(*It, G.AccessNode(0));
|
||
|
++It;
|
||
|
EXPECT_EQ(It.getLevel(), 1U);
|
||
|
EXPECT_EQ(*It, G.AccessNode(1));
|
||
|
++It;
|
||
|
EXPECT_EQ(It.getLevel(), 2U);
|
||
|
EXPECT_EQ(*It, G.AccessNode(2));
|
||
|
++It;
|
||
|
EXPECT_EQ(It.getLevel(), 3U);
|
||
|
EXPECT_EQ(*It, G.AccessNode(3));
|
||
|
++It;
|
||
|
EXPECT_EQ(It, End);
|
||
|
}
|
||
|
|
||
|
} // end namespace llvm
|