This PR sets up the new integrated test/bench suite. It then migrates all benchmarks and some related tests to the new suite. There's also some documentation and some linting. For now, a lot of the old tests are left alone so this PR doesn't become even larger than it already is. Eventually, all tests should be migrated to the new suite though so there isn't a confusing mix of two systems.
40 lines
945 B
Text
40 lines
945 B
Text
import Lean.Util.SCC
|
|
|
|
open Lean.SCC
|
|
|
|
def checkSCC (expected : List (List Nat)) (vertices : List Nat) (successorsOf : Nat → List Nat) : IO Unit := do
|
|
let r := scc vertices successorsOf
|
|
IO.println r
|
|
unless expected == r do
|
|
throw $ IO.userError ("expected result " ++ toString expected)
|
|
|
|
/-- info: [[2], [1, 3], [4]] -/
|
|
#guard_msgs in
|
|
#eval checkSCC [[2], [1, 3], [4]] [1, 2, 3, 4] fun x => match x with
|
|
| 1 => [2, 3]
|
|
| 3 => [1]
|
|
| 4 => [1, 2]
|
|
| _ => []
|
|
|
|
/-- info: [[1], [2], [3], [4]] -/
|
|
#guard_msgs in
|
|
#eval checkSCC [[1], [2], [3], [4]] [1, 2, 3, 4] fun x => match x with
|
|
| _ => []
|
|
|
|
/-- info: [[1, 2, 3, 4]] -/
|
|
#guard_msgs in
|
|
#eval checkSCC [[1, 2, 3, 4]] [1, 2, 3, 4] fun x => match x with
|
|
| 1 => [2]
|
|
| 2 => [3]
|
|
| 3 => [4]
|
|
| 4 => [1]
|
|
| _ => []
|
|
|
|
/-- info: [[1, 2, 4], [3]] -/
|
|
#guard_msgs in
|
|
#eval checkSCC [[1, 2, 4], [3]] [1, 2, 3, 4] fun x => match x with
|
|
| 1 => [2]
|
|
| 2 => [4]
|
|
| 3 => [4]
|
|
| 4 => [1]
|
|
| _ => []
|