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.
57 lines
1.1 KiB
Text
57 lines
1.1 KiB
Text
mutual
|
|
inductive Foo
|
|
| somefoo : Foo
|
|
| bar : Bar → Foo
|
|
|
|
inductive Bar
|
|
| somebar : Bar
|
|
| foobar : Foo → Bar → Bar
|
|
end
|
|
|
|
mutual
|
|
private def Foo.toString : Foo → String
|
|
| Foo.somefoo => "foo"
|
|
| Foo.bar b => Bar.toString b
|
|
|
|
def _root_.Bar.toString : Bar → String
|
|
| Bar.somebar => "bar"
|
|
| Bar.foobar f b => Foo.toString f ++ Bar.toString b
|
|
end
|
|
|
|
namespace Ex2
|
|
mutual
|
|
inductive Foo
|
|
| somefoo : Foo
|
|
| bar : Bar → Foo → Foo
|
|
|
|
inductive Bar
|
|
| somebar : Bar
|
|
| foobar : Foo → Bar → Bar
|
|
end
|
|
|
|
mutual
|
|
private def Foo.toString : Foo → String
|
|
| Foo.somefoo => go 2 ++ toString.go 2 ++ Foo.toString.go 2
|
|
| Foo.bar b f => Foo.toString f ++ Bar.toString b
|
|
where
|
|
go (x : Nat) := s!"foo {x}"
|
|
|
|
private def _root_.Ex2.Bar.toString : Bar → String
|
|
| Bar.somebar => "bar"
|
|
| Bar.foobar f b => Foo.toString f ++ Bar.toString b
|
|
end
|
|
end Ex2
|
|
|
|
def Nat.fact : Nat → Nat
|
|
| 0 => 1
|
|
| n+1 => (n+1) * Nat.fact n
|
|
|
|
example : Nat.fact 3 = 6 := rfl
|
|
|
|
namespace Boo
|
|
def fact : Nat → Nat
|
|
| 0 => 2
|
|
| n+1 => (n+1) * Boo.fact n
|
|
|
|
example : Boo.fact 3 = 12 := rfl
|
|
end Boo
|