Skip to content

Commit

Permalink
dune build @fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
kit-ty-kate committed Jul 25, 2022
1 parent b518bee commit 749313a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
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 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 749313a

Please sign in to comment.