[pypy-commit] pypy default: Test depth_first_search
arigo
pypy.commits at gmail.com
Thu Nov 17 10:20:20 EST 2016
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r88443:198fd97491aa
Date: 2016-11-17 16:00 +0100
http://bitbucket.org/pypy/pypy/changeset/198fd97491aa/
Log: Test depth_first_search
diff --git a/rpython/tool/algo/test/test_graphlib.py b/rpython/tool/algo/test/test_graphlib.py
--- a/rpython/tool/algo/test/test_graphlib.py
+++ b/rpython/tool/algo/test/test_graphlib.py
@@ -20,6 +20,22 @@
'G': [],
}
+ def test_depth_first_search(self):
+ # 'D' missing from the list of vertices
+ lst = depth_first_search('A', list('ABCEFG'), self.edges)
+ assert lst == [
+ ('start', 'A'),
+ ('start', 'B'),
+ ('start', 'E'),
+ ('start', 'C'),
+ ('start', 'F'),
+ ('stop', 'F'),
+ ('stop', 'C'),
+ ('stop', 'E'),
+ ('stop', 'B'),
+ ('stop', 'A'),
+ ]
+
def test_strong_components(self):
edges = self.edges
saved = copy_edges(edges)
More information about the pypy-commit
mailing list