Skip to content

Commit

Permalink
Merge pull request #52 from kit-ty-kate/fix-0
Browse files Browse the repository at this point in the history
Fix compilation on OCaml 5.0 without ocamlfind installed
  • Loading branch information
dinosaure authored Jan 22, 2023
2 parents dfc0dab + 749313a commit 3e0791f
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 13 deletions.
1 change: 1 addition & 0 deletions base64.opam
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ representation. It is specified in RFC 4648.
depends: [
"ocaml" {>= "4.03.0"}
"dune" {>= "2.0"}
"fmt" {with-test & >= "0.8.7"}
"bos" {with-test}
"rresult" {with-test}
"alcotest" {with-test}
Expand Down
3 changes: 2 additions & 1 deletion bench/benchmarks.ml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ let old_encode_and_decode len =

let args = [ 0; 10; 50; 100; 500; 1000; 2500; 5000 ]

let test_b64 = Bench.Test.create_indexed ~name:"Base64" ~args b64_encode_and_decode
let test_b64 =
Bench.Test.create_indexed ~name:"Base64" ~args b64_encode_and_decode

let test_old = Bench.Test.create_indexed ~name:"Old" ~args old_encode_and_decode

Expand Down
3 changes: 2 additions & 1 deletion bench/dune
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
(executable
(name benchmarks)
(enabled_if (= %{profile} benchmark))
(enabled_if
(= %{profile} benchmark))
(libraries base64 core_bench))
6 changes: 4 additions & 2 deletions fuzz/dune
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
(executable
(name fuzz_rfc2045)
(enabled_if (= %{profile} fuzz))
(enabled_if
(= %{profile} fuzz))
(modules fuzz_rfc2045)
(libraries astring crowbar fmt base64.rfc2045))

(executable
(name fuzz_rfc4648)
(enabled_if (= %{profile} fuzz))
(enabled_if
(= %{profile} fuzz))
(modules fuzz_rfc4648)
(libraries astring crowbar fmt base64))
2 changes: 1 addition & 1 deletion fuzz/fuzz_rfc4648.ml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ let ( // ) x y =

let canonic alphabet =
let dmap = Array.make 256 (-1) in
String.iteri (fun i x -> dmap.(Char.code x) <- i) (Base64.alphabet alphabet);
String.iteri (fun i x -> dmap.(Char.code x) <- i) (Base64.alphabet alphabet) ;
fun (input, off, len) ->
let real_len = String.length input in
let input_len = len in
Expand Down
6 changes: 2 additions & 4 deletions src/dune
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
(library
(name base64)
(modules unsafe base64)
(public_name base64)
(libraries bytes))
(public_name base64))

(rule
(copy %{read:../config/which-unsafe-file} unsafe.ml))

(library
(name base64_rfc2045)
(modules base64_rfc2045)
(public_name base64.rfc2045)
(libraries bytes))
(public_name base64.rfc2045))
6 changes: 2 additions & 4 deletions test/test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,7 @@ let strict_base64_rfc2045_to_string x =
let test_strict_with_malformed_input_rfc2045 =
List.mapi
(fun i (has, _) ->
Alcotest.test_case (Fmt.str "strict rfc2045 - %02d" i) `Quick
@@ fun () ->
Alcotest.test_case (Fmt.str "strict rfc2045 - %02d" i) `Quick @@ fun () ->
try
let _ = strict_base64_rfc2045_of_string has in
Alcotest.failf "Strict parser valids malformed input: %S" has
Expand All @@ -280,8 +279,7 @@ let test_strict_with_malformed_input_rfc2045 =
let test_strict_rfc2045 =
List.mapi
(fun i (has, expect) ->
Alcotest.test_case (Fmt.str "strict rfc2045 - %02d" i) `Quick
@@ fun () ->
Alcotest.test_case (Fmt.str "strict rfc2045 - %02d" i) `Quick @@ fun () ->
try
let res0 = strict_base64_rfc2045_of_string has in
let res1 = strict_base64_rfc2045_to_string res0 in
Expand Down

0 comments on commit 3e0791f

Please sign in to comment.