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.
32 lines
714 B
Text
32 lines
714 B
Text
import Init.System.IO
|
|
|
|
|
|
structure MyState :=
|
|
bs : Nat := 0 -- backtrackable state
|
|
ps : Nat := 0 -- non backtrackable state
|
|
|
|
instance : Repr MyState where
|
|
reprPrec s _ := repr (s.bs, s.ps)
|
|
|
|
instance : EStateM.Backtrackable Nat MyState :=
|
|
{ save := fun s => s.bs,
|
|
restore := fun s d => { s with bs := d } }
|
|
|
|
abbrev M := EStateM String MyState
|
|
|
|
def bInc : M Unit := -- increment backtrackble counter
|
|
modify $ fun s => { s with bs := s.bs + 1 }
|
|
|
|
def pInc : M Unit := -- increment nonbacktrackable counter
|
|
modify $ fun s => { s with ps := s.ps + 1 }
|
|
|
|
def tst : M MyState :=
|
|
do bInc;
|
|
pInc;
|
|
((bInc *> throw "failed") <|> pInc);
|
|
pInc;
|
|
get
|
|
|
|
/-- info: some (1, 3) -/
|
|
#guard_msgs in
|
|
#eval tst.run' {}
|