package alcotest

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

Install

Dune Dependency

Authors

Maintainers

Sources

alcotest-0.6.0.tbz
sha256=2d24dbedf8cc2d9ad7e61a942ec43b4807872664e9f821f1c90cb7767461f158
md5=89b045538b8bd2a173ba8e20eebd2b5b

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: 28 Jun 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.7.1"
  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. archetype >= "1.4.2"
  8. archi
  9. arp
  10. arp-mirage
  11. arrakis
  12. art
  13. asli >= "0.2.0"
  14. asn1-combinators >= "0.2.2" & < "0.3.0"
  15. atd >= "2.3.3"
  16. atdgen >= "2.10.0"
  17. atdpy
  18. atdts
  19. base32
  20. base64 >= "2.1.2"
  21. bechamel >= "0.5.0"
  22. bigarray-overlap
  23. bigstring >= "0.3"
  24. bigstring-unix >= "0.3"
  25. bigstringaf
  26. bitlib
  27. blake2
  28. bloomf
  29. bls12-381 < "0.4.1" | >= "3.0.0" & < "18.0"
  30. bls12-381-hash
  31. bls12-381-js >= "0.4.2"
  32. bls12-381-js-gen >= "0.4.2"
  33. bls12-381-legacy
  34. bls12-381-signature
  35. bls12-381-unix
  36. blurhash
  37. builder-web < "0.2.0"
  38. bulletml
  39. bytebuffer
  40. ca-certs
  41. ca-certs-nss
  42. cactus
  43. calendar >= "3.0.0"
  44. callipyge
  45. camlix
  46. camlkit
  47. camlkit-base
  48. capnp-rpc < "0.6.0"
  49. capnp-rpc-lwt < "0.3"
  50. carray
  51. carton
  52. cborl
  53. ccss >= "1.6"
  54. cf-lwt
  55. chacha
  56. channel
  57. charrua-client
  58. charrua-client-lwt
  59. charrua-client-mirage < "0.11.0"
  60. checked_oint < "0.1.1"
  61. checkseum >= "0.0.3"
  62. cid
  63. clarity-lang
  64. class_group_vdf
  65. cohttp >= "0.17.0"
  66. cohttp-curl-async
  67. cohttp-curl-lwt
  68. cohttp-eio >= "6.0.0~beta2"
  69. colombe
  70. color
  71. conan < "0.0.3"
  72. conan-cli < "0.0.3"
  73. conan-database < "0.0.3"
  74. conan-lwt < "0.0.3"
  75. conan-unix < "0.0.3"
  76. conduit = "3.0.0"
  77. conex < "0.10.0"
  78. conex-mirage-crypto
  79. conex-nocrypto
  80. cookie
  81. cow >= "2.2.0" & < "2.5.0"
  82. css
  83. css-parser
  84. cstruct >= "3.3.0"
  85. cstruct-sexp
  86. ctypes-zarith
  87. cuid
  88. curly
  89. current_incr
  90. data-encoding < "1.0.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-split
  148. git-unix >= "1.10.0" & < "2.0.0"
  149. git_split
  150. gitlab-unix
  151. gmap >= "0.3.0"
  152. gpt
  153. graphql
  154. graphql-async
  155. graphql-cohttp >= "0.13.0"
  156. graphql-lwt
  157. graphql_parser < "0.9.0"
  158. graphql_ppx >= "0.7.1"
  159. h1_parser
  160. h2
  161. hacl_func
  162. hacl_x25519 >= "0.2.0"
  163. highlexer
  164. hkdf
  165. hockmd
  166. html_of_jsx
  167. http
  168. http-multipart-formdata < "2.0.0"
  169. httpaf >= "0.2.0"
  170. httpun
  171. httpun-ws
  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 < "1.3.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" & < "1.3.3" | >= "2.4.0" & != "2.6.1"
  196. irmin-watcher
  197. jekyll-format >= "0.2.0"
  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" & < "1.3.0"
  238. mirage-kv >= "2.0.0" & < "6.1.0"
  239. mirage-kv-mem
  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. obatcher
  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-0install-cudf >= "0.5.0"
  277. opam-file-format >= "2.1.1"
  278. opentelemetry >= "0.6"
  279. opentelemetry-client-cohttp-lwt >= "0.6"
  280. opentelemetry-client-ocurl >= "0.6"
  281. opentelemetry-cohttp-lwt >= "0.6"
  282. opentelemetry-lwt >= "0.6"
  283. opium >= "0.15.0"
  284. opium-graphql
  285. opium-testing
  286. opium_kernel
  287. osx-acl
  288. osx-attr
  289. osx-cf
  290. osx-fsevents
  291. osx-membership
  292. osx-mount
  293. osx-xattr
  294. otoggl
  295. owl >= "0.6.0" & != "0.9.0" & != "1.0.0"
  296. owl-base < "0.5.0"
  297. owl-ode >= "0.1.0" & != "0.2.0"
  298. owl-symbolic
  299. passmaker
  300. patch < "2.0.0"
  301. pbkdf < "0.3.0"
  302. pecu >= "0.2"
  303. pf-qubes
  304. pg_query >= "0.9.6"
  305. phylogenetics
  306. piaf
  307. polyglot
  308. polynomial
  309. ppx_blob >= "0.3.0"
  310. ppx_deriving_cmdliner
  311. ppx_deriving_rpc
  312. ppx_deriving_yaml
  313. ppx_graphql
  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" & < "0.22"
  331. quickjs
  332. radis
  333. randii
  334. reason-standard
  335. red-black-tree
  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. rpmfile < "0.3.0"
  347. rpmfile-eio
  348. rpmfile-unix
  349. rubytt
  350. SZXX >= "4.0.0"
  351. salsa20
  352. salsa20-core
  353. sanddb >= "0.2"
  354. scaml >= "1.5.0"
  355. scrypt-kdf
  356. secp256k1-internal
  357. semver >= "0.2.1"
  358. sendmail
  359. sendmail-lwt
  360. sendmsg
  361. server-reason-react
  362. session-cookie
  363. session-cookie-async
  364. session-cookie-lwt
  365. sherlodoc
  366. slug
  367. sodium-fmt
  368. spin >= "0.6.0"
  369. squirrel
  370. ssh-agent
  371. ssl >= "0.6.0"
  372. stramon-lib
  373. styled-ppx
  374. tcpip >= "2.4.2" & < "3.0.0"
  375. tdigest < "2.1.0"
  376. terminal_size >= "0.1.1"
  377. terminus
  378. terminus-cohttp
  379. terminus-hlc
  380. terml
  381. textrazor
  382. tezos-base-test-helpers < "13.0"
  383. tezos-client-base < "12.0"
  384. tezos-test-helpers < "11.0"
  385. tftp
  386. timedesc
  387. timere
  388. tls >= "0.12.0"
  389. toc
  390. topojson
  391. topojsone
  392. transept
  393. type_eq
  394. type_id
  395. typebeat
  396. typeid >= "1.0.1"
  397. tyre < "0.4"
  398. tyxml >= "4.0.0"
  399. tyxml-jsx
  400. tyxml-ppx >= "4.3.0"
  401. tyxml-syntax
  402. ulid
  403. universal-portal
  404. unix-dirent
  405. unix-errno >= "0.3.0"
  406. unix-fcntl >= "0.3.0"
  407. unix-sys-resource
  408. unix-sys-stat
  409. unix-time
  410. unstrctrd
  411. uspf
  412. uspf-lwt
  413. uspf-unix
  414. utop >= "2.13.0"
  415. validate
  416. validator
  417. vercel
  418. vpnkit
  419. wcwidth
  420. websocketaf
  421. x509 >= "0.7.0"
  422. xapi-rrd >= "1.8.2"
  423. xapi-stdext-date
  424. xapi-stdext-encodings
  425. xapi-stdext-std >= "4.16.0"
  426. yaml < "3.2.0"
  427. yaml-sexp
  428. yocaml
  429. yocaml_yaml
  430. yuscii >= "0.2.0"
  431. zar
  432. zed >= "3.2.2"

Conflicts

None

OCaml

Innovation. Community. Security.