Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added approx_eq! macro for expm1 tests. #665

Merged
merged 4 commits into from
Aug 28, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion boa/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ bitflags = "1.2.1"
indexmap = "1.4.0"
ryu-js = "0.2.0"
chrono = "0.4"
float-cmp = "0.8.0"
neeldug marked this conversation as resolved.
Show resolved Hide resolved

# Optional Dependencies
serde = { version = "1.0.114", features = ["derive"], optional = true }
Expand Down Expand Up @@ -57,4 +58,4 @@ harness = false

[[bench]]
name = "full"
harness = false
harness = false
24 changes: 20 additions & 4 deletions boa/src/builtins/math/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,10 +305,26 @@ fn expm1() {

assert_eq!(a, String::from("NaN"));
assert_eq!(b, String::from("NaN"));
assert_eq!(c.to_number(&mut engine).unwrap(), 1.718_281_828_459_045);
assert_eq!(d.to_number(&mut engine).unwrap(), -0.632_120_558_828_557_7);
assert_eq!(e.to_number(&mut engine).unwrap(), 0_f64);
assert_eq!(f.to_number(&mut engine).unwrap(), 6.389_056_098_930_65);
assert!(float_cmp::approx_eq!(
f64,
c.to_number(&mut engine).unwrap(),
1.718_281_828_459_045
));
assert!(float_cmp::approx_eq!(
f64,
d.to_number(&mut engine).unwrap(),
-0.632_120_558_828_557_7
));
assert!(float_cmp::approx_eq!(
f64,
e.to_number(&mut engine).unwrap(),
0_f64
));
assert!(float_cmp::approx_eq!(
f64,
f.to_number(&mut engine).unwrap(),
6.389_056_098_930_65
));
}

#[test]
Expand Down