---
title: "assertIsEqualTo"
description: "Asserts that this value is equal to the given [expected] value.

Performs the comparison with the given [tolerance] or the default one if none is provided. It is
recommended to use tolerance when comparing positions and size coming from the framework as there
can be rounding operation performed by individual layouts so the values can be slightly off from
the expected ones."
type: "function"
---

<div class='type'>Function</div>


<a id='references'></a>
<div class='sourceset sourceset-common'>Common</div>


```kotlin
fun Dp.assertIsEqualTo(expected: Dp, subject: String, tolerance: Dp = Dp(.5f))
```


Asserts that this value is equal to the given `expected` value.

Performs the comparison with the given `tolerance` or the default one if none is provided. It is
recommended to use tolerance when comparing positions and size coming from the framework as there
can be rounding operation performed by individual layouts so the values can be slightly off from
the expected ones.

#### Parameters

| | |
| --- | --- |
| expected | The expected value to which this one should be equal to. |
| subject | Used in the error message to identify which item this assertion failed on. |
| tolerance | The tolerance within which the values should be treated as equal. |




