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

Conflicts

None

OCaml

Innovation. Community. Security.