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. 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. 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"
  240. mirage-kv >= "2.0.0" & < "6.1.0"
  241. mirage-kv-mem
  242. mirage-kv-unix < "3.0.0"
  243. mirage-logs >= "0.3.0"
  244. mirage-nat
  245. mirage-net-fd
  246. mirage-net-flow
  247. mirage-net-unix >= "2.3.0"
  248. mirage-runtime >= "4.0.0~beta1" & < "4.5.0"
  249. mirage-tc
  250. mjson
  251. mnd
  252. monocypher
  253. mrmime
  254. mrt-format
  255. multibase
  256. multihash
  257. multihash-digestif
  258. multipart-form-data
  259. multipart_form
  260. multipart_form-eio
  261. multipart_form-lwt
  262. named-pipe
  263. nanoid
  264. nbd >= "4.0.3"
  265. nbd-tool
  266. nloge
  267. nocoiner
  268. non_empty_list
  269. OCADml >= "0.6.0"
  270. ocaml-r >= "0.5.0"
  271. ocaml-version >= "3.1.0"
  272. ocamlformat >= "0.13.0" & != "0.19.0~4.13preview" & < "0.25.1"
  273. ocamlformat-rpc < "removed"
  274. ocamline
  275. ohex
  276. oidc
  277. opam-0install
  278. opam-file-format >= "2.1.1"
  279. opentelemetry >= "0.6"
  280. opentelemetry-client-cohttp-lwt >= "0.6"
  281. opentelemetry-client-ocurl >= "0.6"
  282. opentelemetry-cohttp-lwt >= "0.6"
  283. opentelemetry-lwt >= "0.6"
  284. opium >= "0.15.0"
  285. opium-graphql
  286. opium-testing
  287. opium_kernel
  288. osx-acl
  289. osx-attr
  290. osx-cf
  291. osx-fsevents
  292. osx-membership
  293. osx-mount
  294. osx-xattr
  295. otoggl
  296. owl >= "0.6.0" & != "0.9.0" & != "1.0.0"
  297. owl-base < "0.5.0"
  298. owl-ode >= "0.1.0" & != "0.2.0"
  299. owl-symbolic
  300. passmaker
  301. patch
  302. pbkdf < "0.3.0"
  303. pecu >= "0.2"
  304. pf-qubes
  305. pg_query >= "0.9.6"
  306. phylogenetics
  307. piaf
  308. polyglot
  309. polynomial
  310. ppx_blob >= "0.3.0"
  311. ppx_deriving_cmdliner
  312. ppx_deriving_rpc
  313. ppx_deriving_yaml
  314. ppx_graphql
  315. ppx_parser
  316. ppx_subliner
  317. ppx_units
  318. ppx_yojson >= "1.1.0"
  319. pratter
  320. prc
  321. preface
  322. pretty_expressive
  323. prettym
  324. proc-smaps
  325. producer < "0.2.0"
  326. prometheus < "1.2"
  327. prometheus-app
  328. protocell
  329. protocol-9p >= "0.3" & < "0.11.0" | >= "0.11.2"
  330. protocol-9p-unix
  331. psq
  332. qcheck >= "0.18"
  333. qcheck-core >= "0.18"
  334. quickjs
  335. radis
  336. randii
  337. reason-standard
  338. reparse >= "2.0.0" & < "3.0.0"
  339. reparse-unix < "2.1.0"
  340. resp < "0.10.0"
  341. resp-unix
  342. rfc1951 < "1.0.0"
  343. routes < "2.0.0"
  344. rpc >= "5.9.0"
  345. rpclib
  346. rpclib-async
  347. rpclib-lwt
  348. rubytt
  349. SZXX >= "4.0.0"
  350. salsa20
  351. salsa20-core
  352. sanddb >= "0.2"
  353. scaml >= "1.5.0"
  354. scrypt-kdf
  355. secp256k1-internal
  356. semver >= "0.2.1"
  357. sendmail
  358. sendmail-lwt
  359. sendmsg
  360. server-reason-react
  361. session-cookie
  362. session-cookie-async
  363. session-cookie-lwt
  364. sherlodoc
  365. slug
  366. sodium-fmt
  367. spin >= "0.6.0"
  368. squirrel
  369. ssh-agent
  370. ssl >= "0.6.0"
  371. stramon-lib
  372. styled-ppx
  373. tcpip >= "2.4.2" & < "4.0.0" | = "5.0.1"
  374. tdigest < "2.1.0"
  375. terminal_size >= "0.1.1"
  376. terminus
  377. terminus-cohttp
  378. terminus-hlc
  379. terml
  380. textrazor
  381. tezos-base-test-helpers < "13.0"
  382. tezos-client-base < "12.0"
  383. tezos-test-helpers < "11.0"
  384. tftp
  385. timedesc
  386. timere
  387. tls >= "0.12.0"
  388. toc
  389. topojson
  390. topojsone
  391. transept
  392. type_eq
  393. type_id
  394. typebeat
  395. typeid >= "1.0.1"
  396. tyre < "0.4"
  397. tyxml >= "4.0.0"
  398. tyxml-jsx
  399. tyxml-ppx >= "4.3.0"
  400. tyxml-syntax
  401. ulid
  402. universal-portal
  403. unix-dirent
  404. unix-errno >= "0.3.0"
  405. unix-fcntl >= "0.3.0"
  406. unix-sys-resource
  407. unix-sys-stat
  408. unix-time
  409. unstrctrd
  410. uspf
  411. uspf-lwt
  412. uspf-unix
  413. utop >= "2.13.0"
  414. validate
  415. validator
  416. vercel
  417. vpnkit
  418. wcwidth
  419. websocketaf
  420. x509 >= "0.7.0"
  421. xapi-rrd >= "1.8.2"
  422. xapi-stdext-date
  423. xapi-stdext-encodings
  424. xapi-stdext-std >= "4.16.0"
  425. yaml < "3.2.0"
  426. yaml-sexp
  427. yocaml
  428. yocaml_yaml
  429. yuscii >= "0.2.0"
  430. zar
  431. zed >= "3.2.2"
  432. zlist < "0.4.0"

Conflicts

None

OCaml

Innovation. Community. Security.