Adding an assert makes a test fail
⚓ Rust 📅 2025-09-20 👤 surdeus 👁️ 8Hello! I have a test that I'm running whose outcome appears to be affected by how I construct the input. Here's the short story:
- I construct a linearly-spaced
ndarrayin two different ways: Construction A and Construction B - These result in the exact same values
- I have a previously-existing test that works on Construction A, but not on Construction B
- What's worse, simply asserting that the two constructions are equal in value causes the original test to start failing on Construction A.
Here's a main.rs to demonstrate:
I'm really stumped by what could be causing this. My best guess right now is some sort of difference in compiler optimizations? Any help would be greatly appreciated.
3 posts - 2 participants
🏷️ Rust_feed