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

Conflicts

None

OCaml

Innovation. Community. Security.