-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path174.DungeonGame.Test.cs
More file actions
29 lines (28 loc) · 912 Bytes
/
174.DungeonGame.Test.cs
File metadata and controls
29 lines (28 loc) · 912 Bytes
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
using NUnit.Framework;
using System.Collections.Generic;
using System.Linq;
using System;
[TestFixture]
public class TestClass
{
[TestCase("-2 -3 3, -5 -10 1, 10 30 -5", 7)]
[TestCase("100", 1)]
[TestCase("-5", 6)]
[TestCase("-1", 2)]
[TestCase("0", 1)]
[TestCase("1", 1)]
public void TestMethod(string dungeonString, int expectedResult)
{
var temp = dungeonString.Split(',').Select(line => Array.ConvertAll(line.Split(new [] { ' ' }, StringSplitOptions.RemoveEmptyEntries), int.Parse)).ToArray();
var dungeon = new int[temp.Length, temp[0].Length];
for (var i = 0; i < temp.Length; ++i)
{
for (var j = 0; j < temp[0].Length; ++j)
{
dungeon[i, j] = temp[i][j];
}
}
var answer = new Solution().CalculateMinimumHP(dungeon);
Assert.AreEqual(expectedResult, answer);
}
}