CRC checksums (CRC-16, CRC-32, CRC-32C) for OCaml
0
fork

Configure Feed

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

fix(fuzz): fix test name prefixes to match module names (E725)

+12 -9
+12 -9
fuzz/fuzz_crc.ml
··· 8 8 9 9 let () = 10 10 (* CRC-16-CCITT: string and bytes sub-range agree *) 11 - Crowbar.add_test ~name:"crc16_ccitt: string = bytes" [ Crowbar.bytes ] 11 + Crowbar.add_test ~name:"crc: string = bytes (ccitt)" [ Crowbar.bytes ] 12 12 (fun s -> 13 13 let from_string = Crc.crc16_ccitt s in 14 14 let from_bytes = ··· 17 17 Crowbar.check_eq ~pp:Format.pp_print_int from_string from_bytes); 18 18 19 19 (* CRC-16-CCITT: self-check property — CRC(msg || CRC_BE) = 0 *) 20 - Crowbar.add_test ~name:"crc16_ccitt: self-check residue" [ Crowbar.bytes ] 20 + Crowbar.add_test ~name:"crc: self-check residue (ccitt)" [ Crowbar.bytes ] 21 21 (fun s -> 22 22 let crc = Crc.crc16_ccitt s in 23 23 let with_crc = ··· 29 29 Crowbar.check_eq ~pp:Format.pp_print_int 0 residue); 30 30 31 31 (* CRC-16-CCITT: output is 16-bit *) 32 - Crowbar.add_test ~name:"crc16_ccitt: 16-bit range" [ Crowbar.bytes ] (fun s -> 32 + Crowbar.add_test ~name:"crc: 16-bit range (ccitt)" [ Crowbar.bytes ] (fun s -> 33 33 let crc = Crc.crc16_ccitt s in 34 34 Crowbar.check (crc >= 0 && crc <= 0xFFFF)); 35 35 36 36 (* CRC-16-X.25: output is 16-bit *) 37 - Crowbar.add_test ~name:"crc16_x25: 16-bit range" [ Crowbar.bytes ] (fun s -> 37 + Crowbar.add_test ~name:"crc: 16-bit range (x25)" [ Crowbar.bytes ] (fun s -> 38 38 let crc = Crc.crc16_x25 s in 39 39 Crowbar.check (crc >= 0 && crc <= 0xFFFF)); 40 40 41 41 (* CRC-32: output is non-negative *) 42 - Crowbar.add_test ~name:"crc32: non-negative" [ Crowbar.bytes ] (fun s -> 42 + Crowbar.add_test ~name:"crc: non-negative (crc32)" [ Crowbar.bytes ] (fun s -> 43 43 let crc = Crc.crc32 s in 44 44 Crowbar.check (crc >= 0)); 45 45 46 46 (* CRC-32C: string and bytes sub-range agree *) 47 - Crowbar.add_test ~name:"crc32c: string = bytes" [ Crowbar.bytes ] (fun s -> 47 + Crowbar.add_test ~name:"crc: string = bytes (crc32c)" [ Crowbar.bytes ] 48 + (fun s -> 48 49 let from_string = Crc.crc32c s in 49 50 let from_bytes = 50 51 Crc.crc32c_bytes (Bytes.of_string s) 0 (String.length s) ··· 52 53 Crowbar.check_eq ~pp:Format.pp_print_int from_string from_bytes); 53 54 54 55 (* CRC-32C: output is 32-bit *) 55 - Crowbar.add_test ~name:"crc32c: 32-bit range" [ Crowbar.bytes ] (fun s -> 56 + Crowbar.add_test ~name:"crc: 32-bit range (crc32c)" [ Crowbar.bytes ] 57 + (fun s -> 56 58 let crc = Crc.crc32c s in 57 59 Crowbar.check (crc >= 0 && crc <= 0xFFFFFFFF)); 58 60 59 61 (* CRC-16-CCITT: deterministic *) 60 - Crowbar.add_test ~name:"crc16_ccitt: deterministic" [ Crowbar.bytes ] 62 + Crowbar.add_test ~name:"crc: deterministic (ccitt)" [ Crowbar.bytes ] 61 63 (fun s -> 62 64 Crowbar.check_eq ~pp:Format.pp_print_int (Crc.crc16_ccitt s) 63 65 (Crc.crc16_ccitt s)); 64 66 65 67 (* CRC-32C: deterministic *) 66 - Crowbar.add_test ~name:"crc32c: deterministic" [ Crowbar.bytes ] (fun s -> 68 + Crowbar.add_test ~name:"crc: deterministic (crc32c)" [ Crowbar.bytes ] 69 + (fun s -> 67 70 Crowbar.check_eq ~pp:Format.pp_print_int (Crc.crc32c s) (Crc.crc32c s))