mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-05 19:00:31 -05:00
test: sanity test for flat_map
This commit is contained in:
parent
8b53966dff
commit
7436727942
1 changed files with 15 additions and 0 deletions
|
|
@ -124,6 +124,21 @@ eq
|
|||
fold_flat_map (fun acc x -> acc + x, [ pf "%d" x; pf "a%d" x ]) 0 [ 1; 2; 3 ])
|
||||
;;
|
||||
|
||||
t @@ fun () ->
|
||||
let r = Atomic.make 0 in
|
||||
let f x =
|
||||
let n = Atomic.fetch_and_add r 1 in
|
||||
[ n, x ]
|
||||
in
|
||||
|
||||
let l = CCList.flat_map f [ "a"; "b"; "c" ] in
|
||||
assert_equal
|
||||
~printer:Q.Print.(list @@ pair int string)
|
||||
[ 0, "a"; 1, "b"; 2, "c" ]
|
||||
l;
|
||||
true
|
||||
;;
|
||||
|
||||
q
|
||||
Q.(list int)
|
||||
(fun l ->
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue