lean4-htt/tests/elab/307.lean
Garmelon 08eb78a5b2
chore: switch to new test/bench suite (#12590)
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.
2026-02-25 13:51:53 +00:00

67 lines
1.5 KiB
Text

def INT32_MIN : Int := -0x80000000
#reduce INT32_MIN / -1
#eval INT32_MIN / -1
#eval INT32_MIN / -2
#eval INT32_MIN / 1
#reduce INT32_MIN % -1
#eval INT32_MIN % -1
#reduce (Int.emod (-2 : Int) 0)
#eval (Int.emod (-2 : Int) 0)
#reduce -(Int.emod (-2 : Int) 0)
#eval -(Int.emod (-2 : Int) 0)
@[noinline] def oneU8 : UInt8 := 1
#reduce (UInt8.mod oneU8 0).toFin.val
#eval (UInt8.mod oneU8 0)
#reduce (UInt8.mod oneU8 0).toFin.val
#eval (UInt8.mod oneU8 0)
@[noinline] def int_div x y := Int.ediv x y
@[noinline] def int_mod x y := Int.emod x y
@[noinline] def uint8_mod x y := UInt8.mod x y
@[noinline] def oneU16 : UInt16 := 1
#reduce (UInt16.mod oneU16 0).toFin.val
#eval (UInt16.mod oneU16 0)
@[noinline] def uint16_mod x y := UInt16.mod x y
@[noinline] def oneU32 : UInt32 := 1
#reduce (UInt32.mod oneU32 0).toFin.val
#eval (UInt32.mod oneU32 0)
@[noinline] def uint32_mod x y := UInt32.mod x y
@[noinline] def oneU64 : UInt64 := 1
#reduce (UInt64.mod oneU64 0).toFin.val
#eval (UInt64.mod oneU64 0)
@[noinline] def uint64_mod x y := UInt64.mod x y
@[noinline] def oneUSize : USize := 1
#eval (USize.mod oneUSize 0)
@[noinline] def usize_mod x y := USize.mod x y
def main : IO Unit := do
IO.println <| int_div INT32_MIN (-1)
IO.println <| int_div (-2) 0
IO.println <| int_mod INT32_MIN (-1)
IO.println <| int_mod (-2) 0
IO.println <| uint8_mod 1 0
IO.println <| uint16_mod 1 0
IO.println <| uint32_mod 1 0
IO.println <| uint64_mod 1 0
IO.println <| usize_mod 1 0
#eval main