package alcotest

  1. Overview
  2. Docs
Alcotest is a lightweight and colourful test framework.

Install

Dune Dependency

Authors

Maintainers

Sources

alcotest-0.6.0.tbz
sha256=2d24dbedf8cc2d9ad7e61a942ec43b4807872664e9f821f1c90cb7767461f158
md5=89b045538b8bd2a173ba8e20eebd2b5b

Description

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.

Published: 28 Jun 2016

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 (8)

  1. cmdliner
  2. result
  3. astring
  4. fmt >= "0.7.1"
  5. topkg build
  6. ocamlbuild build
  7. ocamlfind build
  8. ocaml >= "4.01.0" & < "4.07.0"

Dev Dependencies

None

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

Conflicts

None

OCaml

Innovation. Community. Security.