Gender-digit is incorrect for Swedish Personnummer generation
LarsBergqvist opened this issue · 3 comments
Bogus NuGet Package
35.4.0
.NET Version
.NET 8
Visual Studio Version
No response
What operating system are you using?
MacOS
What locale are you using with Bogus?
sv
Problem Description
The generation of Swedish Personnummer is incorrect with respect to gender (in ExtensionsForSweden).
LINQPad Example or Reproduction Steps
These tests in SwedishExtensionTest.cs are wrongly stated/implemented, should be the other way around:
when_person_is_male_second_last_number_is_even
when_person_is_female_second_last_number_is_odd
Expected Behavior
Second last digit in a generated Swedish Personnummer should be even for Female gender
Second last digit in a generated Swedish Personnummer should be odd for Male gender
Actual Behavior
Second last digit in a generated Swedish Personnummer is odd for Female gender
Second last digit in a generated Swedish Personnummer is even for Male gender
Known Workarounds
I can generate an object that contains matching gender for Name and Personnummer by using two different Person-instances, where the one used for generating Personnummer has "inverted" gender compared to the Person used for generating the name.
Could you help with a pull-request?
Yes
Cool. Thanks for the bug report. Sure, you can submit a PR if you like.
Just a couple of guidelines:
- Reference this GH issue number
#534
in your PR. - Please keep your PR/change-set strictly focused on this kind of change (ie: don't include any code reformatting); keep the PR/changes strictly on topic.
Thanks,
@LarsBergqvist , your changes are in Bogus release v35.4.1
:
Thanks again for the PR!
Great, thanks for maintaining this awesome library!