---
title: XCTAssertEqual
framework: xctest
role: symbol
role_heading: Macro
path: xctest/xctassertequal
---

# XCTAssertEqual

Asserts that two expressions have the same value.

## Declaration

```occ
#define XCTAssertEqual(expression1, expression2, ...)
```

## Parameters

- `expression1`: An expression of C scalar type.
- `expression2`: A second expression of C scalar type.
- `…`: An optional description of a failure. A literal doc://com.apple.documentation/documentation/Foundation/NSString, optionally with string format specifiers.

## Mentioned in

Defining Test Cases and Test Methods

## Discussion

Discussion Generates a failure when expression1 != expression2.

## See Also

### Tests for Equality and Inequality

- [XCTAssertEqualObjects](xctest/xctassertequalobjects.md)
- [XCTAssertNotEqual](xctest/xctassertnotequal.md)
- [XCTAssertNotEqualObjects](xctest/xctassertnotequalobjects.md)
