コード例 #1
0
        public void Test3(string tree)
        {
            // Arrange
            var at = new Algorithm.Tree.Problems.TreeCodec(',', '$');

            // Act
            var treeNode = at.Deserialize(tree);
            var treeStr  = at.Serialize2(treeNode);

            // Assert
            Assert.AreEqual(treeStr, tree);
        }
コード例 #2
0
        public void Test(List <int?> tree)
        {
            // Arrange
            var at = new Algorithm.Tree.Problems.TreeCodec();

            // Act
            var treeNode = at.Deserialize(tree);
            var treeList = at.SerializeToList(treeNode);

            // Assert
            CollectionAssert.AreEqual(treeList, tree);
        }
コード例 #3
0
        public void Test(string tree, IList <IList <int> > expected)
        {
            // Arrange
            var at       = new Algorithm.Tree.Problems.TreeCodec(',', '$');
            var treeNode = at.Deserialize(tree);
            var prob     = new Algorithm.Tree.Problems.VerticalOrderTraversal();

            // Act
            var result = prob.VerticalOrder(treeNode);

            // Assert
            CollectionAssert.AreEquivalent(expected, result);
        }