summaryrefslogtreecommitdiff
path: root/tests/modules/graph/test.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tests/modules/graph/test.lua')
-rw-r--r--tests/modules/graph/test.lua11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/modules/graph/test.lua b/tests/modules/graph/test.lua
index 7f0a253f2..cc0e16738 100644
--- a/tests/modules/graph/test.lua
+++ b/tests/modules/graph/test.lua
@@ -23,9 +23,18 @@ function test_topological_sort(t)
for i, v in ipairs(order_path) do
orders[v] = i
end
-
for _, e in ipairs(edges) do
t:require(orders[e[1]] < orders[e[2]])
end
+
+ dag = dag:reverse()
+ order_path = dag:topological_sort()
+ orders = {}
+ for i, v in ipairs(order_path) do
+ orders[v] = i
+ end
+ for _, e in ipairs(edges) do
+ t:require(orders[e[1]] > orders[e[2]])
+ end
end