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
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. capnp-rpc < "0.6.0"
  51. capnp-rpc-lwt < "0.3"
  52. carray
  53. carton
  54. cborl
  55. ccss >= "1.6"
  56. cf-lwt
  57. chacha
  58. channel
  59. charrua-client
  60. charrua-client-lwt
  61. charrua-client-mirage < "0.11.0"
  62. checkseum >= "0.0.3"
  63. cid
  64. clarity-lang
  65. class_group_vdf
  66. cohttp >= "0.17.0"
  67. cohttp-curl-async
  68. cohttp-curl-lwt
  69. cohttp-eio >= "6.0.0~beta2"
  70. colombe
  71. color
  72. conan < "0.0.3"
  73. conan-cli < "0.0.3"
  74. conan-database < "0.0.3"
  75. conan-lwt < "0.0.3"
  76. conan-unix < "0.0.3"
  77. conduit = "3.0.0"
  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. dream
  117. dream-pure
  118. duff
  119. dune-release >= "1.0.0"
  120. duration < "0.1.1"
  121. emile
  122. encore
  123. eqaf >= "0.5"
  124. equinoxe
  125. equinoxe-cohttp
  126. equinoxe-hlc
  127. eris
  128. eris-lwt
  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-unix >= "1.10.0" & < "2.0.0"
  150. gitlab-unix
  151. glicko2
  152. gmap >= "0.3.0"
  153. gpt
  154. graphql
  155. graphql-async
  156. graphql-cohttp >= "0.13.0"
  157. graphql-lwt
  158. graphql_parser < "0.9.0"
  159. graphql_ppx >= "0.7.1"
  160. h1_parser
  161. h2
  162. hacl_func
  163. hacl_x25519 >= "0.2.0"
  164. highlexer
  165. hkdf
  166. hockmd
  167. html_of_jsx
  168. http
  169. http-multipart-formdata < "2.0.0"
  170. httpaf >= "0.2.0"
  171. hvsock
  172. icalendar
  173. imagelib >= "20200929"
  174. index
  175. inferno >= "20220603"
  176. influxdb-async
  177. influxdb-lwt
  178. inquire < "0.2.0"
  179. interval-map
  180. iomux
  181. irmin < "0.8.0" | >= "0.9.6" & != "0.11.1" & < "1.2.0" | >= "2.0.0" & < "2.3.0"
  182. irmin-bench >= "2.7.0"
  183. irmin-chunk < "2.0.0" | >= "2.3.0"
  184. irmin-cli
  185. irmin-containers
  186. irmin-fs < "2.0.0" | >= "2.3.0"
  187. irmin-git < "2.0.0" | >= "2.3.0"
  188. irmin-http < "2.0.0"
  189. irmin-mem < "2.0.0"
  190. irmin-pack >= "2.4.0" & != "2.6.1"
  191. irmin-pack-tools
  192. irmin-tezos
  193. irmin-tezos-utils
  194. irmin-unix >= "1.0.0" & < "2.0.0" | >= "2.4.0" & != "2.6.1"
  195. irmin-watcher
  196. jekyll-format
  197. jerboa
  198. jitsu
  199. jose
  200. json-data-encoding >= "0.9"
  201. json_decoder
  202. jsonxt
  203. junit_alcotest >= "2.0.2"
  204. jwto
  205. ke >= "0.2"
  206. kkmarkdown
  207. lambda-runtime
  208. lambdapi >= "2.0.0"
  209. lambdoc >= "1.0-beta4"
  210. ledgerwallet-tezos >= "0.2.1" & < "0.4.0"
  211. lmdb >= "1.0"
  212. logical
  213. logtk >= "1.5.1"
  214. lp
  215. lp-glpk
  216. lp-glpk-js
  217. lp-gurobi
  218. lru
  219. lt-code
  220. mbr-format >= "1.0.0"
  221. mdx >= "1.6.0"
  222. mec
  223. mechaml < "1.0.0"
  224. merge-queues >= "0.2.0"
  225. merge-ropes >= "0.2.0"
  226. metrics
  227. mirage >= "4.0.0~beta1"
  228. mirage-block-partition < "0.2.0"
  229. mirage-block-ramdisk >= "0.3"
  230. mirage-channel >= "4.0.0"
  231. mirage-channel-lwt
  232. mirage-crypto-ec < "0.11.0"
  233. mirage-flow >= "1.0.2" & < "1.2.0"
  234. mirage-flow-unix
  235. mirage-fs-mem
  236. mirage-fs-unix >= "1.2.0"
  237. mirage-kv >= "2.0.0" & < "6.1.0"
  238. mirage-kv-mem
  239. mirage-kv-unix < "3.0.0"
  240. mirage-logs >= "0.3.0"
  241. mirage-nat
  242. mirage-net-fd
  243. mirage-net-flow
  244. mirage-net-unix >= "2.3.0"
  245. mirage-runtime >= "4.0.0~beta1" & < "4.5.0"
  246. mirage-tc
  247. mjson
  248. mnd
  249. monocypher
  250. mrmime
  251. mrt-format
  252. multibase
  253. multihash
  254. multihash-digestif
  255. multipart-form-data
  256. multipart_form
  257. multipart_form-eio
  258. multipart_form-lwt
  259. named-pipe
  260. nanoid
  261. nbd >= "4.0.3"
  262. nbd-tool
  263. nloge
  264. nocoiner
  265. non_empty_list
  266. OCADml >= "0.6.0"
  267. ocaml-r >= "0.5.0"
  268. ocaml-version >= "3.1.0"
  269. ocamlformat >= "0.13.0" & != "0.19.0~4.13preview" & < "0.25.1"
  270. ocamlformat-rpc < "removed"
  271. ocamline
  272. ohex
  273. oidc
  274. opam-0install
  275. opam-file-format >= "2.1.1"
  276. opentelemetry >= "0.6"
  277. opentelemetry-client-cohttp-lwt >= "0.6"
  278. opentelemetry-client-ocurl >= "0.6"
  279. opentelemetry-cohttp-lwt >= "0.6"
  280. opentelemetry-lwt >= "0.6"
  281. opium >= "0.15.0"
  282. opium-graphql
  283. opium-testing
  284. opium_kernel
  285. osx-acl
  286. osx-attr
  287. osx-cf
  288. osx-fsevents
  289. osx-membership
  290. osx-mount
  291. osx-xattr
  292. otoggl
  293. owl >= "0.6.0" & != "0.9.0" & != "1.0.0"
  294. owl-base < "0.5.0"
  295. owl-ode >= "0.1.0" & != "0.2.0"
  296. owl-symbolic
  297. passmaker
  298. patch
  299. pbkdf < "0.3.0"
  300. pecu >= "0.2"
  301. pf-qubes
  302. pg_query >= "0.9.6"
  303. phylogenetics
  304. piaf
  305. polyglot
  306. polynomial
  307. ppx_blob >= "0.3.0"
  308. ppx_deriving_cmdliner
  309. ppx_deriving_rpc
  310. ppx_deriving_yaml
  311. ppx_graphql
  312. ppx_parser
  313. ppx_subliner
  314. ppx_units
  315. ppx_yojson >= "1.1.0"
  316. pratter
  317. prc
  318. preface
  319. pretty_expressive
  320. prettym
  321. proc-smaps
  322. producer < "0.2.0"
  323. prometheus < "1.2"
  324. prometheus-app
  325. protocell
  326. protocol-9p >= "0.3" & < "0.11.0" | >= "0.11.2"
  327. protocol-9p-unix
  328. psq
  329. qcheck >= "0.18"
  330. qcheck-core >= "0.18"
  331. quickjs
  332. radis
  333. randii
  334. reason-standard
  335. reparse >= "2.0.0" & < "3.0.0"
  336. reparse-unix < "2.1.0"
  337. resp < "0.10.0"
  338. resp-unix
  339. rfc1951 < "1.0.0"
  340. routes < "2.0.0"
  341. rpc >= "5.9.0"
  342. rpclib
  343. rpclib-async
  344. rpclib-lwt
  345. rubytt
  346. SZXX >= "4.0.0"
  347. salsa20
  348. salsa20-core
  349. sanddb >= "0.2"
  350. scaml >= "1.5.0"
  351. scrypt-kdf
  352. secp256k1-internal
  353. semver >= "0.2.1"
  354. sendmail
  355. sendmail-lwt
  356. sendmsg
  357. server-reason-react
  358. session-cookie
  359. session-cookie-async
  360. session-cookie-lwt
  361. sherlodoc
  362. slug
  363. sodium-fmt
  364. spin >= "0.6.0"
  365. squirrel
  366. ssh-agent
  367. ssl >= "0.6.0"
  368. stramon-lib
  369. styled-ppx
  370. tcpip >= "2.4.2" & < "4.0.0" | >= "5.0.1" & < "8.0.0"
  371. tdigest < "2.1.0"
  372. terminal_size >= "0.1.1"
  373. terminus
  374. terminus-cohttp
  375. terminus-hlc
  376. terml
  377. textrazor
  378. tezos-base-test-helpers < "13.0"
  379. tezos-client-base < "12.0"
  380. tezos-test-helpers < "11.0"
  381. tftp
  382. timedesc
  383. timere
  384. tls >= "0.12.0"
  385. toc
  386. topojson
  387. topojsone
  388. transept
  389. type_eq
  390. type_id
  391. typebeat
  392. typeid >= "1.0.1"
  393. tyre < "0.4"
  394. tyxml >= "4.0.0"
  395. tyxml-jsx
  396. tyxml-ppx >= "4.3.0"
  397. tyxml-syntax
  398. ulid
  399. universal-portal
  400. unix-dirent
  401. unix-errno >= "0.3.0"
  402. unix-fcntl >= "0.3.0"
  403. unix-sys-resource
  404. unix-sys-stat
  405. unix-time
  406. unstrctrd
  407. uspf
  408. uspf-lwt
  409. uspf-unix
  410. utop >= "2.13.0"
  411. validate
  412. validator
  413. vercel
  414. vpnkit
  415. wcwidth
  416. websocketaf
  417. x509 >= "0.7.0"
  418. xapi-rrd >= "1.8.2"
  419. xapi-stdext-date
  420. xapi-stdext-encodings
  421. xapi-stdext-std >= "4.16.0"
  422. yaml < "3.2.0"
  423. yaml-sexp
  424. yocaml
  425. yocaml_yaml
  426. yuscii >= "0.2.0"
  427. zar
  428. zed >= "3.2.2"
  429. zlist < "0.4.0"

Conflicts

None