# Compare

A **compare assertion** is used to compare 2 values. There is such thing as in this assertion type as comparator - an operation that compares two values. There are several comparator types:

* **equal** - checks if the values are equal;
* **not equal** - checks if the values are not equal;
* **greater** - checks if the current value is greater than the expected one;
* **greater or equal** - checks if the current value is greater than or equal to the expected one;
* **less** - checks if the current value is less than the expected one;
* **less or equal** - checks if the current value is less than or equal to the expected one.

The **compare** assertion interface is as follows:

![The compare assertion interface](https://1914040845-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LYfhIaTTw23Sf3L5jfe%2F-LgrEVNgUqXS1jfYYcE8%2F-LgrGVxEU1ocjiTPcusu%2F7.png?alt=media\&token=831cae9a-2148-4cfc-a831-b85af79487d2)

The following fields are shown in the screenshot:

* **Actual value**;
* **Operator** - the comparator type;
* **Expected value**.

### Error Fixing

The error fixing algorithm depends on the comparator type.

* **equal** -  the current value is assigned to the expected one;
* **not equal** - the comparator type changes to equal;
* **greater** - the comparator type changes to greater or equal and the current value is assigned to the expected one;
* **greater or equal** - the current value is assigned to the expected one;
* **less** - the comparator type changes to less or equal and the current value is assigned to the expected one;
* **less or equal** - the current value is assigned to the expected one.

### File Representation

The assertion has the `compare` type in the file. The type description can be found in the [Assertion file representation](https://docs.testmace.com/master/node-types/assertion-node/..#failovoe-predstavlenie) documentation in the `#/definitions/CompareAssertion` definition.
