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

Conflicts

None