public void GraphAccumulatesData_OverLongChains( [Values(2, 10, 30)] int nodeChainLength, [Values(NodeSet.RenderExecutionModel.Synchronous, NodeSet.RenderExecutionModel.MaximallyParallel)] NodeSet.RenderExecutionModel meansOfComputation) { using (var set = new PotentiallyJobifiedNodeSet(meansOfComputation)) { var nodes = new List <NodeHandle <KernelAdderNode> >(nodeChainLength); var graphValues = new List <GraphValue <int> >(nodeChainLength); for (int i = 0; i < nodeChainLength; ++i) { var node = set.Create <KernelAdderNode>(); nodes.Add(node); graphValues.Add(set.CreateGraphValue(node, KernelAdderNode.KernelPorts.Output)); } for (int i = 0; i < nodeChainLength - 1; ++i) { set.Connect(nodes[i], KernelAdderNode.KernelPorts.Output, nodes[i + 1], KernelAdderNode.KernelPorts.Input); } set.Update(); for (int i = 0; i < nodeChainLength; ++i) { Assert.AreEqual(i + 1, set.GetValueBlocking(graphValues[i])); } for (int i = 0; i < nodeChainLength; ++i) { set.ReleaseGraphValue(graphValues[i]); set.Destroy(nodes[i]); } } }
public void GraphCanUpdate_WithoutIssues([Values] NodeSet.RenderExecutionModel meansOfComputation) { using (var set = new PotentiallyJobifiedNodeSet(meansOfComputation)) { NodeHandle <KernelNode> a = set.Create <KernelNode>(), b = set.Create <KernelNode>(); set.Connect(a, KernelNode.KernelPorts.Output, b, KernelNode.KernelPorts.Input); set.Update(); set.DataGraph.SyncAnyRendering(); set.Destroy(a, b); } }
public void KernelNodeMemberMemory_IsPersistent_OverMultipleGraphEvaluations([Values] NodeSet.RenderExecutionModel meansOfComputation) { using (var set = new PotentiallyJobifiedNodeSet(meansOfComputation)) { var node = set.Create <PersistentKernelNode>(); var value = set.CreateGraphValue(node, PersistentKernelNode.KernelPorts.Output); for (int i = 0; i < 100; ++i) { set.Update(); Assert.AreEqual(i, set.GetValueBlocking(value)); } set.Destroy(node); set.ReleaseGraphValue(value); } }