public void List_GetItem_WithNegativeIndex_IsRejected()
 {
     var list = new ReadWriteList <int>(new List <int> {
         13
     });
     int result = list[-1];
 }
Exemple #2
0
 protected ChannelWorker(ReadWriteList <AbstractNetowrkChannel> holder, int threadIdx, int threadCount,
                         string name = "default") : base(name)
 {
     _holder      = holder;
     _threadIdx   = threadIdx;
     _threadCount = threadCount;
 }
 public void List_GetItem_WithInvalidIndex_IsRejected()
 {
     var list = new ReadWriteList <int>(new List <int> {
         13
     });
     int result = list[1];
 }
Exemple #4
0
 public Production(INonTerminal leftHandSide, params ISymbol[] rightHandSide)
 {
     Assert.IsNotNull(leftHandSide, nameof(leftHandSide));
     Assert.IsNotNull(rightHandSide, nameof(rightHandSide));
     LeftHandSide = leftHandSide;
     _rightHandSide = new ReadWriteList<ISymbol>(new List<ISymbol>(rightHandSide));
     _hashCode = ComputeHashCode();
 }
            public void List_SetItem_WithNegativeIndex_IsRejected()
            {
                var list = new ReadWriteList <int>(new List <int> {
                    13
                });

                list[-1] = 17;
            }
            public void List_SetItem_WithInvalidIndex_IsRejected()
            {
                var list = new ReadWriteList <int>(new List <int> {
                    13
                });

                list[1] = 17;
            }
            public void ReadWriteList_IsNotReadOnly()
            {
                var list = new ReadWriteList <int>(new List <int> {
                    13
                });

                Assert.IsFalse(list.IsReadOnly, "Read/write lists should not be read-only.");
            }
            public void List_GetItem_WithValidIndex_RetrievesItem()
            {
                var list = new ReadWriteList <int>(new List <int> {
                    13
                });
                int result = list[0];

                Assert.AreEqual(13, result, "Item at valid index should be retrieved.");
            }
            public void List_RemoveAt_WithInvalidIndex_IsRejected()
            {
                var source = new List <int> {
                    13
                };
                var list = new ReadWriteList <int>(source);

                list.RemoveAt(1);
            }
Exemple #10
0
 public Grammar()
 {
     _productions = new ReadWriteList<IProduction>();
     _ignores = new ReadWriteList<ILexerRule>();
     _productionIndex = new Dictionary<INonTerminal, ReadWriteList<IProduction>>();
     _ignoreIndex = new Dictionary<int, ReadWriteList<ILexerRule>>();
     _nullable = new UniqueList<INonTerminal>();
     _reverseLookup = new Dictionary<INonTerminal, UniqueList<IProduction>>();
 }
Exemple #11
0
 public InternalTreeNode(
     IInternalForestNode internalNode,
     IForestDisambiguationAlgorithm stateManager)
 {
     _disambiguationAlgorithm = stateManager;
     _internalNode = internalNode;
     _children = new ReadWriteList<ITreeNode>();
     SetSymbol(_internalNode);
 }
            public void List_Insert_WithInvalidIndex_IsRejected()
            {
                var source = new List <int> {
                    13
                };
                var list = new ReadWriteList <int>(source);

                list.Insert(2, 17);
            }
            public void List_Insert_WithNegativeIndex_IsRejected()
            {
                var source = new List <int> {
                    13
                };
                var list = new ReadWriteList <int>(source);

                list.Insert(-1, 17);
            }
            public void List_CopyTo_NullArray_IsRejected()
            {
                var source = new List <int> {
                    1, 2, 3, 4
                };
                var list = new ReadWriteList <int>(source);

                list.CopyTo(null, 0);
            }
            public void List_IndexOf_WithInvalidItem_DoesNotFindItem()
            {
                var source = new List <int> {
                    13
                };
                var list   = new ReadWriteList <int>(source);
                int result = list.IndexOf(17);

                Assert.AreEqual(-1, result, "Item should not be found.");
            }
            public void List_SupportsGenericEnumerator()
            {
                var source = new List <int> {
                    1, 2, 3, 4
                };
                var        list   = new ReadWriteList <int>(source);
                List <int> result = new List <int>((IEnumerable <int>)list);

                Assert.IsTrue(result.SequenceEqual(new[] { 1, 2, 3, 4 }), "List should enumerate.");
            }
            public void List_CopyTo_TooSmallArray_IsRejected()
            {
                var source = new List <int> {
                    1, 2, 3, 4
                };
                var list = new ReadWriteList <int>(source);

                int[] array = new int[3];
                list.CopyTo(array, 0);
            }
            public void List_CopyToArray_WithInvalidIndex_IsRejected()
            {
                var source = new List <int> {
                    1, 2, 3, 4
                };
                var list = new ReadWriteList <int>(source);

                int[] array = new int[5];
                list.CopyTo(array, 5);
            }
            public void List_Contains_WithInvalidItem_DoesNotFindItem()
            {
                var source = new List <int> {
                    13
                };
                var  list   = new ReadWriteList <int>(source);
                bool result = list.Contains(17);

                Assert.IsFalse(result, "Item should not be found.");
            }
            public void List_Contains_WithValidItem_FindsItem()
            {
                var source = new List <int> {
                    13
                };
                var  list   = new ReadWriteList <int>(source);
                bool result = list.Contains(13);

                Assert.IsTrue(result, "Item should be found.");
            }
            public void List_Clear_ClearsItems()
            {
                var source = new List <int> {
                    13
                };
                var list = new ReadWriteList <int>(source);

                list.Clear();
                Assert.IsTrue(source.SequenceEqual(new int[] { }), "Items should be cleared.");
            }
            public void List_Insert_InsertsItem()
            {
                var source = new List <int> {
                    13
                };
                var list = new ReadWriteList <int>(source);

                list.Insert(0, 17);
                Assert.IsTrue(source.SequenceEqual(new[] { 17, 13 }), "Item should be inserted.");
            }
            public void List_AddItem_AddsItem()
            {
                var source = new List <int> {
                    13
                };
                var list = new ReadWriteList <int>(source);

                list.Add(17);
                Assert.IsTrue(source.SequenceEqual(new [] { 13, 17 }), "Item should be added.");
            }
            public void List_IndexOf_WithValidItem_FindsItem()
            {
                var source = new List <int> {
                    13
                };
                var list   = new ReadWriteList <int>(source);
                int result = list.IndexOf(13);

                Assert.AreEqual(0, result, "Item should be found.");
            }
            public void List_RemoveAt_RemovesItem()
            {
                var source = new List <int> {
                    13
                };
                var list = new ReadWriteList <int>(source);

                list.RemoveAt(0);
                Assert.IsTrue(source.SequenceEqual(new int[] { }), "Item should be removed.");
            }
            public void List_SetItem_WithValidIndex_SetsItem()
            {
                var source = new List <int> {
                    13
                };
                var list = new ReadWriteList <int>(source);

                list[0] = 17;
                Assert.AreEqual(17, source[0], "Item at valid index should be set.");
            }
            public void List_CopyToArray_CopiesSequence()
            {
                var source = new List <int> {
                    1, 2, 3, 4
                };
                var list = new ReadWriteList <int>(source);

                int[] array = new int[5];
                list.CopyTo(array, 1);
                Assert.IsTrue(array.SequenceEqual(new[] { 0, 1, 2, 3, 4 }), "List should copy to an array.");
            }
            public void List_Remove_WithInvalidItem_DoesNotFindItem()
            {
                var source = new List <int> {
                    13
                };
                var  list   = new ReadWriteList <int>(source);
                bool result = list.Remove(17);

                Assert.IsFalse(result, "Item should not be found.");
                Assert.IsTrue(source.SequenceEqual(new[] { 13 }), "Item should not be removed.");
            }
            public void List_Remove_WithValidItem_RemovesItem()
            {
                var source = new List <int> {
                    13
                };
                var  list   = new ReadWriteList <int>(source);
                bool result = list.Remove(13);

                Assert.IsTrue(result, "Item should be found.");
                Assert.IsTrue(source.SequenceEqual(new int[] { }), "Item should be removed.");
            }
Exemple #30
0
 public VirtualNode(
     int location, 
     ITransitionState transitionState, 
     INode completedParseNode)
 {
     _transitionState = transitionState;
     _completedParseNode = completedParseNode;
     _children = new ReadWriteList<IAndNode>();
     Location = location;
     Initialize(transitionState);
 }
            public void List_SupportsOldEnumerator()
            {
                var source = new List <int> {
                    1, 2, 3, 4
                };
                var        list       = new ReadWriteList <int>(source);
                List <int> result     = new List <int>();
                var        enumerator = (list as System.Collections.IEnumerable).GetEnumerator();

                while (enumerator.MoveNext())
                {
                    result.Add((int)enumerator.Current);
                }

                Assert.IsTrue(result.SequenceEqual(new[] { 1, 2, 3, 4 }), "List should enumerate.");
            }
Exemple #32
0
 public FakeAndForestNode(params IForestNode[] children)
 {
     _children = new ReadWriteList<IForestNode>(children);
 }
Exemple #33
0
 public Chart()
 {
     _earleySets = new ReadWriteList<IEarleySet>();
 }
Exemple #34
0
 public AndForestNode()
 {
     _children = new ReadWriteList<IForestNode>();
 }
Exemple #35
0
 public SerializeAndDeserializeThread(ReadWriteList <AbstractNetowrkChannel> holder, int threadIdx, int threadCount, string name) : base(holder, threadIdx, threadCount, name)
 {
 }
Exemple #36
0
 public DfaState(bool isFinal)
 {
     IsFinal = isFinal;
     _transitions = new ReadWriteList<IDfaTransition>();
 }
 protected InternalForestNode(int origin, int location)
     : base(origin, location)
 {
     _children = new ReadWriteList<IAndForestNode>();
 }
 public SerializeThread(ReadWriteList <AbstractNetowrkChannel> holder, int threadIdx, int threadCount) : base(holder, threadIdx, threadCount)
 {
 }
Exemple #39
0
 public AndNode()
 {
     _children = new ReadWriteList<INode>();
 }
Exemple #40
0
 public NfaState()
 {
     _transitions = new ReadWriteList<INfaTransition>();
 }
Exemple #41
0
 protected InternalNode(int origin, int location)
 {
     Origin = origin;
     Location = location;
     _children = new ReadWriteList<IAndNode>();
 }
 public InternalTreeNodeImpl(int origin, int location, INonTerminal symbol)
     : base(origin, location, TreeNodeType.Internal)
 {
     Symbol = symbol;
     ReadWriteChildren = new ReadWriteList<ITreeNode>();
 }
 protected FakeInternalForestNode(int origin, int location, params IAndForestNode[] children)
 {
     Origin = origin;
     Location = location;
     _children = new ReadWriteList<IAndForestNode>(children);
 }