15 instantiations of TestNode
Microsoft.CodeAnalysis.Workspaces.UnitTests (15)
Differencing\MatchTests.cs (15)
18var oldRoot = new TestNode(0, 1, 19x1 = new TestNode(1, 1)); 21var newRoot = new TestNode(0, 1, 22x2 = new TestNode(1, 2)); 31Assert.Throws<ArgumentException>(() => TestTreeComparer.Instance.ComputeMatch(oldRoot, newRoot, [KeyValuePairUtil.Create(x1, x2), KeyValuePairUtil.Create(x1, new TestNode(0, 0))])); 39var oldRoot = new TestNode(0, 1, 40x1 = new TestNode(1, 1), 41y1 = new TestNode(1, 4)); 43var newRoot = new TestNode(0, 1, 44x2 = new TestNode(1, 2), 45y2 = new TestNode(1, 3)); 67var oldRoot = new TestNode(0, 1, 68x1 = new TestNode(0, 1)); 70var newRoot = new TestNode(0, 1, 71x2 = new TestNode(0, 2));
37 references to TestNode
Microsoft.CodeAnalysis.Workspaces.UnitTests (37)
Differencing\MatchTests.cs (12)
16TestNode x1, x2; 18var oldRoot = new TestNode(0, 1, 21var newRoot = new TestNode(0, 1, 26Assert.True(m.TryGetNewNode(x1, out var n)); 37TestNode x1, x2, y1, y2; 39var oldRoot = new TestNode(0, 1, 43var newRoot = new TestNode(0, 1, 54Assert.True(m.TryGetNewNode(x1, out var n)); 65TestNode x1, x2; 67var oldRoot = new TestNode(0, 1, 70var newRoot = new TestNode(0, 1, 79Assert.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)
11public sealed class TestTreeComparer : TreeComparer<TestNode> 23return TestNode.MaxLabel + 1; 27public override double GetDistance(TestNode left, TestNode right) 28=> Math.Abs((double)left.Value - right.Value) / TestNode.MaxValue; 30public override bool ValuesEqual(TestNode oldNode, TestNode newNode) 33protected internal override IEnumerable<TestNode> GetChildren(TestNode node) 36protected internal override IEnumerable<TestNode> GetDescendants(TestNode node) 40foreach (var child in node.Children) 42foreach (var descendant in GetDescendants(child)) 49protected internal override int GetLabel(TestNode node) 52protected internal override TextSpan GetSpan(TestNode node) 58protected internal override bool TreesEqual(TestNode left, TestNode right) 61protected internal override bool TryGetParent(TestNode node, out TestNode parent)