15 instantiations of TestNode
Microsoft.CodeAnalysis.Workspaces.UnitTests (15)
Differencing\MatchTests.cs (15)
20var oldRoot = new TestNode(0, 1, 21x1 = new TestNode(1, 1)); 23var newRoot = new TestNode(0, 1, 24x2 = new TestNode(1, 2)); 33Assert.Throws<ArgumentException>(() => TestTreeComparer.Instance.ComputeMatch(oldRoot, newRoot, [KeyValuePairUtil.Create(x1, x2), KeyValuePairUtil.Create(x1, new TestNode(0, 0))])); 41var oldRoot = new TestNode(0, 1, 42x1 = new TestNode(1, 1), 43y1 = new TestNode(1, 4)); 45var newRoot = new TestNode(0, 1, 46x2 = new TestNode(1, 2), 47y2 = new TestNode(1, 3)); 69var oldRoot = new TestNode(0, 1, 70x1 = new TestNode(0, 1)); 72var newRoot = new TestNode(0, 1, 73x2 = new TestNode(0, 2));
37 references to TestNode
Microsoft.CodeAnalysis.Workspaces.UnitTests (37)
Differencing\MatchTests.cs (12)
18TestNode x1, x2; 20var oldRoot = new TestNode(0, 1, 23var newRoot = new TestNode(0, 1, 28Assert.True(m.TryGetNewNode(x1, out var n)); 39TestNode x1, x2, y1, y2; 41var oldRoot = new TestNode(0, 1, 45var newRoot = new TestNode(0, 1, 56Assert.True(m.TryGetNewNode(x1, out var n)); 67TestNode x1, x2; 69var oldRoot = new TestNode(0, 1, 72var newRoot = new TestNode(0, 1, 81Assert.True(m.TryGetNewNode(x1, out var n)); // matched
Differencing\TestNode.cs (6)
18public readonly TestNode[] Children; 19public TestNode Parent; 21private TestNode _lazyRoot; 23public TestNode(int label, int value, params TestNode[] children) 32foreach (var child in children) 38public TestNode Root
Differencing\TestTreeComparer.cs (19)
13public class TestTreeComparer : TreeComparer<TestNode> 25return TestNode.MaxLabel + 1; 29public override double GetDistance(TestNode left, TestNode right) 30=> Math.Abs((double)left.Value - right.Value) / TestNode.MaxValue; 32public override bool ValuesEqual(TestNode oldNode, TestNode newNode) 35protected internal override IEnumerable<TestNode> GetChildren(TestNode node) 38protected internal override IEnumerable<TestNode> GetDescendants(TestNode node) 42foreach (var child in node.Children) 44foreach (var descendant in GetDescendants(child)) 51protected internal override int GetLabel(TestNode node) 54protected internal override TextSpan GetSpan(TestNode node) 60protected internal override bool TreesEqual(TestNode left, TestNode right) 63protected internal override bool TryGetParent(TestNode node, out TestNode parent)