Skip to content
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

Treat season as decimal to make address form #2648

Merged
merged 2 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 6 additions & 20 deletions .Lib9c.Tests/Helper/AdventureBossHelperTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,13 @@ public class AdventureBossHelperTest
private string _name = "wanted";

[Theory]
[InlineData(1, "0000000000000000000000000000000000000001", true)]
[InlineData(10, "000000000000000000000000000000000000000a", true)]
[InlineData(15, "000000000000000000000000000000000000000f", true)]
[InlineData(16, "0000000000000000000000000000000000000010", true)]
[InlineData(17, "0000000000000000000000000000000000000011", true)]
[InlineData(10, "000000000000000000000000000000000000000A", false)]
[InlineData(15, "000000000000000000000000000000000000000F", false)]
public void SeasonToAddressForm(int season, string expected, bool success)
[InlineData(1, "0000000000000000000000000000000000000001")]
[InlineData(10, "0000000000000000000000000000000000000010")]
[InlineData(16, "0000000000000000000000000000000000000016")]
[InlineData(100, "0000000000000000000000000000000000000100")]
ipdae marked this conversation as resolved.
Show resolved Hide resolved
public void SeasonToAddressForm(int season, string expectedAddr)
{
if (success)
{
Assert.Equal(expected, AdventureBossHelper.GetSeasonAsAddressForm(season));
}
else
{
Assert.NotEqual(expected, AdventureBossHelper.GetSeasonAsAddressForm(season));
Assert.Equal(
expected.ToLower(CultureInfo.InvariantCulture),
AdventureBossHelper.GetSeasonAsAddressForm(season)
);
}
Assert.Equal(expectedAddr, AdventureBossHelper.GetSeasonAsAddressForm(season));
}

[Theory]
Expand Down
2 changes: 1 addition & 1 deletion Lib9c/Helper/AdventureBossHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static class AdventureBossHelper
{
public static string GetSeasonAsAddressForm(long season)
{
return $"{season:X40}".ToLower(CultureInfo.InvariantCulture);
return $"{season:D40}";
}

public const int RaffleRewardPercent = 5;
Expand Down
Loading