Skip to content

Commit

Permalink
Add some tests.
Browse files Browse the repository at this point in the history
Fixes ocaml-gospel#171
Non compiling code is not generated anymore, but the user doesn't know
why `next_state` was not generated.
  • Loading branch information
n-osborne committed Nov 7, 2023
1 parent 9393a01 commit 22e0fd1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions plugins/qcheck-stm/test/sequence_model.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,10 @@ type 'a t = 'a list ref

let create () = ref []
let add x s = s := x :: !s

let pop q =
match !q with
| [] -> None
| x :: xs ->
q := xs;
Some x
7 changes: 7 additions & 0 deletions plugins/qcheck-stm/test/sequence_model.mli
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,10 @@ val add : 'a -> 'a t -> unit
(*@ add v t
modifies t.contents
ensures t.contents = Sequence.cons v (old t.contents) *)

val pop : 'a t -> 'a option
(*@ o = pop q
modifies q.contents
ensures q.contents = match o with
| None -> old q.contents
| Some _ -> Sequence.tl (old q.contents) *)

0 comments on commit 22e0fd1

Please sign in to comment.