This commit is contained in:
2024-09-22 17:35:29 +02:00
parent 07556b4018
commit 4a6378dab0
23 changed files with 5554 additions and 1739 deletions

View File

@@ -0,0 +1,168 @@
using System.Collections;
using System.Collections.Generic;
using NUnit.Framework;
namespace Assets.Data
{
[TestFixture]
public class TestTraitsMapping
{
[Test]
[TestCaseSource(typeof(TraitsMappingCase), "ChampCombination")]
public void TestChampCombination(
long mandatoryChamps,
long possibleChamps,
int n,
List<long> expected
)
{
List<long> output = TraitsMapping.GenerateCombinations(
mandatoryChamps,
possibleChamps,
n
);
foreach (long champ in expected)
{
Assert.IsTrue(output.Contains(champ));
}
foreach (long champ in output)
{
Assert.IsTrue(expected.Contains(champ));
}
}
}
public class TraitsMappingCase
{
public static IEnumerable ChampCombination
{
get
{
yield return new TestCaseData(
ChampionUtils.ToLong(
new HashSet<ChampionsEnum>()
{
ChampionsEnum.ASHE,
ChampionsEnum.BLITZCRANK,
}
),
ChampionUtils.ToLong(new HashSet<ChampionsEnum>() { ChampionsEnum.ELISE }),
3,
new List<long>()
{
ChampionUtils.ToLong(
new HashSet<ChampionsEnum>()
{
ChampionsEnum.ASHE,
ChampionsEnum.BLITZCRANK,
ChampionsEnum.ELISE,
}
),
}
);
yield return new TestCaseData(
ChampionUtils.ToLong(
new HashSet<ChampionsEnum>()
{
ChampionsEnum.ASHE,
ChampionsEnum.BLITZCRANK,
}
),
ChampionUtils.ToLong(
new HashSet<ChampionsEnum>()
{
ChampionsEnum.ELISE,
ChampionsEnum.AHRI,
ChampionsEnum.CASSIOPEIA,
ChampionsEnum.EZREAL
}
),
5,
new List<long>()
{
ChampionUtils.ToLong(
new HashSet<ChampionsEnum>()
{
ChampionsEnum.ASHE,
ChampionsEnum.BLITZCRANK,
ChampionsEnum.ELISE,
ChampionsEnum.AHRI,
ChampionsEnum.CASSIOPEIA
}
),
ChampionUtils.ToLong(
new HashSet<ChampionsEnum>()
{
ChampionsEnum.ASHE,
ChampionsEnum.BLITZCRANK,
ChampionsEnum.ELISE,
ChampionsEnum.AHRI,
ChampionsEnum.EZREAL
}
),
ChampionUtils.ToLong(
new HashSet<ChampionsEnum>()
{
ChampionsEnum.ASHE,
ChampionsEnum.BLITZCRANK,
ChampionsEnum.ELISE,
ChampionsEnum.CASSIOPEIA,
ChampionsEnum.EZREAL
}
),
ChampionUtils.ToLong(
new HashSet<ChampionsEnum>()
{
ChampionsEnum.ASHE,
ChampionsEnum.BLITZCRANK,
ChampionsEnum.AHRI,
ChampionsEnum.CASSIOPEIA,
ChampionsEnum.EZREAL
}
),
}
);
yield return new TestCaseData(
ChampionUtils.ToLong(new HashSet<ChampionsEnum>() { ChampionsEnum.ELISE }),
ChampionUtils.ToLong(new HashSet<ChampionsEnum>() { ChampionsEnum.AHRI }),
1,
new List<long>()
{
ChampionUtils.ToLong(new HashSet<ChampionsEnum>() { ChampionsEnum.ELISE }),
}
);
yield return new TestCaseData(
ChampionUtils.ToLong(
new HashSet<ChampionsEnum>()
{
ChampionsEnum.AHRI,
ChampionsEnum.POPPY,
ChampionsEnum.SORAKA,
ChampionsEnum.HWEI,
}
),
ChampionUtils.ToLong(
new HashSet<ChampionsEnum>() { ChampionsEnum.SMOLDER, ChampionsEnum.XERATH }
),
4,
new List<long>()
{
ChampionUtils.ToLong(
new HashSet<ChampionsEnum>()
{
ChampionsEnum.AHRI,
ChampionsEnum.POPPY,
ChampionsEnum.SORAKA,
ChampionsEnum.HWEI,
}
),
}
);
}
}
}
}