Beispiel #1
0
        private void TestParrallelDependencyOnDataset(string SourcePath, string ResultPath)
        {
            DependencyCalculator cal = new DependencyCalculator();

            cal.LoadData(SourcePath);

            double[][] result = LoadResultMatrix(ResultPath);

            List <Action <int> > Methods = new List <Action <int> >();

            Methods.Add(cal.ParallelNativeForTransformation);
            Methods.Add(cal.ParralelTaskTransformation);
            Methods.Add(cal.ParralelOwnForTransformation);

            int size = result.Length;

            foreach (Action <int> parallelMethod in Methods)
            {
                parallelMethod(0);
                var depencencyMatrix = cal.getDependencyMatrix();
                for (int i = 0; i < size; ++i)
                {
                    for (int j = 0; j < size; ++j)
                    {
                        Assert.Equal(result[i][j], depencencyMatrix[i][j], PercisionDecimalPlaces);
                    }
                }
            }
        }
Beispiel #2
0
        private double[][] LoadResultMatrix(string path)
        {
            string[]   lines = File.ReadAllLines(path);
            double[][] DependencyMatrix;

            DependencyCalculator ResultLoader = new DependencyCalculator();

            ResultLoader.LoadDependencyMatrix(path);
            DependencyMatrix = ResultLoader.getDependencyMatrix();
            return(DependencyMatrix);
        }
Beispiel #3
0
 public DepencencyTest()
 {
     _calculator = new DependencyCalculator();
     _calculator.LoadData(SampleTestGraphPath);
 }