Skip to content

Commit

Permalink
Merge branch 'development' into feature/issue-2528
Browse files Browse the repository at this point in the history
  • Loading branch information
ipdae authored May 16, 2024
2 parents d6c1b5b + 0714761 commit 9fe0f46
Show file tree
Hide file tree
Showing 187 changed files with 17,715 additions and 17,031 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class UnlockCraftActionTest

public UnlockCraftActionTest()
{
(_tableSheets, _agentAddress, _avatarAddress, _, _initialStateV2) =
(_tableSheets, _agentAddress, _avatarAddress, _initialStateV2) =
InitializeUtil.InitializeStates(isDevEx: true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class UnlockRecipeTest

public UnlockRecipeTest()
{
(_tableSheets, _agentAddress, _avatarAddress, _, _initialStateV2) =
(_tableSheets, _agentAddress, _avatarAddress, _initialStateV2) =
InitializeUtil.InitializeStates(isDevEx: true);
_recipeAddress = _avatarAddress.Derive("recipe_ids");
}
Expand Down
12 changes: 6 additions & 6 deletions .Lib9c.DevExtensions.Tests/Action/ManipulateStateTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class ManipulateStateTest

public ManipulateStateTest()
{
(_tableSheets, _agentAddress, _avatarAddress, _, _initialStateV2) =
(_tableSheets, _agentAddress, _avatarAddress, _initialStateV2) =
InitializeUtil.InitializeStates(
adminAddr: AdminAddr,
isDevEx: true);
Expand Down Expand Up @@ -111,7 +111,7 @@ public ManipulateStateTest()
public static IEnumerable<object[]> FetchInventory()
{
var random = new TestRandom();
var (tableSheets, _, _, _, _) = InitializeUtil.InitializeStates(isDevEx: true);
var (tableSheets, _, _, _) = InitializeUtil.InitializeStates(isDevEx: true);
var equipmentList = tableSheets.EquipmentItemSheet.Values.ToList();
var consumableList = tableSheets.ConsumableItemSheet.Values.ToList();
var materialList = tableSheets.MaterialItemSheet.Values.ToList();
Expand Down Expand Up @@ -170,7 +170,7 @@ public static IEnumerable<object[]> FetchInventory()
public static IEnumerable<object[]> FetchWorldInfo()
{
var random = new Random();
var (tableSheets, _, _, _, _) = InitializeUtil.InitializeStates(isDevEx: true);
var (tableSheets, _, _, _) = InitializeUtil.InitializeStates(isDevEx: true);
var worldSheet = tableSheets.WorldSheet;
yield return new object[]
{
Expand All @@ -195,7 +195,7 @@ public static IEnumerable<object[]> FetchWorldInfo()
public static IEnumerable<object[]> FetchQuest()
{
var random = new Random();
var (tableSheets, _, _, _, stateV2) = InitializeUtil.InitializeStates(isDevEx: true);
var (tableSheets, _, _, stateV2) = InitializeUtil.InitializeStates(isDevEx: true);
// Empty QuestList
yield return new object[]
{
Expand Down Expand Up @@ -455,7 +455,7 @@ public void SetAvatarState(
_initialStateV2,
new List<(Address, Address, IValue)>
{
(Addresses.Avatar, _avatarAddress, MigrationAvatarState.LegacySerializeV2(newAvatarState))
(Addresses.Avatar, _avatarAddress, newAvatarState.SerializeList())
},
new List<(Address, FungibleAssetValue)>()
);
Expand Down Expand Up @@ -547,7 +547,7 @@ public void SetWorldInformation(int lastClearedStage, WorldInformation targetInf
_initialStateV2,
new List<(Address, Address, IValue)>
{
(ReservedAddresses.LegacyAccount, _avatarAddress.Derive(SerializeKeys.LegacyWorldInformationKey), targetInfo.Serialize())
(Addresses.WorldInformation, _avatarAddress, targetInfo.Serialize())
},
new List<(Address, FungibleAssetValue)>()
);
Expand Down
2 changes: 1 addition & 1 deletion .Lib9c.DevExtensions.Tests/Action/Stage/ClearStageTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class ClearStageTest

public ClearStageTest()
{
(_tableSheets, _agentAddress, _avatarAddress, _, _initialStateV2) =
(_tableSheets, _agentAddress, _avatarAddress, _initialStateV2) =
InitializeUtil.InitializeStates(isDevEx: true);
}

Expand Down
19 changes: 3 additions & 16 deletions .Lib9c.Tests/Action/AccountStateViewExtensionsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,23 +128,10 @@ public void GetAvatarStateV2_Throw_FailedLoadStateException(string account)
Assert.Contains(account, exc.Message);
}

[Theory]
[InlineData(true)]
[InlineData(false)]
public void TryGetAvatarState(bool backward)
[Fact]
public void TryGetAvatarState()
{
IWorld states = new World(MockUtil.MockModernWorldState);
if (backward)
{
states = states
.SetLegacyState(_avatarAddress, MigrationAvatarState.LegacySerializeV1(_avatarState));
}
else
{
states = states
.SetAvatarState(_avatarAddress, _avatarState);
}

IWorld states = new World(MockUtil.MockModernWorldState).SetAvatarState(_avatarAddress, _avatarState);
Assert.True(states.TryGetAvatarState(_agentAddress, _avatarAddress, out _));
}

Expand Down
2 changes: 1 addition & 1 deletion .Lib9c.Tests/Action/ActionContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class ActionContext : IActionContext

public long BlockIndex { get; set; }

public int BlockProtocolVersion { get; set; }
public int BlockProtocolVersion { get; set; } = BlockMetadata.CurrentProtocolVersion;

public IWorld PreviousState { get; set; }

Expand Down
5 changes: 0 additions & 5 deletions .Lib9c.Tests/Action/ActionEvaluationTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ public ActionEvaluationTest()
[InlineData(typeof(InitializeStates))]
[InlineData(typeof(ItemEnhancement))]
[InlineData(typeof(MigrationActivatedAccountsState))]
[InlineData(typeof(MigrationAvatarState))]
[InlineData(typeof(PatchTableSheet))]
[InlineData(typeof(RankingBattle))]
[InlineData(typeof(RapidCombination))]
Expand Down Expand Up @@ -198,10 +197,6 @@ private ActionBase GetAction(Type type)
materialIds = new List<Guid>(),
},
MigrationActivatedAccountsState _ => new MigrationActivatedAccountsState(),
MigrationAvatarState _ => new MigrationAvatarState
{
avatarStates = new List<Dictionary>(),
},
PatchTableSheet _ => new PatchTableSheet
{
TableCsv = "table",
Expand Down
Loading

0 comments on commit 9fe0f46

Please sign in to comment.