docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method AreEqual

    AreEqual<T>(T, T)

    Assert that two values are exactly equal to each other, according to their type's definition of equality. Throws an exception if the assertion fails.

    Declaration
    [Conditional("UNITY_ASSERTIONS")]
    public static void AreEqual<T>(T expected, T actual) where T : IEquatable<T>
    Parameters
    Type Name Description
    T expected

    The expected value.

    T actual

    The actual value.

    Type Parameters
    Name Description
    T

    The type of the values to test.

    AreEqual<T>(T, T, string)

    Assert that two values are exactly equal to each other, according to their type's definition of equality. Throws an exception if the assertion fails.

    Declaration
    [Conditional("UNITY_ASSERTIONS")]
    public static void AreEqual<T>(T expected, T actual, string message) where T : IEquatable<T>
    Parameters
    Type Name Description
    T expected

    The expected value.

    T actual

    The actual value.

    string message

    If the assertion fails, this message will be logged.

    Type Parameters
    Name Description
    T

    The type of the values to test.

    AreEqual(int, int)

    Assert that two 32-bit integer values are equal to each other. Throws an exception if the assertion fails.

    Declaration
    [Conditional("UNITY_ASSERTIONS")]
    public static void AreEqual(int expected, int actual)
    Parameters
    Type Name Description
    int expected

    The expected value.

    int actual

    The actual value.

    AreEqual(bool, bool)

    Assert that two boolean values are equal to each other. Throws an exception if the assertion fails.

    Declaration
    [Conditional("UNITY_ASSERTIONS")]
    public static void AreEqual(bool expected, bool actual)
    Parameters
    Type Name Description
    bool expected

    The expected value.

    bool actual

    The actual value.

    AreEqual(Type, Type)

    Assert that two boolean values are not equal to each other. Throws an exception if the assertion fails.

    Declaration
    [Conditional("UNITY_ASSERTIONS")]
    public static void AreEqual(Type expected, Type actual)
    Parameters
    Type Name Description
    Type expected

    The expected value.

    Type actual

    The actual value.

    AreEqual(IntPtr, IntPtr)

    Assert that two IntPtr values are equal to each other. Throws an exception if the assertion fails.

    Declaration
    [Conditional("UNITY_ASSERTIONS")]
    public static void AreEqual(IntPtr expected, IntPtr actual)
    Parameters
    Type Name Description
    IntPtr expected

    The expected value.

    IntPtr actual

    The actual value.

    In This Article
    • AreEqual<T>(T, T)
    • AreEqual<T>(T, T, string)
    • AreEqual(int, int)
    • AreEqual(bool, bool)
    • AreEqual(Type, Type)
    • AreEqual(IntPtr, IntPtr)
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)