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

Conflicts

None

OCaml

Innovation. Community. Security.