Skip to content

Commit

Permalink
Enable all fuzz tests
Browse files Browse the repository at this point in the history
  • Loading branch information
c410-f3r committed Aug 3, 2021
1 parent a7288bb commit 51be717
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
default_to_workspace = false

[env]
FUZZ_RUNS = 10000000
FUZZ_RUNS = 1000

[tasks.build]
command = "cargo"
Expand Down
20 changes: 10 additions & 10 deletions fuzz/fuzz_targets/arithmetic.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![no_main]

use rust_decimal::Decimal;
use rust_decimal::{Decimal, MathematicalOps};

#[derive(Debug, arbitrary::Arbitrary)]
struct Data {
Expand All @@ -14,13 +14,13 @@ struct Data {
libfuzzer_sys::fuzz_target!(|data: Data| {
let _ = data.a.checked_add(data.b);
let _ = data.a.checked_div(data.b);
//let _ = data.a.checked_exp_with_tolerance(data.b);
//let _ = data.a.checked_exp();
//let _ = data.a.checked_mul(data.b);
//let _ = data.a.checked_norm_pdf();
//let _ = data.a.checked_powd(data.b);
//let _ = data.a.checked_powf(data.exp_f64);
//let _ = data.a.checked_powi(data.exp_i64);
//let _ = data.a.checked_powu(data.exp_u64);
//let _ = data.a.checked_sub(data.b);
let _ = data.a.checked_exp_with_tolerance(data.b);
let _ = data.a.checked_exp();
let _ = data.a.checked_mul(data.b);
let _ = data.a.checked_norm_pdf();
let _ = data.a.checked_powd(data.b);
let _ = data.a.checked_powf(data.exp_f64);
let _ = data.a.checked_powi(data.exp_i64);
let _ = data.a.checked_powu(data.exp_u64);
let _ = data.a.checked_sub(data.b);
});
2 changes: 1 addition & 1 deletion src/maths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ impl MathematicalOps for Decimal {
}

let mut term = *self;
let mut result = self + Decimal::ONE;
let mut result = self.checked_add(Decimal::ONE)?;

for factorial in FACTORIAL.iter().skip(2) {
term = self.checked_mul(term)?;
Expand Down

0 comments on commit 51be717

Please sign in to comment.