diff --git a/fuzz/.gitignore b/fuzz/.gitignore new file mode 100644 index 0000000..a092511 --- /dev/null +++ b/fuzz/.gitignore @@ -0,0 +1,3 @@ +target +corpus +artifacts diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml new file mode 100644 index 0000000..b009efc --- /dev/null +++ b/fuzz/Cargo.toml @@ -0,0 +1,25 @@ +[package] +name = "floatconv-fuzz" +version = "0.0.0" +authors = ["Automatically generated"] +publish = false +edition = "2018" + +[package.metadata] +cargo-fuzz = true + +[dependencies] +libfuzzer-sys = "0.4" + +[dependencies.floatconv] +path = ".." + +# Prevent this from interfering with workspaces +[workspace] +members = ["."] + +[[bin]] +name = "hard_u128_to_f64_round" +path = "fuzz_targets/hard_u128_to_f64_round.rs" +test = false +doc = false diff --git a/fuzz/fuzz_targets/hard_u128_to_f64_round.rs b/fuzz/fuzz_targets/hard_u128_to_f64_round.rs new file mode 100644 index 0000000..c356f07 --- /dev/null +++ b/fuzz/fuzz_targets/hard_u128_to_f64_round.rs @@ -0,0 +1,6 @@ +#![no_main] +use libfuzzer_sys::fuzz_target; + +fuzz_target!(|data: u128| { + assert_eq!(floatconv::fast::u128_to_f64_round(data), data as f64); +});