Skip to content

Commit

Permalink
Add tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
schungx committed Jun 15, 2022
1 parent 9ebfb2d commit a5652a9
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion tests/test_rand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,13 @@ fn test_rand() -> Result<(), Box<EvalAltResult>> {
let first = engine.eval::<Decimal>("rand_decimal()")?;
let second = engine.eval::<Decimal>("rand_decimal()")?;

println!("{}, {}", first, second);
assert!(first != second);

let first =
engine.eval::<Decimal>("rand_decimal(123.456.to_decimal(), 789.234.to_decimal())")?;
let second =
engine.eval::<Decimal>("rand_decimal(123.456.to_decimal(), 789.234.to_decimal())")?;

assert!(first != second);
}

Expand All @@ -44,6 +50,13 @@ fn test_rand() -> Result<(), Box<EvalAltResult>> {
println!("Random number = {}", value);
}

#[cfg(feature = "float")]
for _ in 0..10 {
let value = engine.eval::<FLOAT>("rand_float()")?;

println!("Random float = {}", value);
}

Ok(())
}

Expand Down

0 comments on commit a5652a9

Please sign in to comment.