Skip to content

[tests] Fix integer rounding error in GetTestFileName#52266

Merged
3 commits merged into
dotnet:mainfrom
mdh1418:fix_integer_rounding_gettestfilename
May 5, 2021
Merged

[tests] Fix integer rounding error in GetTestFileName#52266
3 commits merged into
dotnet:mainfrom
mdh1418:fix_integer_rounding_gettestfilename

Conversation

@mdh1418

@mdh1418 mdh1418 commented May 4, 2021

Copy link
Copy Markdown
Member

Fixes #52257

There seemed to be an integer rounding error when getting a portion of the test file name. Using the suggestion #52257 (comment) led to the tests running to completion with no crashes or hangs.

@mdh1418 mdh1418 requested a review from danmoseley May 4, 2021 19:40
@ghost ghost added the area-System.IO label May 4, 2021
@ghost

ghost commented May 4, 2021

Copy link
Copy Markdown

Tagging subscribers to this area: @carlossanlop
See info in area-owners.md if you want to be subscribed.

Issue Details

Fixes #52257

Author: mdh1418
Assignees: -
Labels:

area-System.IO

Milestone: -

// Take a chunk out of the middle as perhaps it's the least interesting part of the name
memberName = memberName.Substring(0, memberName.Length / 2 - excessLength / 2) + "..." + memberName.Substring(memberName.Length / 2 + excessLength / 2);
int halfMemberNameLength = (int)Math.Floor((double)memberName.Length / 2);
int halfExcessLength = (int)Math.Floor((double)excessLength / 2);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be Ceil not Floor, and then we don't need the +1 on the math.

Comment thread src/libraries/Common/tests/TestUtilities/System/IO/FileCleanupTestBase.cs Outdated
Comment thread src/libraries/Common/tests/TestUtilities/System/IO/FileCleanupTestBase.cs Outdated
@ghost

ghost commented May 5, 2021

Copy link
Copy Markdown

Hello @danmoseley!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit 69ac4c5 into dotnet:main May 5, 2021
@runfoapp runfoapp Bot mentioned this pull request May 5, 2021
@mdh1418 mdh1418 deleted the fix_integer_rounding_gettestfilename branch May 17, 2021 13:41
@karelz karelz added this to the 6.0.0 milestone May 20, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Jun 19, 2021
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[iOS][tvOS] System.IO.FileStream.Tests crashes with ((null) warning) Process terminated due to System.Diagnostics.DebugProvider.Fail

3 participants