<!--
{
  "availability" : [
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSSpecifierTest/TestComparisonOperation",
  "metadataVersion" : "0.1.0",
  "role" : "Enumeration",
  "symbol" : {
    "kind" : "Enumeration",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:@E@NSTestComparisonOperation"
  },
  "title" : "NSSpecifierTest.TestComparisonOperation"
}
-->

# NSSpecifierTest.TestComparisonOperation

These are passed to  [`init(objectSpecifier:comparisonOperator:test:)`](/documentation/Foundation/NSSpecifierTest/init(objectSpecifier:comparisonOperator:test:)) to specify the comparison operator.

```
enum TestComparisonOperation
```

## Topics

### Constants

[`NSEqualToComparison`](/documentation/Foundation/NSSpecifierTest/TestComparisonOperation/equal)

Binary comparison operator that results in true if the two objects are equal.

[`NSLessThanOrEqualToComparison`](/documentation/Foundation/NSSpecifierTest/TestComparisonOperation/lessThanOrEqual)

Binary comparison operator that results in true if the value of the test object is equal to or less than the value of the other object.

[`NSLessThanComparison`](/documentation/Foundation/NSSpecifierTest/TestComparisonOperation/lessThan)

Binary comparison operator that results in true if the value of the test object is less than the value of the other object.

[`NSGreaterThanOrEqualToComparison`](/documentation/Foundation/NSSpecifierTest/TestComparisonOperation/greaterThanOrEqual)

Binary comparison operator that results in true if the value of the test object is greater than or equal to the value of the other object.

[`NSGreaterThanComparison`](/documentation/Foundation/NSSpecifierTest/TestComparisonOperation/greaterThan)

Binary comparison operator that results in true if the value of the test object is greater than the value of the other object.

[`NSBeginsWithComparison`](/documentation/Foundation/NSSpecifierTest/TestComparisonOperation/beginsWith)

Binary containment operator that results in true if the test object is a list or string that matches the beginning of the other object (which is also a list or string).

[`NSEndsWithComparison`](/documentation/Foundation/NSSpecifierTest/TestComparisonOperation/endsWith)

Binary containment operator that results in true if the test object is a list or string that matches the end of the other object (which is also a list or string).

[`NSContainsComparison`](/documentation/Foundation/NSSpecifierTest/TestComparisonOperation/contains)

Binary containment operator that results in true if the test object is a list or string that matches the other object (which is also a list or string) at any location.

## Relationships

### Conforms To

[`Sendable`](/documentation/Swift/Sendable)

[`Hashable`](/documentation/Swift/Hashable)

[`BitwiseCopyable`](/documentation/Swift/BitwiseCopyable)

[`Equatable`](/documentation/Swift/Equatable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`RawRepresentable`](/documentation/Swift/RawRepresentable)

---

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)