Skip to main content

to_equal

Method of AlephExpectation.

Overloads

NameDescription
to_equal(const Object expected, const Map options) -> voidRecords a failure unless the actual value equals the expected value.
to_equal(const bool expected, const Map options) -> voidRecords a failure unless the actual value equals the expected value.
to_equal(const real expected, const Map options) -> voidRecords a failure unless the actual value equals the expected value.
to_equal(const integer expected, const Map options) -> voidRecords a failure unless the actual value equals the expected value.
to_equal(const Object expected) -> voidRecords a failure unless the actual value equals the expected value.
to_equal(const string expected, const Map options) -> voidRecords a failure unless the actual value equals the expected value.
to_equal(const complex expected, const Map options) -> voidRecords a failure unless the actual value equals the expected value.

to_equal(const Object expected, const Map options) -> void

Records a failure unless the actual value equals the expected value.

By default, numeric and complex values use tolerant equality. Pass strict: true to force exact Aleph equality, or pass tolerance options for a single expectation.

Parameters

  • expected: The value to compare against.
  • options: Optional matcher options.
    • message (String): Custom failure message to record when the matcher fails.
    • stop (Bool): Stops collecting further expectations in the current test when this matcher fails.
    • strict (Bool): Use Aleph equality exactly, without numeric tolerance handling.
    • abs_tolerance (Real): Absolute tolerance for numeric and complex equality.
    • rel_tolerance (Real): Relative tolerance for numeric and complex equality.

Returns

Nothing. Failed expectations are collected in the active test result.

Example


expect(pi).to_equal(3.14159, ["abs_tolerance": 1e-5])

to_equal(const bool expected, const Map options) -> void

Records a failure unless the actual value equals the expected value.

By default, numeric and complex values use tolerant equality. Pass strict: true to force exact Aleph equality, or pass tolerance options for a single expectation.

Parameters

  • expected: The value to compare against.
  • options: Optional matcher options.
    • message (String): Custom failure message to record when the matcher fails.
    • stop (Bool): Stops collecting further expectations in the current test when this matcher fails.
    • strict (Bool): Use Aleph equality exactly, without numeric tolerance handling.
    • abs_tolerance (Real): Absolute tolerance for numeric and complex equality.
    • rel_tolerance (Real): Relative tolerance for numeric and complex equality.

Returns

Nothing. Failed expectations are collected in the active test result.

Example


expect(pi).to_equal(3.14159, ["abs_tolerance": 1e-5])

to_equal(const real expected, const Map options) -> void

Records a failure unless the actual value equals the expected value.

By default, numeric and complex values use tolerant equality. Pass strict: true to force exact Aleph equality, or pass tolerance options for a single expectation.

Parameters

  • expected: The value to compare against.
  • options: Optional matcher options.
    • message (String): Custom failure message to record when the matcher fails.
    • stop (Bool): Stops collecting further expectations in the current test when this matcher fails.
    • strict (Bool): Use Aleph equality exactly, without numeric tolerance handling.
    • abs_tolerance (Real): Absolute tolerance for numeric and complex equality.
    • rel_tolerance (Real): Relative tolerance for numeric and complex equality.

Returns

Nothing. Failed expectations are collected in the active test result.

Example


expect(pi).to_equal(3.14159, ["abs_tolerance": 1e-5])

to_equal(const integer expected, const Map options) -> void

Records a failure unless the actual value equals the expected value.

By default, numeric and complex values use tolerant equality. Pass strict: true to force exact Aleph equality, or pass tolerance options for a single expectation.

Parameters

  • expected: The value to compare against.
  • options: Optional matcher options.
    • message (String): Custom failure message to record when the matcher fails.
    • stop (Bool): Stops collecting further expectations in the current test when this matcher fails.
    • strict (Bool): Use Aleph equality exactly, without numeric tolerance handling.
    • abs_tolerance (Real): Absolute tolerance for numeric and complex equality.
    • rel_tolerance (Real): Relative tolerance for numeric and complex equality.

Returns

Nothing. Failed expectations are collected in the active test result.

Example


expect(pi).to_equal(3.14159, ["abs_tolerance": 1e-5])

to_equal(const Object expected) -> void

Records a failure unless the actual value equals the expected value.

By default, numeric and complex values use tolerant equality. Pass strict: true to force exact Aleph equality, or pass tolerance options for a single expectation.

Parameters

  • expected: The value to compare against.

Returns

Nothing. Failed expectations are collected in the active test result.

Example


expect(2 + 2).to_equal(4)

to_equal(const string expected, const Map options) -> void

Records a failure unless the actual value equals the expected value.

By default, numeric and complex values use tolerant equality. Pass strict: true to force exact Aleph equality, or pass tolerance options for a single expectation.

Parameters

  • expected: The value to compare against.
  • options: Optional matcher options.
    • message (String): Custom failure message to record when the matcher fails.
    • stop (Bool): Stops collecting further expectations in the current test when this matcher fails.
    • strict (Bool): Use Aleph equality exactly, without numeric tolerance handling.
    • abs_tolerance (Real): Absolute tolerance for numeric and complex equality.
    • rel_tolerance (Real): Relative tolerance for numeric and complex equality.

Returns

Nothing. Failed expectations are collected in the active test result.

Example


expect(pi).to_equal(3.14159, ["abs_tolerance": 1e-5])

to_equal(const complex expected, const Map options) -> void

Records a failure unless the actual value equals the expected value.

By default, numeric and complex values use tolerant equality. Pass strict: true to force exact Aleph equality, or pass tolerance options for a single expectation.

Parameters

  • expected: The value to compare against.
  • options: Optional matcher options.
    • message (String): Custom failure message to record when the matcher fails.
    • stop (Bool): Stops collecting further expectations in the current test when this matcher fails.
    • strict (Bool): Use Aleph equality exactly, without numeric tolerance handling.
    • abs_tolerance (Real): Absolute tolerance for numeric and complex equality.
    • rel_tolerance (Real): Relative tolerance for numeric and complex equality.

Returns

Nothing. Failed expectations are collected in the active test result.

Example


expect(pi).to_equal(3.14159, ["abs_tolerance": 1e-5])