public void SolveTest(int k, int n, int m, int[] xs, int[] ys, int[] xt, int[] yt, int resultX, int resultY) { var listaIntervale = new List <Interval>(); for (int i = 0; i < n; i++) { Interval interval = new Interval(xs[i], ys[i]); listaIntervale.Add(interval); } var listaIntervale2 = new List <Interval>(); for (int i = 0; i < m; i++) { Interval interval = new Interval(xt[i], yt[i]); listaIntervale2.Add(interval); } var problema = new Problema(k, n, m, listaIntervale, listaIntervale2); Interval solutie = problema.Solve(); Assert.AreEqual(new Interval(resultX, resultY), solutie); }
public void SolveProblem(string inputFile) { Problema problema = new Problema(inputFile); Interval interval = problema.Solve(); if (interval == null) { string expectedOutput = ReadOutputFile(inputFile); Assert.That("-1".Equals(expectedOutput)); return; } else { try { string expectedOutput = ReadOutputFile(inputFile); var x = int.Parse(expectedOutput.Split(' ')[0]); var y = int.Parse(expectedOutput.Split(' ')[1]); Assert.AreEqual(interval, new Interval(x, y)); } catch { Assert.Fail("couldn't parse ouput file content"); } } //catch (FileNotFoundException e) //{ // Assert.Fail("input file doesn't exist"); // throw e; //} //catch (Exception e) //{ // Assert.AreEqual("exception", expectedOutput, "Error %s", e.Message); // throw e; //} }