summaryrefslogtreecommitdiff
path: root/tests/modules/graph/test.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2025-03-22 00:43:40 +0800
committerruki <[email protected]>2025-04-08 15:31:55 +0800
commit4a8219cda19cf320330ab7488f53158624c8c393 (patch)
tree7348edfb0b0ea27e3b22dfff89df00f8f8a6798d /tests/modules/graph/test.lua
parent63ed1854ea964fbbe7bc9dbdd8e2c34068dff7de (diff)
update comments
Diffstat (limited to 'tests/modules/graph/test.lua')
-rw-r--r--tests/modules/graph/test.lua10
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/modules/graph/test.lua b/tests/modules/graph/test.lua
index 1fb0bcb43..c242962db 100644
--- a/tests/modules/graph/test.lua
+++ b/tests/modules/graph/test.lua
@@ -46,12 +46,14 @@ function test_paritail_topo_sort(t)
local order_vertices = {}
while true do
node, has_cycle = dag:partial_topo_sort_next()
- if node == nil or has_cycle then
- break
- end
- table.insert(order_vertices, node)
if node then
+ table.insert(order_vertices, node)
dag:partial_topo_sort_remove(node)
+ else
+ if has_cycle then
+ raise("has cycle!")
+ end
+ break
end
end