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.0.tbz
md5=771277ef1fe21b17920b5b44acf441b3

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

Conflicts

None