-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPyramidSolverTests.cs
37 lines (33 loc) · 1.05 KB
/
PyramidSolverTests.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
using NUnit.Framework;
using PyramidSolver.Interfaces;
using System;
using System.Collections.Generic;
namespace PyramidSolver
{
[TestFixture]
public class PyramidSolverTests
{
[Test]
[TestCaseSource(nameof(GetSolvers))]
public void Test(IPyramidSolver solver)
{
var pyramid = new PyramidModel(new[,]
{
{ 00059, 00207, 00098, 00095 },
{ 00087, 00001, 00070, 0x000 },
{ 00036, 00041, 0x000, 0x000 },
{ 00023, 0x000, 0x000, 0x000 }
});
var result = solver.PyramidMaximumTotal(pyramid);
Console.WriteLine(pyramid);
Console.WriteLine("Total : {0}", result);
Console.WriteLine("Expected : {0}", 353);
Assert.AreEqual(353, result);
}
private IEnumerable<IPyramidSolver> GetSolvers()
{
yield return new IterativePyramidSolver();
yield return new RecursivePyramidSolver();
}
}
}