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

Conflicts

None

OCaml

Innovation. Community. Security.