package alcotest

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

Install

Dune Dependency

Authors

Maintainers

Sources

alcotest-0.8.3.tbz
md5=597e6bb271bd42062f95aa67afdb9185

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: 25 Mar 2018

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 (6)

  1. cmdliner
  2. result < "1.5"
  3. astring
  4. fmt >= "0.8.0"
  5. jbuilder >= "1.0+beta10"
  6. ocaml >= "4.02.3"

Dev Dependencies

None

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

Conflicts

None