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

Tests do not pass with --profile release #103

Open
LecrisUT opened this issue Oct 17, 2024 · 0 comments
Open

Tests do not pass with --profile release #103

LecrisUT opened this issue Oct 17, 2024 · 0 comments

Comments

@LecrisUT
Copy link

LecrisUT commented Oct 17, 2024

While packaging this project for Fedora, we encountered test failures:

test entropy::tests::test_kl ... ok
test entropy::tests::test_kl_with_noisy_negative_qs - should panic ... FAILED
test histogram::bins::bins_tests::get_panics_for_out_of_bounds_indexes - should panic ... ok
test entropy::tests::test_cross_entropy_with_noisy_negative_qs - should panic ... FAILED
test histogram::strategies::auto_tests::empty_arrays_are_bad ... ok

#[test]
#[should_panic]
fn test_cross_entropy_with_noisy_negative_qs() {
let p = array![n64(1.)];
let q = array![n64(-1.)];
let _ = p.cross_entropy(&q);
}
#[test]
#[should_panic]
fn test_kl_with_noisy_negative_qs() {
let p = array![n64(1.)];
let q = array![n64(-1.)];
let _ = p.kl_divergence(&q);
}

I have tried locally with --profile dev/release and confirmed that the failure of "should_panic" is specific to release. We believe the issue is that f64::log does not (always?) panic for negative numbers, instead it would just return NaN.

Edit: we discussed it a bit more and it is more likely because of noisy_float implementation

For each floating point number that is created, a debug_assert! invocation is used to check if it is valid or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant