package alcotest

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

Install

Dune Dependency

Authors

Maintainers

Sources

alcotest-0.7.0.tbz
md5=61d8fec7aed6d648134d1c05fb80568e

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

Conflicts

None