예제 #1
0
 public void AddWorks()
 {
     _myArray = default;
     _myArray.Add(77);
     _myArray.Add(78);
     Assert.Equal(2, _myArray.Count);
     Assert.Equal(77, _myArray[0]);
     Assert.Equal(78, _myArray[1]);
 }
예제 #2
0
        public void ContainsWorks()
        {
            _myArray = default;
#pragma warning disable xUnit2017 // Do not use Contains() to check if a value exists in a collection
            Assert.False(_myArray.Contains(11));
            _myArray.Add(12);
            _myArray.Add(13);
            Assert.True(_myArray.Contains(13));
#pragma warning restore xUnit2017 // Do not use Contains() to check if a value exists in a collection
        }
예제 #3
0
        public unsafe void LargerTypeWorks()
        {
            var arr = new ValueArray <Int64>();

            Assert.True(sizeof(ValueArray <Int64>) > sizeof(Int64) * ValueArray <Int64> .MaximumSize);
            arr.Add(8589934591);
            arr.Add(0);
            arr.Insert(0, 1234567890);
            Assert.Equal(8589934591, arr[1]);
        }
예제 #4
0
        public void CanCopyToArray()
        {
            _myArray = default;
            _myArray.Add(10);
            _myArray.Add(20);

            var bytearr = new byte[2];

            _myArray.CopyTo(bytearr, 0);
            Assert.Equal(10, bytearr[0]);
            Assert.Equal(20, bytearr[1]);
        }
예제 #5
0
 /// <summary>
 /// Add an entry to the value array only if it is an array type
 /// </summary>
 /// <param name="value"></param>
 public void AddToArray(VariableValue value)
 {
     if (ValueType == ValueDataType.ArrayType)
     {
         ValueArray.Add(value);
     }
 }
예제 #6
0
        public void RemoveWorks()
        {
            _myArray = default;
            _myArray.Add(1);
            Assert.Single(_myArray);

            _myArray.Remove(1);
            Assert.Empty(_myArray);
        }
예제 #7
0
 public int AddConstant(Value v)
 {
     return(constants.Add(v));
 }