+basic test suite
Some checks failed
ci/woodpecker/manual/woodpecker Pipeline failed

This commit is contained in:
Alain Emilia Anna Zscheile 2024-02-23 15:51:09 +01:00
parent 8d6bad5ee5
commit 08402a5481
5 changed files with 47 additions and 2 deletions

6
.woodpecker.yml Normal file
View file

@ -0,0 +1,6 @@
pipeline:
- name: build
image: ocaml/opam:alpine-ocaml-5.1
commands:
- opam install -y dune alcotest bwd fmt gen
- dune build @install @runtest

View file

@ -11,8 +11,10 @@
(synopsis "Yanais-associated utilities")
(description "Yanais-associated utilities")
(depends
(bwd (>= 2.3))
(fmt (>= 0.8.7))
(gen (>= 0.5))
(integers (>= 0.2))
(alcotest (>= 1.7 :with-test))
)
)

3
test/dune Normal file
View file

@ -0,0 +1,3 @@
(tests
(names layout00)
(libraries alcotest fmt yanaijepeux))

33
test/layout00.ml Normal file
View file

@ -0,0 +1,33 @@
module Layout = Yanaijepeux.Layout
let layout_ao_check =
let layout_and_offs = Alcotest.testable (fun fmt (lt, offs) -> Fmt.pf fmt "%S, %i" (Layout.show lt) offs) ( = ) in
Alcotest.check layout_and_offs "same layout"
let test_00 () =
layout_ao_check ({ Layout.size = 8; Layout.align_exp = '\002'; }, 4) (
Layout.push
{ Layout.size = 4; Layout.align_exp = '\002'; }
{ Layout.size = 4; Layout.align_exp = '\002'; }
|> Option.get
)
let test_01_fillup () =
layout_ao_check ({ Layout.size = 5; Layout.align_exp = '\002'; }, 4) (
Layout.push
{ Layout.size = 1; Layout.align_exp = '\002'; }
{ Layout.size = 1; Layout.align_exp = '\002'; }
|> Option.get
)
let test_02_fillup () =
layout_ao_check ({ Layout.size = 8; Layout.align_exp = '\002'; }, 8) (
Layout.finish { Layout.size = 5; Layout.align_exp = '\002'; } |> Option.get
)
let () =
let open Alcotest in
run "Layout" [
"push", [test_case "no padding" `Quick test_00; test_case "with padding" `Quick test_01_fillup];
"finish", [test_case "with padding" `Quick test_02_fillup];
]

View file

@ -7,8 +7,9 @@ authors: ["Alain Emilia Anna Zscheile <fogti+devel@ytrizja.de>"]
license: "Apache-2.0 OR ISC"
depends: [
"dune" {>= "2.7"}
"bwd" {>= "2.3"}
"gen" {>= "0.5"}
"integers" {>= "0.2"}
"alcotest" {"1.7" >= with-test}
"odoc" {with-doc}
]
build: [