Skip to content

Commit

Permalink
Add test for returned tuple
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolaushuber committed Jun 18, 2024
1 parent 1674f3c commit d4c8ee3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions plugins/qcheck-stm/test/tuples.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ include Hashtbl
let create () = create ~random:false 10
let add t (a, b) = add t a b
let add' t (c, a, b) = if c then add t (a, b) else ()
let size_tup t = (length t, length t)
5 changes: 5 additions & 0 deletions plugins/qcheck-stm/test/tuples.mli
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,8 @@ val add' : ('a, 'b) t -> bool * 'a * 'b -> unit
ensures h.contents = match tup with c, a, b ->
if c then (a, b) :: old h.contents
else old h.contents *)

val size_tup : ('a, 'b) t -> int * int
(*@ x, y = size_tup t
ensures x = List.length t.contents
ensures y = List.length t.contents *)
4 changes: 4 additions & 0 deletions plugins/qcheck-stm/test/tuples_errors.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
File "tuples.mli", line 25, characters 29-38:
25 | val size_tup : ('a, 'b) t -> int * int
^^^^^^^^^
Warning: Skipping size_tup: functions returning tuples are not supported yet.

0 comments on commit d4c8ee3

Please sign in to comment.