forked from leanprover/lean4
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: improvements to test_extern command (leanprover#3075)
Two improvements [suggested](leanprover#2970 (comment)) by @digama0 after the initial PR was merged. * Allow testing `implemented_by` attributes as well. * Use `DecidableEq` rather than `BEq` for stricter testing.
- Loading branch information
Showing
4 changed files
with
18 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,15 @@ | ||
import Lean.Util.TestExtern | ||
|
||
instance : BEq ByteArray where | ||
beq x y := x.data == y.data | ||
deriving instance DecidableEq for ByteArray | ||
|
||
test_extern Nat.add 12 37 | ||
test_extern 4 + 5 | ||
|
||
test_extern ByteArray.copySlice ⟨#[1,2,3]⟩ 1 ⟨#[4, 5, 6, 7, 8, 9, 10, 11, 12, 13]⟩ 0 6 | ||
|
||
def f := 3 | ||
|
||
@[implemented_by f] | ||
def g := 4 | ||
|
||
test_extern g |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
test_extern.lean:7:0-7:17: error: test_extern: HAdd.hAdd does not have an @[extern] attribute | ||
test_extern.lean:6:0-6:17: error: test_extern: HAdd.hAdd does not have an @[extern] attribute or @[implemented_by] attribute | ||
test_extern.lean:15:0-15:13: error: native implementation did not agree with reference implementation! | ||
Compare the outputs of: #eval g and #eval 4 |