From 42cbd23e8ca7ea287d7a45d80fb934b64769ca19 Mon Sep 17 00:00:00 2001
From: Matt Wala <wala1@illinois.edu>
Date: Wed, 21 Dec 2016 15:23:49 -0600
Subject: [PATCH] Make the SCC unit test stricter.

---
 test/test_misc.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/test/test_misc.py b/test/test_misc.py
index 384c1326b..13f1112a4 100644
--- a/test/test_misc.py
+++ b/test/test_misc.py
@@ -60,8 +60,15 @@ def test_compute_sccs():
                 return result + [node]
 
         for scc in sccs:
-            result = visit(scc[0])
-            assert set(result) == set(scc), (set(result), set(scc))
+            scc = set(scc)
+            assert not scc & visited
+            # Check that starting from each element of the SCC results
+            # in the same set of reachable nodes.
+            for scc_root in scc:
+                visited.difference_update(scc)
+                result = visit(scc_root)
+                assert set(result) == scc, (set(result), scc)
+
 
     for nnodes in range(10, 20):
         for i in range(40):
-- 
GitLab