Example #1
0
        public void With()
        {
            RedNode <int> a = RedNode <int> .Create(0)
                              .With(1);

            Assert.AreEqual(1, a.Value);
        }
Example #2
0
        public void Removal()
        {
            var node = RedNode <int> .Create(0)
                       .Insert(0, 1)
                       .WithoutAt(0);

            Assert.AreEqual(0, node.Elements.Count);
        }
Example #3
0
        public void TransitiveIdentityEquality()
        {
            var parent = RedNode <int> .Create(0).Insert(0, 1);

            var child1 = parent.Elements[0];
            var child2 = child1.Parent.Elements[0];

            Assert.IsTrue(ReferenceEquals(child1, child2));
        }
Example #4
0
        public void Insertion()
        {
            var parent = RedNode <int> .Create(0).Insert(0, 1);

            var child = parent.Elements[0];

            Assert.AreEqual(0, parent.Value);
            Assert.AreEqual(1, child.Value);
        }
Example #5
0
        public void Parenting()
        {
            RedNode <int> child = RedNode <int> .Create(0).WithParent(1);

            var parent = child.Parent;

            Assert.AreEqual(1, parent.Elements.Count);
            Assert.AreEqual(1, parent.Value);
            Assert.AreEqual(0, parent.Elements[0].Value);
        }
Example #6
0
        /// <summary>
        /// Concrete implementation of the abstract method, switching the type(the color) of the node.
        /// </summary>
        /// <returns>A new node from type RedNode()</returns>
        public override INode Update()
        {
            var newNode = new RedNode();

            foreach (var neig in this.Neighbours)
            {
                newNode.Neighbours.Add(neig);
            }

            return(newNode);
        }
Example #7
0
        public void RootDoesntHaveParentTest()
        {
            RedNode <int> node = RedNode <int> .Create(0);

            Assert.IsNull(node.Parent);
        }
Example #8
0
        public void CreationTest()
        {
            RedNode <int> node = RedNode <int> .Create(0);

            Assert.AreEqual(0, node.Value);
        }
Example #9
0
 internal abstract RedNode CreateRedNode(RedNode parent, int position);
Example #10
0
 internal CompilationUnitSyntax(InternalSyntax.SyntaxNode green, RedNode parent, int position) : base(green, parent, position)
 {
 }
Example #11
0
 internal override RedNode CreateRedNode(RedNode parent, int position)
 {
     return(new SlothCodeAnalysis.Syntax.CompilationUnitSyntax(this, parent, position));
 }
Example #12
0
 internal override RedNode CreateRedNode(RedNode parent, int position)
 {
     return(new SlothCodeAnalysis.Syntax.LiteralExpressionSyntax(this, parent, position));
 }
Example #13
0
 internal override RedNode CreateRedNode(RedNode parent, int position)
 {
     return(new SlothCodeAnalysis.Syntax.VariableDeclarationSyntax(this, parent, position));
 }
Example #14
0
 internal VariableDeclarationSyntax(InternalSyntax.SyntaxNode green, RedNode parent, int position) : base(green, parent, position)
 {
 }
Example #15
0
 internal BinaryExpressionSyntax(InternalSyntax.SyntaxNode green, RedNode parent, int position) : base(green, parent, position)
 {
 }
Example #16
0
 internal StatementSyntax(InternalSyntax.SyntaxNode green, RedNode parent, int position) : base(green, parent, position)
 {
 }
Example #17
0
 internal override RedNode CreateRedNode(RedNode parent, int position)
 {
     return(new SlothCodeAnalysis.Syntax.IdentifierNameSyntax(this, parent, position));
 }
Example #18
0
 internal override RedNode CreateRedNode(RedNode parent, int position)
 {
     return(new SlothCodeAnalysis.Syntax.SyntaxList(this, parent, position));
 }
Example #19
0
 internal override RedNode CreateRedNode(RedNode parent, int position)
 {
     throw ExceptionUtilities.Unreachable;
 }
Example #20
0
 internal IdentifierNameSyntax(InternalSyntax.SyntaxNode green, RedNode parent, int position) : base(green, parent, position)
 {
 }