Пример #1
0
        private void AssertCopyOf(int[] expected, int[] array, int newLength)
        {
            var copy = Arrays4.CopyOf(array, newLength);

            Assert.AreNotSame(array, copy);
            ArrayAssert.AreEqual(expected, copy);
        }
Пример #2
0
 public bool ContainsTheSame(Db4objects.Db4o.Internal.ByteArrayBuffer other)
 {
     if (other != null)
     {
         return(Arrays4.Equals(_buffer, other._buffer));
     }
     return(false);
 }
Пример #3
0
 public bool ContainsTheSame(ByteArrayBuffer other)
 {
     if (other != null)
     {
         return(Arrays4.Equals(_buffer, other._buffer));
     }
     return(false);
 }
Пример #4
0
 public static void ContainsByEquality(object[] array, object[] expected)
 {
     for (int i = 0; i < expected.Length; i++)
     {
         if (-1 == Arrays4.IndexOfEquals(array, expected[i]))
         {
             Assert.Fail("Expecting contains '" + expected[i] + "'.");
         }
     }
 }
Пример #5
0
 public virtual void TestContainsInstanceOf()
 {
     object[] array = new object[] { "foo", 42 };
     Assert.IsTrue(Arrays4.ContainsInstanceOf(array, typeof(string)));
     Assert.IsTrue(Arrays4.ContainsInstanceOf(array, typeof(int)));
     Assert.IsTrue(Arrays4.ContainsInstanceOf(array, typeof(object)));
     Assert.IsFalse(Arrays4.ContainsInstanceOf(array, typeof(float)));
     Assert.IsFalse(Arrays4.ContainsInstanceOf(new object[0], typeof(object)));
     Assert.IsFalse(Arrays4.ContainsInstanceOf(new object[1], typeof(object)));
     Assert.IsFalse(Arrays4.ContainsInstanceOf(null, typeof(object)));
 }
Пример #6
0
            private static ITest[] Tests(IntByRef counter, int numTests, int[] failingIndices
                                         )
            {
                var tests = new ITest[numTests];

                for (var i = 0; i < numTests; i++)
                {
                    tests[i] = new CountingTest(counter, i + 1, Arrays4.IndexOf
                                                    (failingIndices, i) >= 0);
                }
                return(tests);
            }
Пример #7
0
 public override bool Equals(object obj)
 {
     if (this == obj)
     {
         return(true);
     }
     if (!(obj is Db4objects.Drs.Foundation.Signature))
     {
         return(false);
     }
     Db4objects.Drs.Foundation.Signature other = (Db4objects.Drs.Foundation.Signature)
                                                 obj;
     return(Arrays4.Equals(bytes, other.bytes));
 }
Пример #8
0
 /// <summary>comparison by signature.</summary>
 /// <remarks>comparison by signature.</remarks>
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj == null || this.GetType() != obj.GetType())
     {
         return(false);
     }
     Db4objects.Db4o.Ext.Db4oDatabase other = (Db4objects.Db4o.Ext.Db4oDatabase)obj;
     if (null == other.i_signature || null == this.i_signature)
     {
         return(false);
     }
     return(Arrays4.Equals(other.i_signature, this.i_signature));
 }
Пример #9
0
 private void ImplicitlyAndJoinsOnSameField()
 {
     object[] nodes = _nodes.ToArray();
     for (int i = 0; i < nodes.Length; i++)
     {
         object node = nodes[i];
         if (node is OrIndexedLeaf)
         {
             OrIndexedLeaf current = (OrIndexedLeaf)node;
             OrIndexedLeaf other   = FindJoinOnSameFieldAtSameLevel(current);
             if (null != other)
             {
                 nodes[Arrays4.IndexOfIdentity(nodes, other)] = null;
                 CollectImplicitAnd(current.GetConstraint(), current, other);
             }
         }
     }
 }
Пример #10
0
        protected HardObjectReference GetHardObjectReferenceById(Transaction transaction,
                                                                 int parentId, byte[] signature)
        {
            HardObjectReference hardRef = transaction.Container().GetHardObjectReferenceById(
                transaction, parentId);

            if (hardRef._reference == null)
            {
                return(null);
            }
            VirtualAttributes vad = hardRef._reference.VirtualAttributes(transaction, false);

            if (!Arrays4.Equals(signature, vad.i_database.i_signature))
            {
                return(null);
            }
            return(hardRef);
        }
Пример #11
0
 public virtual void ConcurrentTimestamps(IList concurrentTimestamps)
 {
     _concurrentTimestamps = Arrays4.ToLongArray(concurrentTimestamps);
 }
 private static ITest[] Tests(IntByRef counter, int numTests, int[] failingIndices
                              )
 {
     ITest[] tests = new ITest[numTests];
     for (int i = 0; i < numTests; i++)
     {
         tests[i] = new OpaqueTestSuiteTestCase.CountingTest(counter, i + 1, Arrays4.IndexOf
                                                                 (failingIndices, i) >= 0);
     }
     return(tests);
 }