diff options
| author | ruki <[email protected]> | 2023-09-29 00:58:23 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-09-29 00:58:23 +0800 |
| commit | 270341b90e881c36467f2e03a01909e2d509331f (patch) | |
| tree | e98e67b63dd964071c1ce945f61ee56304bdd217 /tests/modules/graph/test.lua | |
| parent | 1ad7b371e69832be96345d91fb73cd21209803cf (diff) | |
improve test
Diffstat (limited to 'tests/modules/graph/test.lua')
| -rw-r--r-- | tests/modules/graph/test.lua | 11 |
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 |
