169 lines
6.0 KiB
C#
169 lines
6.0 KiB
C#
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,
|
|
}
|
|
),
|
|
}
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|