Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Stevendeo committed Nov 24, 2023
1 parent cdb90d9 commit 1a8d0ed
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
28 changes: 18 additions & 10 deletions tests/cram.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -43,44 +43,52 @@ combinations of produce-models et al.
First, if model generation is not enabled, we should error out when a
`(get-model)` statement is issued:

$ echo '(get-model)' | alt-ergo -i smtlib2 -o smtlib2 --continue-on-error
$ echo '(set-logic ALL)(check-sat)(get-model)' | alt-ergo -i smtlib2 -o smtlib2 --continue-on-error 2> /dev/null

unknown
(error "Model generation disabled (try --produce-models)")

This should be the case Tableaux solver as well:

$ echo '(get-model)' | alt-ergo --sat-solver Tableaux -i smtlib2 -o smtlib2 --continue-on-error
$ echo '(set-logic ALL)(check-sat)(get-model)' | alt-ergo --sat-solver Tableaux -i smtlib2 -o smtlib2 --continue-on-error 2> /dev/null

unknown
(error "Model generation disabled (try --produce-models)")

The messages above mention `--produce-models`, but we can also use
`set-option`.

$ echo '(get-model)' | alt-ergo --produce-models -i smtlib2 -o smtlib2 --continue-on-error
(error "No model produced.")
$ echo '(set-option :produce-models false)(set-logic ALL)(check-sat)(get-model)' | alt-ergo --produce-models -i smtlib2 -o smtlib2 --continue-on-error 2> /dev/null

unknown
(error "Model generation disabled (try --produce-models)")

$ echo '(set-option :produce-models true)(get-model)' | alt-ergo --sat-solver Tableaux -i smtlib2 -o smtlib2 --continue-on-error
(error "No model produced.")
$ echo '(set-option :produce-models false)(set-logic ALL)(check-sat)(get-model)' | alt-ergo --sat-solver Tableaux -i smtlib2 -o smtlib2 --continue-on-error 2> /dev/null

unknown
(error "Model generation disabled (try --produce-models)")

And now some cases where it should work (using either `--produce-models` or `set-option`):

$ echo '(check-sat)(get-model)' | alt-ergo --produce-models -i smtlib2 -o smtlib2 2>/dev/null
$ echo '(set-logic ALL)(check-sat)(get-model)' | alt-ergo --produce-models -i smtlib2 -o smtlib2 2>/dev/null

unknown
(
)

$ echo '(set-option :produce-models true)(check-sat)(get-model)' | alt-ergo -i smtlib2 -o smtlib2 2>/dev/null
$ echo '(set-option :produce-models true)(set-logic ALL)(check-sat)(get-model)' | alt-ergo -i smtlib2 -o smtlib2 2>/dev/null

unknown
(
)
$ echo '(set-option :produce-models true)(check-sat)(get-model)' | alt-ergo --sat-solver Tableaux -i smtlib2 -o smtlib2 2>/dev/null
$ echo '(set-option :produce-models true)(set-logic ALL)(check-sat)(get-model)' | alt-ergo --sat-solver Tableaux -i smtlib2 -o smtlib2 2>/dev/null

unknown
(
)

We now test the --continue-on-error strategy where alt-ergo fails (legitimately) on some commands but keeps running.
$ echo '(get-info :foo) (set-option :bar) (check-sat)' | alt-ergo -i smtlib2 -o smtlib2 --continue-on-error 2>/dev/null
$ echo '(get-info :foo) (set-option :bar) (set-logic ALL) (check-sat)' | alt-ergo -i smtlib2 -o smtlib2 --continue-on-error 2>/dev/null
unsupported

(error "Invalid set-option")
Expand Down
2 changes: 1 addition & 1 deletion tests/smtlib/testfile-get-assignment3.dolmen.smt2
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(set-logic ALL)
(set-option :produce-assignments true)
(set-logic ALL)
(declare-const x Int)
(assert (! (= x 0) :named foo))
(check-sat)
Expand Down

0 comments on commit 1a8d0ed

Please sign in to comment.