Skip to content

Commit

Permalink
fixes for ocaml-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
backtracking committed Jan 31, 2024
1 parent 74faf82 commit 9d6a785
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
1 change: 0 additions & 1 deletion dune
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
(test
(name rule110)
(modules rule110)
(enabled_if %{arch_sixtyfour})
(libraries hashcons))

(test
Expand Down
1 change: 1 addition & 0 deletions dune-project
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
(lang dune 2.7)
(name hashcons)
(formatting (enabled_for dune))
2 changes: 1 addition & 1 deletion hashcons.opam
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ homepage: "https://github.com/backtracking/ocaml-hashcons"
bug-reports: "https://github.com/backtracking/ocaml-hashcons/issues"
depends: [
"dune" {>= "2.7"}
"ocaml" {>= "4.07"}
"ocaml" {>= "4.12"}
"odoc" {with-doc}
]
build: [
Expand Down
22 changes: 12 additions & 10 deletions rule110.ml
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,15 @@ let of_string s =

(* a few tests *)

let test s n b =
let c = of_string s in
let c = steps n c in
assert (bits c = b)
let () = test "0000000000000000" 1 0
let () = test "1111111111111111" 1 3
let () = test "0010000001010100" 0 4
let () = test "0100011101011100" 1000 595
let () = test "1010100010111101" 1000000 591649
let () = test "1010100010111101" 1152921504606846975 682111393702695301
let test ?(size=32) s n b =
if Sys.word_size >= size then (
let c = of_string s in
let c = steps (int_of_string n) c in
assert (bits c = int_of_string b)
)
let () = test "0000000000000000" "1" "0"
let () = test "1111111111111111" "1" "3"
let () = test "0010000001010100" "0" "4"
let () = test "0100011101011100" "1000" "595"
let () = test "1010100010111101" "1000000" "591649"
let () = test ~size:64 "1010100010111101" "1152921504606846975" "682111393702695301"

0 comments on commit 9d6a785

Please sign in to comment.