diff options
| author | Alasdair Armstrong | 2019-04-30 19:35:43 +0100 |
|---|---|---|
| committer | Alasdair Armstrong | 2019-04-30 19:41:14 +0100 |
| commit | 58d46e240315abb684823812ff1b2a9684653e5d (patch) | |
| tree | 5291f11c6dfd6b960788437df5e671981da21360 /test | |
| parent | 00d7ee1d3ef2a7cf6835c101aba922749f657963 (diff) | |
SMT: Allow custom queries
As an example:
$counterexample :query exist match_failure
function prop(xs: bits(4)) -> unit = {
match xs {
_ : bits(3) @ 0b0 => ()
}
}
Will return
Solver found counterexample: ok
xs -> 0x1
as we are asking for an input such that a match failure occurs,
meanwhile
$counterexample :query ~(exist match_failure)
function prop(xs: bits(4)) -> unit = {
match xs {
_ : bits(3) @ 0b0 => ()
}
}
will return 0x0 as we are asking for an input such that no match
failure occurs. Note that we can now support properties for
non-boolean functions by not including the return event in the query.
Diffstat (limited to 'test')
| -rw-r--r-- | test/smt/match_fail_query_1.sat.sail | 10 | ||||
| -rw-r--r-- | test/smt/match_fail_query_2.sat.sail | 10 |
2 files changed, 20 insertions, 0 deletions
diff --git a/test/smt/match_fail_query_1.sat.sail b/test/smt/match_fail_query_1.sat.sail new file mode 100644 index 00000000..15036ad9 --- /dev/null +++ b/test/smt/match_fail_query_1.sat.sail @@ -0,0 +1,10 @@ +default Order dec + +$include <prelude.sail> + +$counterexample :query ~(exist match_failure) +function prop(xs: bits(4)) -> unit = { + match xs { + _ : bits(3) @ 0b0 => () + } +} diff --git a/test/smt/match_fail_query_2.sat.sail b/test/smt/match_fail_query_2.sat.sail new file mode 100644 index 00000000..8c83f84f --- /dev/null +++ b/test/smt/match_fail_query_2.sat.sail @@ -0,0 +1,10 @@ +default Order dec + +$include <prelude.sail> + +$counterexample :query exist match_failure +function prop(xs: bits(4)) -> unit = { + match xs { + _ : bits(3) @ 0b0 => () + } +} |
