> ## Documentation Index
> Fetch the complete documentation index at: https://solana.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> This page is part of the Solana developer documentation at https://solana.com/developers/docs. Append `.md` to any docs URL, or send `Accept: text/markdown`, to get the page as Markdown.
> Index of all pages: https://solana.com/llms.txt. Per-section indexes such as https://solana.com/developers/docs/payments/llms.txt are smaller; prefer them when working on one task.
> Coding agents: install the official Solana skill for current APIs and conventions with `npx skills add https://github.com/solana-foundation/solana-dev-skill` (also served at https://solana.com/SKILL.md).
> Code in the cookbook and task pages comes from tested example files. Prefer it over writing API calls from memory.

# Assertion Functions

> Standard library functions for testing and assertions

<Note>
  Assertion outputs are serialized as a hex-encoded JSON string. A passing
  assertion is `0x225375636365737322`, the hex of `"Success"`. A failing one is
  the hex of `{"Failure":"assertion failed: ..."}`. Assertions are normally used
  inside `pre_condition` and `post_condition` blocks rather than printed as
  outputs.
</Note>

## assert_eq

`assert_eq` asserts that two values are equal.

### Inputs

| Name    | Type | Description                  |
| ------- | ---- | ---------------------------- |
| `left`  | any  | A value to compare           |
| `right` | any  | The value to compare against |

### Output

| Name    | Type                  | Description                 |
| ------- | --------------------- | --------------------------- |
| `value` | addon(std::assertion) | The result of the assertion |

```hcl
output "assertion" {
    value = std::assert_eq(action.example.result, 1)
}
```

---

## assert_ne

`assert_ne` asserts that two values are not equal.

### Inputs

| Name    | Type | Description                  |
| ------- | ---- | ---------------------------- |
| `left`  | any  | A value to compare           |
| `right` | any  | The value to compare against |

### Output

| Name    | Type                  | Description                 |
| ------- | --------------------- | --------------------------- |
| `value` | addon(std::assertion) | The result of the assertion |

```hcl
output "assertion" {
    value = std::assert_ne(action.example.result, 1)
}
```

---

## assert_gt

`assert_gt` asserts that the left value is greater than the right value.

### Inputs

| Name    | Type             | Description                            |
| ------- | ---------------- | -------------------------------------- |
| `left`  | integer \| float | An integer or float to compare         |
| `right` | integer \| float | An integer or float to compare against |

### Output

| Name    | Type                  | Description                 |
| ------- | --------------------- | --------------------------- |
| `value` | addon(std::assertion) | The result of the assertion |

```hcl
output "assertion" {
    value = std::assert_gt(action.example.result, 1)
}
```

---

## assert_gte

`assert_gte` asserts that the left value is greater than or equal to the right
value.

### Inputs

| Name    | Type             | Description                            |
| ------- | ---------------- | -------------------------------------- |
| `left`  | integer \| float | An integer or float to compare         |
| `right` | integer \| float | An integer or float to compare against |

### Output

| Name    | Type                  | Description                 |
| ------- | --------------------- | --------------------------- |
| `value` | addon(std::assertion) | The result of the assertion |

```hcl
output "assertion" {
    value = std::assert_gte(action.example.result, 1)
}
```

---

## assert_lt

`assert_lt` asserts that the left value is less than the right value.

### Inputs

| Name    | Type             | Description                            |
| ------- | ---------------- | -------------------------------------- |
| `left`  | integer \| float | An integer or float to compare         |
| `right` | integer \| float | An integer or float to compare against |

### Output

| Name    | Type                  | Description                 |
| ------- | --------------------- | --------------------------- |
| `value` | addon(std::assertion) | The result of the assertion |

```hcl
output "assertion" {
    value = std::assert_lt(action.example.result, 1)
}
```

---

## assert_lte

`assert_lte` asserts that the left value is less than or equal to the right
value.

### Inputs

| Name    | Type             | Description                            |
| ------- | ---------------- | -------------------------------------- |
| `left`  | integer \| float | An integer or float to compare         |
| `right` | integer \| float | An integer or float to compare against |

### Output

| Name    | Type                  | Description                 |
| ------- | --------------------- | --------------------------- |
| `value` | addon(std::assertion) | The result of the assertion |

```hcl
output "assertion" {
    value = std::assert_lte(action.example.result, 1)
}
```
