10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-12-26 22:33:57 +01:00
quantum_package/ocaml/tests/test_progress_bar.ml

39 lines
729 B
OCaml
Raw Normal View History

2018-10-19 11:32:58 +02:00
open Core
let test1 () =
let bar =
Progress_bar.init ~title:"Title" ~start_value:2. ~end_value:23. ~bar_length:30
in
let rec loop bar = function
| i when i = 24 -> ()
| i ->
let x =
Float.of_int i
in
let bar =
Progress_bar.update ~cur_value:x bar
|> Progress_bar.display
in
Unix.sleep 1 ;
loop bar (i+1)
in
loop bar 2
let test2 () =
let bar =
Progress_bar.init ~title:"Title" ~start_value:2. ~end_value:23. ~bar_length:30
in
let rec loop bar = function
| i when i = 24 -> ()
| i ->
let bar =
Progress_bar.increment bar
|> Progress_bar.display
in
Unix.sleep 1 ;
loop bar (i+1)
in
loop bar 2
let () = test2 ()