diff options
| author | ruki <[email protected]> | 2025-03-21 23:03:29 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-04-08 15:31:54 +0800 |
| commit | 741da62196bcb64c88e386f1a769462211c63b4e (patch) | |
| tree | c381546976a29ac9a642a18e241bc7de9874d7a3 /tests/modules/graph/test.lua | |
| parent | 7e949212c4aff661f6dfd6234af7fd021a8568e3 (diff) | |
add queue and improve graph
Diffstat (limited to 'tests/modules/graph/test.lua')
| -rw-r--r-- | tests/modules/graph/test.lua | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/modules/graph/test.lua b/tests/modules/graph/test.lua index 4bbefe069..33e1f3fa7 100644 --- a/tests/modules/graph/test.lua +++ b/tests/modules/graph/test.lua @@ -1,6 +1,6 @@ import("core.base.graph") -function test_topological_sort(t) +function test_topo_sort(t) local edges = { {0, 5}, {0, 2}, @@ -18,7 +18,7 @@ function test_topological_sort(t) for _, e in ipairs(edges) do dag:add_edge(e[1], e[2]) end - local order_path = dag:topological_sort() + local order_path = dag:topo_sort() local orders = {} for i, v in ipairs(order_path) do orders[v] = i @@ -28,7 +28,7 @@ function test_topological_sort(t) end dag = dag:reverse() - order_path = dag:topological_sort() + order_path = dag:topo_sort() orders = {} for i, v in ipairs(order_path) do orders[v] = i @@ -53,7 +53,7 @@ function test_find_cycle(t) local cycle = dag:find_cycle() t:are_equal(cycle, {1, 6, 0}) - local _, has_cycle = dag:topological_sort() + local _, has_cycle = dag:topo_sort() t:require(has_cycle) end |
