public void TestMethod3() { OverlapDetector od = new OverlapDetector(); List <Claim> claims = new List <Claim> { new Claim { Id = 0, XLength = 4, X = 1, Y = 3 }, new Claim { Id = 0, XLength = 4, X = 3, Y = 1 }, new Claim { Id = 0, XLength = 2, X = 5, Y = 5 } }; var overlapCount = od.Check(claims); Assert.AreEqual(4, overlapCount); }
public void TestDay1P1() { OverlapDetector od = new OverlapDetector(); string pattern = @"#(\d+) @ (\d+),(\d+): (\d+)x(\d+)"; var points = File.ReadAllLines("dataset3.txt"); var regex = new Regex(pattern); List <Claim> claims = new List <Claim>(); foreach (string l in points) { foreach (Match match in regex.Matches(l)) { claims.Add(new Claim { Id = Convert.ToInt32(match.Groups[1].Value), X = Convert.ToInt32(match.Groups[2].Value), Y = Convert.ToInt32(match.Groups[3].Value), XLength = Convert.ToInt32(match.Groups[4].Value), YLength = Convert.ToInt32(match.Groups[5].Value), }); } } var overlapCount = od.Check(claims); Assert.AreEqual(0, overlapCount); }
public void TestMethod2() { OverlapDetector od = new OverlapDetector(); List <Claim> claims = new List <Claim> { new Claim { Id = 0, XLength = 1, X = 0, Y = 0 }, new Claim { Id = 0, XLength = 2, X = 0, Y = 0 } }; var overlapCount = od.Check(claims); Assert.AreEqual(1, overlapCount); }