-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Add ASCIIUtility tests #36227
Add ASCIIUtility tests #36227
Conversation
|
Note: The unit tests should pass right now because [slow] implementations of these methods already exist. I ran these tests against the PR making its way through coreclr and confirmed that they succeed. Additionally, I ran separate tests against the following specific variants and confirmed correct functionality: COMPLUS_ENABLEBMI2=0
COMPLUS_ENABLEBMI1=0
COMPLUS_ENABLEAVX=0
COMPLUS_ENABLESSE41=0
COMPLUS_ENABLESSE2=0I also ifdefed out everything except the /cc @tannergooding just in case he has any suggestions for additional scenarios I should be testing. |
| { | ||
| private const int SizeOfVector128 = 128 / 8; | ||
|
|
||
| // The delegate definitions and members below provide us access to CoreLib's internals. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also have a project at https://github.com/dotnet/corefx/blob/master/src/Common/tests/Common.Tests.csproj that's used to test various common helpers. You could put these tests there instead of using reflection.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. Do you know how that test project works when faced with shared source files that contain #if BIT64 and similar?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It probably doesn't. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The curse of nuint strikes again. 😈
|
I'll check this in for now since it's just unit tests (no runtime changes) and we could benefit from the increased coverage. Will leave it open for further reviews and so that we can also figure out how to make the Common project support multiple archs properly. |
Commit migrated from dotnet/corefx@c50a04a
Unit tests for dotnet/coreclr#22516.
These tests use private reflection to call into
ASCIIUtilityto test the method implementations. These methods serve as the workhorse routines forASCIIEncoding. There are existing tests forASCIIEncoding(see the project System.Text.Encoding.Tests), but for increased coverage and to exercise edge cases thatASCIIEncodingmight be hiding I wanted to test the implementation directly. This should also serve as a future-proofing mechanism in case components other thanASCIIEncodingend up calling into it.