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

Conflicts

None