package alcotest

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

Install

Dune Dependency

Authors

Maintainers

Sources

alcotest-0.5.0.tbz
sha256=7741b08bd8ce0379b7f2ff5b457a0ed2d4b9759771a6a1738cf7db563fe177a6
md5=9f9783b00a6302e2a9110b66886b4bc2

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: 27 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.2.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. emile
  119. encore
  120. eqaf >= "0.5"
  121. equinoxe
  122. equinoxe-cohttp
  123. equinoxe-hlc
  124. eris
  125. eris-lwt
  126. ezjsonm >= "0.4.2" & < "1.3.0"
  127. ezjsonm-lwt < "1.3.0"
  128. FPauth
  129. FPauth-core
  130. FPauth-responses
  131. FPauth-strategies
  132. faraday
  133. farfadet
  134. fat-filesystem >= "0.12.0"
  135. ff
  136. ff-pbt
  137. fiat-p256
  138. flex-array
  139. fsevents-lwt
  140. functoria >= "2.2.0"
  141. functoria-runtime >= "2.2.0" & != "3.0.1" & < "4.0.0~beta1"
  142. geojson
  143. geoml >= "0.1.1"
  144. git = "1.4.10" | = "1.5.0" | >= "1.5.2" & != "1.10.0" & < "2.0.0"
  145. git-mirage < "2.0.0"
  146. git-split
  147. git-unix >= "1.10.0" & < "2.0.0"
  148. git_split
  149. gitlab-unix
  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. httpun
  170. httpun-ws
  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 < "1.3.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" & < "1.3.3" | >= "2.4.0" & != "2.6.1"
  195. irmin-watcher
  196. jekyll-format >= "0.2.0"
  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" & < "1.3.0"
  237. mirage-kv >= "2.0.0" & < "6.1.0"
  238. mirage-kv-mem
  239. mirage-logs >= "0.3.0"
  240. mirage-nat
  241. mirage-net-fd
  242. mirage-net-flow
  243. mirage-net-unix >= "2.3.0"
  244. mirage-runtime >= "4.0.0~beta1" & < "4.5.0"
  245. mirage-tc
  246. mjson
  247. mnd
  248. monocypher
  249. mrmime
  250. mrt-format
  251. multibase
  252. multihash
  253. multihash-digestif
  254. multipart-form-data
  255. multipart_form
  256. multipart_form-eio
  257. multipart_form-lwt
  258. named-pipe
  259. nanoid
  260. nbd >= "4.0.3"
  261. nbd-tool
  262. nloge
  263. nocoiner
  264. non_empty_list
  265. OCADml >= "0.6.0"
  266. obatcher
  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-0install-cudf >= "0.5.0"
  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 < "2.0.0"
  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_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" & < "0.22"
  330. quickjs
  331. radis
  332. randii
  333. reason-standard
  334. red-black-tree
  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. rpmfile < "0.3.0"
  346. rpmfile-eio
  347. rpmfile-unix
  348. rubytt
  349. SZXX >= "4.0.0"
  350. salsa20
  351. salsa20-core
  352. sanddb >= "0.2"
  353. scaml >= "1.5.0"
  354. scrypt-kdf
  355. secp256k1-internal
  356. semver >= "0.2.1"
  357. sendmail
  358. sendmail-lwt
  359. sendmsg
  360. server-reason-react
  361. session-cookie
  362. session-cookie-async
  363. session-cookie-lwt
  364. sherlodoc
  365. slug
  366. sodium-fmt
  367. spin >= "0.6.0"
  368. squirrel
  369. ssh-agent
  370. ssl >= "0.6.0"
  371. stramon-lib
  372. styled-ppx
  373. tcpip >= "2.4.2" & < "3.0.0"
  374. tdigest < "2.1.0"
  375. terminal_size >= "0.1.1"
  376. terminus
  377. terminus-cohttp
  378. terminus-hlc
  379. terml
  380. textrazor
  381. tezos-base-test-helpers < "13.0"
  382. tezos-client-base < "12.0"
  383. tezos-test-helpers < "11.0"
  384. tftp
  385. timedesc
  386. timere
  387. tls >= "0.12.0"
  388. toc
  389. topojson
  390. topojsone
  391. transept
  392. type_eq
  393. type_id
  394. typebeat
  395. typeid >= "1.0.1"
  396. tyxml >= "4.0.0"
  397. tyxml-jsx
  398. tyxml-ppx >= "4.3.0"
  399. tyxml-syntax
  400. ulid
  401. universal-portal
  402. unix-dirent
  403. unix-errno >= "0.3.0"
  404. unix-fcntl >= "0.3.0"
  405. unix-sys-resource
  406. unix-sys-stat
  407. unix-time
  408. unstrctrd
  409. uspf
  410. uspf-lwt
  411. uspf-unix
  412. utop >= "2.13.0"
  413. validate
  414. validator
  415. vercel
  416. vpnkit
  417. wcwidth
  418. websocketaf
  419. x509 >= "0.7.0"
  420. xapi-rrd >= "1.8.2"
  421. xapi-stdext-date
  422. xapi-stdext-encodings < "4.20.0"
  423. xapi-stdext-std >= "4.16.0"
  424. yaml < "3.2.0"
  425. yaml-sexp
  426. yocaml
  427. yocaml_yaml
  428. yuscii >= "0.2.0"
  429. zar
  430. zed >= "3.2.2"

Conflicts

None

OCaml

Innovation. Community. Security.