package alcotest

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

Install

Dune Dependency

Authors

Maintainers

Sources

alcotest-0.7.2.tbz
sha256=ec95a43fef36fab13677b0eaeea6e265294af2038664e821c2a4bbfbc0fcb43c
md5=be7b09ce3d53afa11f0ce95e78d72909

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

Conflicts

None

OCaml

Innovation. Community. Security.