-
Notifications
You must be signed in to change notification settings - Fork 0
/
AiCorrectness_Test.cs
49 lines (42 loc) · 1.55 KB
/
AiCorrectness_Test.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using System;
using System.Collections.Generic;
using System.Linq;
using lib.Scores.Simple;
using lib.Structures;
using lib.viz;
using NUnit.Framework;
namespace lib.Ai
{
[TestFixture("gen1.json", 2)]
[TestFixture("circle.json", 2)]
[TestFixture("lambda.json", 2)]
[TestFixture("randomMedium.json", 4)]
public class AiCorrectness_Test
{
private string MapName { get; }
private int Players { get; }
public AiCorrectness_Test(string mapName, int players)
{
MapName = mapName;
Players = players;
}
private static readonly string[] Exceptions =
{
// nameof(MeetInTheMiddleAi)
};
private static IEnumerable<TestCaseData> TestCases => AiFactoryRegistry.ForOnlineRunsFactories
.Where(factory => !Exceptions.Contains(factory.Name))
.Select(factory => new TestCaseData(factory).SetName(factory.Name));
[TestCaseSource(nameof(TestCases))]
public void Check(AiFactory factory)
{
var gamers = new List<IAi> {factory.Create(), factory.Create()};
var gameSimulator = new GameSimulatorRunner(new SimpleScoreCalculator());
var results = gameSimulator.SimulateGame(
gamers, MapLoader.LoadMapByName(MapName).Map, new Settings());
foreach (var gameSimulationResult in results)
Console.Out.WriteLine(
"gameSimulationResult = {0}:{1}", gameSimulationResult.Gamer.Name, gameSimulationResult.Score);
}
}
}