package alcotest

  1. Overview
  2. Docs
Logo](https://raw.githubusercontent.com/mirage/alcotest/master/alcotest-logo.png)

Install

Dune Dependency

Authors

Maintainers

Sources

alcotest-0.8.1.tbz
md5=8b8d9f8c9e8c0b34c12e20e24db8dec3

Description

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.

Build Status docs

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.

Published: 03 Aug 2017

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

Conflicts

None