コード例 #1
0
    public void ObjectEquals_AlwaysThrows()
    {
        var array0 = new ResizableArray64Byte <int>();
        var array1 = new ResizableArray64Byte <int>();

        Assert.Throws <InvalidOperationException>(() => array0.Equals(array1));
    }
コード例 #2
0
    public void ArrayEquals_OnlyTestsLengthBytes()
    {
        var array0 = new ResizableArray64Byte <long>();

        array0.Add(20);
        array0.Add(30);
        --array0.Length;
        var array1 = new ResizableArray64Byte <long>();

        array1.Add(20);

        Assert.IsTrue(array0.Equals(ref array1));
    }
コード例 #3
0
        // this is a specialized function intended only for validation that builders are hashing and getting cached
        // correctly without unexpected collisions. "Equals" is hard to truly validate because the type may not
        // fully be constructed yet due to ForEach not getting called yet.
        internal bool ShallowEquals(ref EntityQueryBuilder other)
        {
            #if ENABLE_UNITY_COLLECTIONS_CHECKS
            if (!ReferenceEquals(m_System, other.m_System))
            {
                throw new InvalidOperationException($"Suspicious comparison of {nameof(EntityQueryBuilder)}s with different {nameof(ComponentSystem)}s");
            }
            #endif

            return
                (m_Any.Equals(ref other.m_Any) &&
                 m_None.Equals(ref other.m_None) &&
                 m_All.Equals(ref other.m_All) &&
                 ReferenceEquals(m_Query, other.m_Query));
        }