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. hvsock
  176. icalendar
  177. imagelib >= "20200929"
  178. index
  179. inferno >= "20220603"
  180. influxdb-async
  181. influxdb-lwt
  182. inquire < "0.2.0"
  183. interval-map
  184. iomux
  185. irmin < "0.8.0" | >= "0.9.6" & != "0.11.1" & < "1.2.0" | >= "2.0.0" & < "2.3.0"
  186. irmin-bench >= "2.7.0"
  187. irmin-chunk < "2.0.0" | >= "2.3.0"
  188. irmin-cli
  189. irmin-containers
  190. irmin-fs < "2.0.0" | >= "2.3.0"
  191. irmin-git < "2.0.0" | >= "2.3.0"
  192. irmin-http < "2.0.0"
  193. irmin-mem < "2.0.0"
  194. irmin-pack >= "2.4.0" & != "2.6.1"
  195. irmin-pack-tools
  196. irmin-tezos
  197. irmin-tezos-utils
  198. irmin-unix >= "1.0.0" & < "2.0.0" | >= "2.4.0" & != "2.6.1"
  199. irmin-watcher
  200. jekyll-format
  201. jerboa
  202. jitsu
  203. jose
  204. json-data-encoding >= "0.9"
  205. json_decoder
  206. jsonxt
  207. junit_alcotest >= "2.0.2"
  208. jwto
  209. ke >= "0.2"
  210. kkmarkdown
  211. lambda-runtime
  212. lambdapi >= "2.0.0"
  213. lambdoc >= "1.0-beta4"
  214. ledgerwallet-tezos >= "0.2.1" & < "0.4.0"
  215. lmdb >= "1.0"
  216. logical
  217. logtk >= "1.5.1"
  218. lp
  219. lp-glpk
  220. lp-glpk-js
  221. lp-gurobi
  222. lru
  223. lt-code
  224. mbr-format >= "1.0.0"
  225. mdx >= "1.6.0"
  226. mec
  227. mechaml < "1.0.0"
  228. merge-queues >= "0.2.0"
  229. merge-ropes >= "0.2.0"
  230. metrics
  231. mirage >= "4.0.0~beta1"
  232. mirage-block-partition < "0.2.0"
  233. mirage-block-ramdisk >= "0.3"
  234. mirage-channel >= "4.0.0"
  235. mirage-channel-lwt
  236. mirage-crypto-ec < "0.11.0"
  237. mirage-flow >= "1.0.2" & < "1.2.0"
  238. mirage-flow-unix
  239. mirage-fs-mem
  240. mirage-fs-unix >= "1.2.0"
  241. mirage-kv >= "2.0.0" & < "6.1.0"
  242. mirage-kv-mem
  243. mirage-kv-unix < "3.0.0"
  244. mirage-logs >= "0.3.0"
  245. mirage-nat
  246. mirage-net-fd
  247. mirage-net-flow
  248. mirage-net-unix >= "2.3.0"
  249. mirage-runtime >= "4.0.0~beta1" & < "4.5.0"
  250. mirage-tc
  251. mjson
  252. mnd
  253. monocypher
  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. 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-file-format >= "2.1.1"
  280. opentelemetry >= "0.6"
  281. opentelemetry-client-cohttp-lwt >= "0.6"
  282. opentelemetry-client-ocurl >= "0.6"
  283. opentelemetry-cohttp-lwt >= "0.6"
  284. opentelemetry-lwt >= "0.6"
  285. opium >= "0.15.0"
  286. opium-graphql
  287. opium-testing
  288. opium_kernel
  289. osx-acl
  290. osx-attr
  291. osx-cf
  292. osx-fsevents
  293. osx-membership
  294. osx-mount
  295. osx-xattr
  296. otoggl
  297. owl >= "0.6.0" & != "0.9.0" & != "1.0.0"
  298. owl-base < "0.5.0"
  299. owl-ode >= "0.1.0" & != "0.2.0"
  300. owl-symbolic
  301. passmaker
  302. patch
  303. pbkdf < "0.3.0"
  304. pecu >= "0.2"
  305. pf-qubes
  306. pg_query >= "0.9.6"
  307. phylogenetics
  308. piaf
  309. polyglot
  310. polynomial
  311. ppx_blob >= "0.3.0"
  312. ppx_deriving_cmdliner
  313. ppx_deriving_rpc
  314. ppx_deriving_yaml
  315. ppx_graphql
  316. ppx_parser
  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"
  334. qcheck-core >= "0.18"
  335. quickjs
  336. radis
  337. randii
  338. reason-standard
  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. rubytt
  350. SZXX >= "4.0.0"
  351. salsa20
  352. salsa20-core
  353. sanddb >= "0.2"
  354. scaml >= "1.5.0"
  355. scrypt-kdf
  356. secp256k1-internal
  357. semver >= "0.2.1"
  358. sendmail
  359. sendmail-lwt
  360. sendmsg
  361. server-reason-react
  362. session-cookie
  363. session-cookie-async
  364. session-cookie-lwt
  365. sherlodoc
  366. slug
  367. sodium-fmt
  368. spin >= "0.6.0"
  369. squirrel
  370. ssh-agent
  371. ssl >= "0.6.0"
  372. stramon-lib
  373. styled-ppx
  374. tcpip >= "2.4.2" & < "4.0.0" | = "5.0.1"
  375. tdigest < "2.1.0"
  376. terminal_size >= "0.1.1"
  377. terminus
  378. terminus-cohttp
  379. terminus-hlc
  380. terml
  381. textrazor
  382. tezos-base-test-helpers < "13.0"
  383. tezos-client-base < "12.0"
  384. tezos-test-helpers < "11.0"
  385. tftp
  386. timedesc
  387. timere
  388. tls >= "0.12.0"
  389. toc
  390. topojson
  391. topojsone
  392. transept
  393. type_eq
  394. type_id
  395. typebeat
  396. typeid >= "1.0.1"
  397. tyre < "0.4"
  398. tyxml >= "4.0.0"
  399. tyxml-jsx
  400. tyxml-ppx >= "4.3.0"
  401. tyxml-syntax
  402. ulid
  403. universal-portal
  404. unix-dirent
  405. unix-errno >= "0.3.0"
  406. unix-fcntl >= "0.3.0"
  407. unix-sys-resource
  408. unix-sys-stat
  409. unix-time
  410. unstrctrd
  411. uspf
  412. uspf-lwt
  413. uspf-unix
  414. utop >= "2.13.0"
  415. validate
  416. validator
  417. vercel
  418. vpnkit
  419. wcwidth
  420. websocketaf
  421. x509 >= "0.7.0"
  422. xapi-rrd >= "1.8.2"
  423. xapi-stdext-date
  424. xapi-stdext-encodings
  425. xapi-stdext-std >= "4.16.0"
  426. yaml < "3.2.0"
  427. yaml-sexp
  428. yocaml
  429. yocaml_yaml
  430. yuscii >= "0.2.0"
  431. zar
  432. zed >= "3.2.2"
  433. zlist < "0.4.0"

Conflicts

None

OCaml

Innovation. Community. Security.