Many of our tests in `tests/lean/run/` produce output from `#eval` (or `#check`) statements, that is then ignored. This PR tries to capture all the useful output using `#guard_msgs`. I've only done a cursory check that the output is still sane --- there is a chance that some "unchecked" tests have already accumulated regressions and this just cements them! In the other direction, I did identify two rotten tests: * a minor one in `setStructInstNotation.lean`, where a comment says `Set Nat`, but `#check` actually prints `?_`. Weird? * `CompilerProbe.lean` is generating empty output, apparently indicating that something is broken, but I don't know the signficance of this file. In any case, I'll ask about these elsewhere. (This started by noticing that a recent `grind` test file had an untested `trace_state`, and then got carried away.)
55 lines
1.1 KiB
Text
55 lines
1.1 KiB
Text
import Lean
|
|
|
|
open Lean
|
|
|
|
def checkDefEq (a b : Name) : CoreM Unit := do
|
|
let env ← getEnv
|
|
let a := mkConst a
|
|
let b := mkConst b
|
|
let r ← ofExceptKernelException (Kernel.isDefEq env {} a b)
|
|
IO.println (toString a ++ " =?= " ++ toString b ++ " := " ++ toString r)
|
|
|
|
|
|
def a1 := 100 + 100
|
|
def a2 := 200
|
|
def a3 := 20
|
|
|
|
/-- info: a1 =?= a2 := true -/
|
|
#guard_msgs in
|
|
#eval checkDefEq `a1 `a2
|
|
|
|
/-- info: a1 =?= a3 := false -/
|
|
#guard_msgs in
|
|
#eval checkDefEq `a1 `a3
|
|
|
|
def v1 := 100000000000 + 100000000000
|
|
def v2 := 200000000000
|
|
def v3 := 200000000001
|
|
def v4 : Bool := 20000000000 > 200000000001
|
|
def v5 := 100000000000 - 100000000000
|
|
|
|
def c1 := reduceNat v1
|
|
def c2 := reduceNat v2
|
|
def c3 := reduceNat v3
|
|
def c4 := reduceBool v4
|
|
def c5 := reduceNat v5
|
|
|
|
/-- info: c1 =?= c2 := true -/
|
|
#guard_msgs in
|
|
#eval checkDefEq `c1 `c2
|
|
|
|
/-- info: c1 =?= c3 := false -/
|
|
#guard_msgs in
|
|
#eval checkDefEq `c1 `c3
|
|
|
|
/-- info: c5 =?= Nat.zero := true -/
|
|
#guard_msgs in
|
|
#eval checkDefEq `c5 `Nat.zero
|
|
|
|
/-- info: Nat.zero =?= c5 := true -/
|
|
#guard_msgs in
|
|
#eval checkDefEq `Nat.zero `c5
|
|
|
|
/-- info: c4 =?= Bool.true := false -/
|
|
#guard_msgs in
|
|
#eval checkDefEq `c4 `Bool.true
|