public void MurtyNodeChildrenWithDuplicates() { MatrixKey[] forced = { new MatrixKey(1, 1) }; MatrixKey[] eliminated = { new MatrixKey(0, 2) }; MurtyNode node = new MurtyNode(forced, eliminated); node.Assignment = new int[5] { 0, 1, 2, 3, 4 }; Console.WriteLine("parent___"); Console.WriteLine(node); Console.WriteLine(""); MurtyNode[] children = node.Children; MurtyNode[] expected = { new MurtyNode(new MatrixKey[] { new MatrixKey(1, 1) }, new MatrixKey[] { new MatrixKey(0, 2), new MatrixKey(0, 0) }), new MurtyNode(new MatrixKey[] { new MatrixKey(1,1), new MatrixKey(0, 0) }, new MatrixKey[] { new MatrixKey(0, 2), new MatrixKey(2, 2) }), new MurtyNode(new MatrixKey[] { new MatrixKey(1,1), new MatrixKey(0, 0), new MatrixKey(2, 2) }, new MatrixKey[] { new MatrixKey(0, 2), new MatrixKey(3, 3) }) }; Assert.AreEqual(expected.Length, children.Length); Console.WriteLine("children___"); Console.WriteLine(string.Join(", ", Array.ConvertAll(children, i => i.ToString()))); foreach (var child in expected) { Assert.Contains(child, children); } }
public void MurtyNodeChildrenNone() { MatrixKey[] forced = { new MatrixKey(0, 0), new MatrixKey(1, 1), new MatrixKey(2, 2), new MatrixKey(3, 3), new MatrixKey(4, 4) }; MatrixKey[] eliminated = { new MatrixKey(1, 2) }; MurtyNode node = new MurtyNode(forced, eliminated); node.Assignment = new int[5] { 0, 1, 2, 3, 4 }; Console.WriteLine("parent___"); Console.WriteLine(node); Console.WriteLine(""); MurtyNode[] children = node.Children; Console.WriteLine("children___"); Console.WriteLine(string.Join(", ", Array.ConvertAll(children, i => i.ToString()))); Assert.AreEqual(0, children.Length); }