Repository navigation
Support uint64 in EXPECT ... EPSILON - #7
Merged
Merged
Conversation
Value::compare_epsilon had no U64 arm, so an EXPECT with DATA_TYPE uint64 and an EPSILON panicked with "Unsupported data type for epsilon comparison". Handle U64 like the other unsigned types and add a test.
Collaborator
|
Thanks, looks good! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6.
Value::compare_epsilonhandlesU32,U16,U8,F32andF16, but notU64, soEXPECT <buf> uint64 EPSILON ...reached thepanic!("Unsupported data type for epsilon comparison"). This adds aU64arm written the same way as the other unsigned ones (absolute difference without underflow), and arun.smcase.How I found it
I was reading the
EXPECTpath insrc/main.rs. The parser builds an epsilonValuefor every known data type, includinguint64, but the match incompare_epsilonhas no(U64, U64, U64)arm and ends in apanic!. Documentation.md listsuint64as a data type and does not restrictEPSILON, so the two disagree. I then wrote a four-line script to confirm it.Where this can show up in practice
EXPECTaborts the process, so the scripts after it give no result.This is my estimate; I have not seen a field report.
Testing
Trigger:
panicked at src/main.rs:860:18: Unsupported data type for epsilon comparison. The same script withuint32succeeds.EQ 10 11 12 15it now fails with the normalExpectEpsilonerror showing the buffer contents, asuint32does.EXPECT uint64 Epsiloncase insrc/tests/run.sm: panics without themain.rschange, passes with it.cargo test --no-default-features(null backend) on macOS: 1 of 14 fails, "Compute Pipeline two Shaders". It fails the same way on unmodifiedmain(1 of 13) on this machine, so it is unrelated.rustfmt --checkis clean.Not run: the DX12 backend, Windows, or any GPU.