package alcotest

  1. Overview
  2. Docs
Logo](https://raw.githubusercontent.com/mirage/alcotest/master/alcotest-logo.png)

Install

Dune Dependency

Authors

Maintainers

Sources

alcotest-0.8.1.tbz
sha256=e9bcb4fd9462b94430a850ca65bab0350354f88ad068dfee9172f72f0ae0f46e
md5=8b8d9f8c9e8c0b34c12e20e24db8dec3

Description

Alcotest is a lightweight and colourful test framework.

Alcotest exposes simple interface to perform unit tests. It exposes a simple TESTABLE module type, a check function to assert test predicates and a run function to perform a list of unit -> unit test callbacks.

Alcotest provides a quiet and colorful output where only faulty runs are fully displayed at the end of the run (with the full logs ready to inspect), with a simple (yet expressive) query language to select the tests to run.

Build Status docs

Examples

A simple example:

(* Build with `ocamlbuild -pkg alcotest simple.byte` *)

(* A module with functions to test *)
module To_test = struct
  let capit letter = Char.uppercase letter
  let plus int_list = List.fold_left (fun a b -> a + b) 0 int_list
end

(* The tests *)
let capit () =
  Alcotest.(check char) "same chars"  'A' (To_test.capit 'a')

let plus () =
  Alcotest.(check int) "same ints" 7 (To_test.plus [1;1;2;3])

let test_set = [
  "Capitalize" , `Quick, capit;
  "Add entries", `Slow , plus ;
]

(* Run it *)
let () =
  Alcotest.run "My first test" [
    "test_set", test_set;
  ]

The result is a self-contained binary which displays the test results. Use ./simple.byte --help to see the runtime options.

$ ./simple.native
[OK]        test_set  0   Capitalize.
[OK]        test_set  1   Add entries.
Test Successful in 0.001s. 2 tests run.

See the examples folder for more examples.

Published: 03 Aug 2017

README

Alcotest is a lightweight and colourful test framework.

Alcotest exposes simple interface to perform unit tests. It exposes a simple TESTABLE module type, a check function to assert test predicates and a run function to perform a list of unit -> unit test callbacks.

Alcotest provides a quiet and colorful output where only faulty runs are fully displayed at the end of the run (with the full logs ready to inspect), with a simple (yet expressive) query language to select the tests to run.

Examples

A simple example:

(* Build with `ocamlbuild -pkg alcotest simple.byte` *)

(* A module with functions to test *)
module To_test = struct
  let capit letter = Char.uppercase letter
  let plus int_list = List.fold_left (fun a b -> a + b) 0 int_list
end

(* The tests *)
let capit () =
  Alcotest.(check char) "same chars"  'A' (To_test.capit 'a')

let plus () =
  Alcotest.(check int) "same ints" 7 (To_test.plus [1;1;2;3])

let test_set = [
  "Capitalize" , `Quick, capit;
  "Add entries", `Slow , plus ;
]

(* Run it *)
let () =
  Alcotest.run "My first test" [
    "test_set", test_set;
  ]

The result is a self-contained binary which displays the test results. Use ./simple.byte --help to see the runtime options.

$ ./simple.native
[OK]        test_set  0   Capitalize.
[OK]        test_set  1   Add entries.
Test Successful in 0.001s. 2 tests run.

See the examples folder for more examples.

Dependencies (6)

  1. cmdliner
  2. result < "1.5"
  3. astring
  4. fmt >= "0.8.0"
  5. jbuilder >= "1.0+beta10"
  6. ocaml >= "4.02.3"

Dev Dependencies

None

  1. ahrocksdb
  2. albatross >= "1.5.0"
  3. alcotest-async < "1.0.0"
  4. alcotest-lwt < "1.0.0"
  5. ambient-context
  6. ambient-context-eio
  7. ambient-context-lwt
  8. angstrom >= "0.7.0"
  9. ansi >= "0.6.0"
  10. anycache >= "0.7.4"
  11. anycache-async
  12. anycache-lwt
  13. archetype >= "1.4.2"
  14. archi
  15. arp
  16. arp-mirage
  17. arrakis
  18. art
  19. asak >= "0.2"
  20. asli >= "0.2.0"
  21. asn1-combinators >= "0.2.2"
  22. atd >= "2.3.3"
  23. atdgen >= "2.10.0"
  24. atdpy
  25. atdts
  26. base32
  27. base64 >= "2.1.2"
  28. bechamel >= "0.5.0"
  29. bigarray-overlap
  30. bigstring >= "0.3"
  31. bigstring-unix >= "0.3"
  32. bigstringaf
  33. bitlib
  34. blake2
  35. bloomf
  36. bls12-381 < "0.4.1" | >= "3.0.0" & < "18.0"
  37. bls12-381-hash
  38. bls12-381-js >= "0.4.2"
  39. bls12-381-js-gen >= "0.4.2"
  40. bls12-381-legacy
  41. bls12-381-signature
  42. bls12-381-unix
  43. blurhash
  44. builder-web
  45. bulletml
  46. bytebuffer
  47. ca-certs
  48. ca-certs-nss
  49. cactus
  50. calendar >= "3.0.0"
  51. callipyge
  52. camlix
  53. camlkit
  54. camlkit-base
  55. capnp-rpc < "0.6.0"
  56. capnp-rpc-lwt < "0.3"
  57. carray
  58. carton
  59. cborl
  60. ccss >= "1.6"
  61. cf-lwt
  62. chacha
  63. channel
  64. charrua-client
  65. charrua-client-lwt
  66. charrua-client-mirage < "0.11.0"
  67. checked_oint < "0.1.1"
  68. checkseum >= "0.0.3"
  69. cid
  70. clarity-lang
  71. class_group_vdf
  72. cohttp >= "0.17.0"
  73. cohttp-curl-async
  74. cohttp-curl-lwt
  75. cohttp-eio >= "6.0.0~beta2"
  76. colombe
  77. color
  78. conan
  79. conan-cli
  80. conan-database
  81. conan-lwt
  82. conan-unix
  83. conduit = "3.0.0"
  84. conex < "0.10.0"
  85. conex-mirage-crypto
  86. conex-nocrypto
  87. cookie
  88. cow >= "2.2.0"
  89. css
  90. css-parser
  91. cstruct >= "3.3.0"
  92. cstruct-sexp
  93. ctypes-zarith
  94. cuid
  95. curly
  96. current_incr
  97. data-encoding < "1.0.0"
  98. datakit >= "0.12.0"
  99. datakit-bridge-github >= "0.12.0"
  100. datakit-ci
  101. datakit-client-git >= "0.12.0"
  102. decompress >= "0.8" & < "1.5.3"
  103. depyt
  104. digestif >= "0.7"
  105. dispatch >= "0.4.1"
  106. dkim
  107. dkim-bin
  108. dkim-mirage
  109. dns >= "4.0.0"
  110. dns-cli
  111. dns-client >= "4.6.0"
  112. dns-forward < "0.9.0"
  113. dns-forward-lwt-unix
  114. dns-resolver
  115. dns-server
  116. dns-tsig
  117. dnssd
  118. dnssec
  119. docfd >= "2.2.0"
  120. dog < "0.2.1"
  121. domain-name
  122. dream
  123. dream-pure
  124. duff
  125. dune-release >= "1.0.0"
  126. duration >= "0.1.1"
  127. emile
  128. encore
  129. eqaf >= "0.5"
  130. equinoxe
  131. equinoxe-cohttp
  132. equinoxe-hlc
  133. eris
  134. eris-lwt
  135. ezgzip
  136. ezjsonm >= "0.4.2" & < "1.3.0"
  137. ezjsonm-lwt < "1.3.0"
  138. FPauth
  139. FPauth-core
  140. FPauth-responses
  141. FPauth-strategies
  142. faraday != "0.2.0"
  143. farfadet
  144. fat-filesystem >= "0.12.0"
  145. ff
  146. ff-pbt
  147. fiat-p256
  148. flex-array
  149. fsevents-lwt
  150. functoria >= "2.2.0"
  151. functoria-runtime >= "2.2.0" & != "3.0.1" & < "4.0.0~beta1"
  152. geojson
  153. geoml >= "0.1.1"
  154. git = "1.4.10" | = "1.5.0" | >= "1.5.2" & != "1.10.0" & < "3.0.0"
  155. git-mirage < "3.0.0"
  156. git-unix >= "1.10.0" & != "2.1.0" & < "3.0.0"
  157. gitlab-unix
  158. glicko2
  159. gmap >= "0.3.0"
  160. gpt
  161. graphql
  162. graphql-async
  163. graphql-cohttp >= "0.13.0"
  164. graphql-lwt
  165. graphql_parser
  166. graphql_ppx >= "0.7.1"
  167. h1_parser
  168. h2
  169. hacl
  170. hacl_func
  171. hacl_x25519 >= "0.2.0"
  172. highlexer
  173. hkdf
  174. hockmd
  175. html_of_jsx
  176. http
  177. http-multipart-formdata < "2.0.0"
  178. httpaf >= "0.2.0"
  179. hvsock
  180. icalendar
  181. imagelib >= "20200929"
  182. index
  183. inferno >= "20220603"
  184. influxdb-async
  185. influxdb-lwt
  186. inquire < "0.2.0"
  187. interval-map
  188. iomux
  189. irmin < "0.8.0" | >= "0.9.6" & != "0.11.1" & < "1.2.0" | >= "2.0.0" & < "2.3.0"
  190. irmin-bench >= "2.7.0"
  191. irmin-chunk < "2.0.0" | >= "2.3.0"
  192. irmin-cli
  193. irmin-containers
  194. irmin-fs < "2.0.0" | >= "2.3.0"
  195. irmin-git < "2.0.0" | >= "2.3.0"
  196. irmin-http < "2.0.0"
  197. irmin-mem < "2.0.0"
  198. irmin-pack >= "2.4.0" & != "2.6.1"
  199. irmin-pack-tools
  200. irmin-test < "2.2.0"
  201. irmin-tezos
  202. irmin-tezos-utils
  203. irmin-unix >= "1.0.0" & < "2.0.0" | >= "2.4.0" & != "2.6.1"
  204. irmin-watcher
  205. jekyll-format
  206. jerboa
  207. jitsu
  208. jose
  209. json-data-encoding >= "0.9"
  210. json_decoder
  211. jsonxt
  212. junit_alcotest
  213. jwto
  214. ke >= "0.2"
  215. kkmarkdown
  216. lambda-runtime
  217. lambdapi >= "2.0.0"
  218. lambdoc >= "1.0-beta4"
  219. ledgerwallet-tezos >= "0.2.1" & < "0.4.0"
  220. lmdb >= "1.0"
  221. logical
  222. logtk >= "1.5.1"
  223. lp
  224. lp-glpk
  225. lp-glpk-js
  226. lp-gurobi
  227. lru
  228. lt-code
  229. luv
  230. mbr-format >= "1.0.0"
  231. mdx >= "1.6.0"
  232. mec
  233. mechaml >= "1.0.0"
  234. merge-queues >= "0.2.0"
  235. merge-ropes >= "0.2.0"
  236. metrics
  237. mirage >= "4.0.0~beta1"
  238. mirage-block-partition < "0.2.0"
  239. mirage-block-ramdisk >= "0.3"
  240. mirage-channel >= "4.0.0"
  241. mirage-channel-lwt
  242. mirage-crypto-ec
  243. mirage-flow >= "1.0.2" & < "1.2.0"
  244. mirage-flow-unix
  245. mirage-fs-mem
  246. mirage-fs-unix >= "1.2.0"
  247. mirage-kv >= "2.0.0"
  248. mirage-kv-mem
  249. mirage-kv-unix
  250. mirage-logs >= "0.3.0"
  251. mirage-nat
  252. mirage-net-unix >= "2.3.0"
  253. mirage-runtime >= "4.0.0~beta1" & < "4.5.0"
  254. mirage-tc
  255. mjson
  256. mnd
  257. monocypher
  258. mrmime
  259. mrt-format
  260. multibase
  261. multihash
  262. multihash-digestif
  263. multipart-form-data
  264. multipart_form
  265. multipart_form-eio
  266. multipart_form-lwt
  267. named-pipe
  268. nanoid
  269. nbd >= "4.0.3"
  270. nbd-tool
  271. nloge
  272. nocoiner
  273. non_empty_list
  274. OCADml >= "0.6.0"
  275. ocaml-r >= "0.5.0"
  276. ocaml-version >= "3.1.0"
  277. ocamlformat >= "0.13.0" & != "0.19.0~4.13preview" & < "0.25.1"
  278. ocamlformat-rpc < "removed"
  279. ocamline
  280. ohex
  281. oidc
  282. opam-0install
  283. opam-file-format >= "2.1.1"
  284. opentelemetry >= "0.6"
  285. opentelemetry-client-cohttp-lwt >= "0.6"
  286. opentelemetry-client-ocurl >= "0.6"
  287. opentelemetry-cohttp-lwt >= "0.6"
  288. opentelemetry-lwt >= "0.6"
  289. opium >= "0.15.0"
  290. opium-graphql
  291. opium-testing
  292. opium_kernel
  293. ortac-core
  294. osx-acl
  295. osx-attr
  296. osx-cf
  297. osx-fsevents
  298. osx-membership
  299. osx-mount
  300. osx-xattr
  301. otoggl
  302. owl >= "0.6.0" & != "0.9.0" & != "1.0.0"
  303. owl-base < "0.5.0"
  304. owl-ode >= "0.1.0" & != "0.2.0"
  305. owl-symbolic
  306. passmaker
  307. patch
  308. pbkdf
  309. pecu >= "0.2"
  310. pf-qubes
  311. pg_query >= "0.9.6"
  312. phylogenetics
  313. piaf
  314. polyglot
  315. polynomial
  316. ppx_blob >= "0.3.0"
  317. ppx_deriving_cmdliner
  318. ppx_deriving_rpc
  319. ppx_deriving_yaml
  320. ppx_graphql >= "0.2.0"
  321. ppx_mysql
  322. ppx_parser
  323. ppx_protocol_conv >= "5.0.0"
  324. ppx_protocol_conv_json >= "5.0.0"
  325. ppx_protocol_conv_jsonm >= "5.0.0"
  326. ppx_protocol_conv_msgpack >= "5.0.0"
  327. ppx_protocol_conv_xml_light >= "5.0.0"
  328. ppx_protocol_conv_xmlm
  329. ppx_protocol_conv_yaml >= "5.0.0"
  330. ppx_subliner
  331. ppx_units
  332. ppx_yojson >= "1.1.0"
  333. pratter
  334. prc
  335. preface
  336. pretty_expressive
  337. prettym
  338. proc-smaps
  339. producer < "0.2.0"
  340. prometheus < "1.2"
  341. prometheus-app
  342. protocell
  343. protocol-9p >= "0.3" & < "0.11.0" | >= "0.11.2"
  344. protocol-9p-unix
  345. psq
  346. qcheck >= "0.18"
  347. qcheck-alcotest
  348. qcheck-core >= "0.18"
  349. quickjs
  350. radis
  351. randii
  352. reason-standard
  353. reparse >= "2.0.0" & < "3.0.0"
  354. reparse-unix < "2.1.0"
  355. resp < "0.10.0"
  356. resp-unix
  357. rfc1951 < "1.0.0"
  358. routes < "2.0.0"
  359. rpc >= "5.9.0"
  360. rpclib
  361. rpclib-async
  362. rpclib-lwt
  363. rubytt
  364. SZXX >= "4.0.0"
  365. salsa20
  366. salsa20-core
  367. sanddb >= "0.2"
  368. scaml >= "1.5.0"
  369. scrypt-kdf
  370. secp256k1 >= "0.4.1"
  371. secp256k1-internal
  372. semver >= "0.2.1"
  373. sendmail
  374. sendmail-lwt
  375. sendmsg
  376. server-reason-react
  377. session-cookie
  378. session-cookie-async
  379. session-cookie-lwt
  380. sherlodoc
  381. slug
  382. sodium-fmt
  383. spin >= "0.6.0"
  384. squirrel
  385. ssh-agent
  386. ssl >= "0.6.0"
  387. stramon-lib
  388. styled-ppx
  389. tcpip >= "2.4.2" & < "4.0.0" | >= "5.0.1" & < "7.0.0"
  390. tdigest < "2.1.0"
  391. terminal_size >= "0.1.1"
  392. terminus
  393. terminus-cohttp
  394. terminus-hlc
  395. terml
  396. textrazor
  397. tezos-base-test-helpers < "13.0"
  398. tezos-client-base < "12.0"
  399. tezos-lmdb
  400. tezos-test-helpers < "11.0"
  401. tftp
  402. timedesc
  403. timere
  404. tls >= "0.12.0"
  405. toc
  406. topojson
  407. topojsone
  408. transept
  409. type_eq
  410. type_id
  411. typebeat
  412. typeid >= "1.0.1"
  413. tyre >= "0.4"
  414. tyxml >= "4.0.0"
  415. tyxml-jsx
  416. tyxml-ppx >= "4.3.0"
  417. tyxml-syntax
  418. uecc
  419. ulid
  420. universal-portal
  421. unix-dirent
  422. unix-errno >= "0.3.0"
  423. unix-fcntl >= "0.3.0"
  424. unix-sys-resource
  425. unix-sys-stat
  426. unix-time
  427. unstrctrd
  428. uspf
  429. uspf-lwt
  430. uspf-unix
  431. utop >= "2.13.0"
  432. validate
  433. validator
  434. vercel
  435. vpnkit
  436. wcwidth
  437. websocketaf
  438. x509 >= "0.7.0"
  439. xapi-rrd >= "1.8.2"
  440. xapi-stdext-date
  441. xapi-stdext-encodings
  442. xapi-stdext-std >= "4.16.0"
  443. yaml < "3.2.0"
  444. yaml-sexp
  445. yocaml
  446. yocaml_yaml
  447. yuscii >= "0.2.0"
  448. zar
  449. zed >= "3.2.2"
  450. zlist < "0.4.0"

Conflicts

None

OCaml

Innovation. Community. Security.