-
Notifications
You must be signed in to change notification settings - Fork 17.5k
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
bytes, strings: Compare tests do not modify input alignments #26129
Comments
I'm interested in working on this. This would require making changes to the bytes/compare_test.go, is that correct? Thanks! |
@LotusFenn Yes, bytes/compare_test.go and strings/compare_test.go. An additional short test in each that just varies the input alignment from, say, 0 to 16 (inclusive) would be great. Thanks! |
Change https://golang.org/cl/122536 mentions this issue: |
Currently there are no tests that vary the alignment of Compare arguments. Since Compare is written in assembly on most platforms (in internal/bytealg) we should be testing different input alignments. This change modifies TestCompare to vary the alignment of the second argument of Compare. Updates #26129 Change-Id: I4c30a5adf96a41225df748675f4e9beea413b35c Reviewed-on: https://go-review.googlesource.com/c/122536 Reviewed-by: Lotus Fenn <fenn.lotus@gmail.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
@mundaym - The Compare function in
It even has a note from @rsc saying -
Would you still want to test unaligned input for strings/compare_test.go ? |
@agnivade Good point. I still think it would be worthwhile though. The compiler could do the substitution with |
I can't see any tests varying the alignment of
Compare
arguments. SinceCompare
is written in assembly on most platforms (ininternal/bytealg
) we should probably be checking that it works even if the inputs are unaligned.The text was updated successfully, but these errors were encountered: