upstream: https://github.com/mirage/mirage-crypto
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(lint): resolve E205 Printf/Format usage in wycheproof.ml

Replace Printf.sprintf/ksprintf with Fmt.str/failwith/Alcotest.failf
and Format.asprintf with Fmt.str.

+6 -9
+6 -9
test/ec/wycheproof/wycheproof.ml
··· 428 428 let to_string_result ~pp_error = function 429 429 | Ok _ as ok -> ok 430 430 | Error e -> 431 - let msg = Format.asprintf "%a" pp_error e in 431 + let msg = Fmt.str "%a" pp_error e in 432 432 Error msg 433 433 434 434 let pad ~total_len buf = ··· 479 479 let interpret_test ~tc_id curve { public_key; raw_private_key; expected } () = 480 480 match perform_key_exchange curve ~public_key ~raw_private_key with 481 481 | Ok got -> Alcotest.check hex __LOC__ expected got 482 - | Error err -> 483 - Printf.ksprintf 484 - (fun s -> Alcotest.fail s) 485 - "While parsing %d: %s" tc_id err 482 + | Error err -> Alcotest.failf "While parsing %d: %s" tc_id err 486 483 487 484 type invalid_test = { public : string; private_ : string } 488 485 ··· 519 516 Ok (Test { public_key; raw_private_key; expected = test.shared }) 520 517 521 518 let to_ecdh_tests curve (x : ecdh_test) = 522 - let name = Printf.sprintf "%d - %s" x.tc_id x.comment in 519 + let name = Fmt.str "%d - %s" x.tc_id x.comment in 523 520 match ecdh_test curve x with 524 521 | Ok (Test t) -> [ (name, `Quick, interpret_test ~tc_id:x.tc_id curve t) ] 525 522 | Ok (Invalid_test t) -> [ (name, `Quick, interpret_invalid_test curve t) ] 526 523 | Ok Skip -> [] 527 - | Error e -> Printf.ksprintf failwith "While parsing %d: %s" x.tc_id e 524 + | Error e -> Fmt.failwith "While parsing %d: %s" x.tc_id e 528 525 529 526 let ecdh_tests file = 530 527 let data = load_file_exn file in ··· 537 534 groups 538 535 539 536 let ecdsa_test curve key hash (tst : dsa_test) = 540 - let name = Printf.sprintf "%d - %s" tst.tc_id tst.comment in 537 + let name = Fmt.str "%d - %s" tst.tc_id tst.comment in 541 538 let size = len curve in 542 539 let msg = 543 540 let dgst = ··· 641 638 groups 642 639 643 640 let to_ed25519_test (priv, pub) (x : dsa_test) = 644 - let name = Printf.sprintf "%d - %s" x.tc_id x.comment in 641 + let name = Fmt.str "%d - %s" x.tc_id x.comment in 645 642 match x.result with 646 643 | Invalid -> 647 644 let f () =