<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "XCTest",
  "identifier" : "/documentation/XCTest/XCTAssertLessThanOrEqual(_:_:_:file:line:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "XCTest"
    ],
    "preciseIdentifier" : "s:6XCTest24XCTAssertLessThanOrEqual___4file4lineyxyKXK_xyKXKSSyXKs12StaticStringVSutSLRzlF"
  },
  "title" : "XCTAssertLessThanOrEqual(_:_:_:file:line:)"
}
-->

# XCTAssertLessThanOrEqual(_:_:_:file:line:)

Asserts that the value of the first expression is less than or equal to the value of the second expression.

```
func XCTAssertLessThanOrEqual<T>(_ expression1: @autoclosure () throws -> T, _ expression2: @autoclosure () throws -> T, _ message: @autoclosure () -> String = "", file: StaticString = #filePath, line: UInt = #line) where T : Comparable
```

## Parameters

`expression1`

An expression of type `T`, where `T` is <doc://com.apple.documentation/documentation/Swift/Comparable>.

`expression2`

A second expression of type `T`, where `T` is <doc://com.apple.documentation/documentation/Swift/Comparable>.

`message`

An optional description of a failure.

`file`

The file where the failure occurs. The default is the filename of the test case where you call this function.

`line`

The line number where the failure occurs. The default is the line number where you call this function.

## Discussion

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)