File: test_base_stack.ml

package info (click to toggle)
janest-base 0.17.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,632 kB
  • sloc: ml: 48,653; ansic: 281; javascript: 126; makefile: 14
file content (22 lines) | stat: -rw-r--r-- 593 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
open! Import
open Stack
include Test_container.Test_S1 (Stack)
include Test_stack.Test (Test_stack.Debug (Stack))

let capacity = capacity
let set_capacity = set_capacity

let%test_unit _ =
  let t = create () in
  [%test_result: int] (capacity t) ~expect:0;
  set_capacity t (-1);
  [%test_result: int] (capacity t) ~expect:0;
  set_capacity t 10;
  [%test_result: int] (capacity t) ~expect:10;
  set_capacity t 0;
  [%test_result: int] (capacity t) ~expect:0;
  push t ();
  set_capacity t 0;
  [%test_result: int] (length t) ~expect:1;
  [%test_pred: int] (fun c -> c >= 1) (capacity t)
;;