public void GetNodesMiddleTest(TestConfiguration conf) { // Simplified Prepare/Run version, no prepare because the Benchmark preparation data is read only: var graph = GraphPerformanceTestHelper.CreateGraphInstance(conf.GraphType); Assert.IsTrue(graph.CountNodes == 0); GraphPerformanceTestHelper.FillGraph(graph, conf); conf.Run = (c => graph.GetNodes(conf.Levels / 2).Enumerate()); conf.Benchmark("GetNodesMiddle", conf.ToString(), 5); }
public void AddRangeTest(TestConfiguration conf) { conf.Prepare = (i => { var c = ((TestConfiguration)i); c.SequencesToAdd = GenerateSequencesToAdd(conf); c.Graph = GraphPerformanceTestHelper.CreateGraphInstance(conf.GraphType); Assert.IsTrue(c.Graph.CountNodes == 0); }); conf.Run = (i => { var c = ((TestConfiguration)i); c.Graph.AddSequences(c.SequencesToAdd); }); conf.Benchmark("AddSequences", conf.ToString(), 5); }
private static int[][] GenerateSequencesToAdd(TestConfiguration conf) { // Using Orc.DependencyGraph.Graph implementation to generate sequences to add var graph = new Graph<int>() as IInternalGraph<int>; GraphPerformanceTestHelper.FillGraph(graph, conf); var sequencesToAdd = graph.Edges .Select(edge => new[] { edge[0].Value, edge[1].Value }) .ToArray(); return sequencesToAdd; }
public void CanSortTest(TestConfiguration conf) { // Simplified Prepare/Run version, no prepare because the Benchmark preparation data is read only: var graph = GraphPerformanceTestHelper.CreateGraphInstance(conf.GraphType); Assert.IsTrue(graph.CountNodes == 0); GraphPerformanceTestHelper.FillGraph(graph, conf); conf.Run = (c => graph.CanSort(new[] { 1, 2 })); conf.Benchmark("CanSort", conf.ToString(), 5); }