.. index:: assertions(Mode)
.. _assertions/1:

.. rst-class:: right

**object**

``assertions(Mode)``
====================

A simple assertions framework. Can be used as a hook object for either suppressing assertions (``production`` mode) or expanding them with file context information (``debug`` mode).

| **Author:** Paulo Moura
| **Version:** 2:2:2
| **Date:** 2022-07-04

| **Compilation flags:**
|    ``static, context_switching_calls``


| **Implements:**
|    ``public`` :ref:`expanding <expanding/0>`
| **Uses:**
|    :ref:`logtalk <logtalk/0>`

| **Remarks:**
|    (none)

| **Inherited public predicates:**
|     :ref:`expanding/0::goal_expansion/2`  :ref:`expanding/0::term_expansion/2`  

.. contents::
   :local:
   :backlinks: top

Public predicates
-----------------

.. index:: assertion/1
.. _assertions/1::assertion/1:

``assertion/1``
^^^^^^^^^^^^^^^

Checks that an assertion is true. Uses the structured message printing mechanism for printing the results using a silent message for assertion success and a error message for assertion failure.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``assertion(Goal)``
| **Meta-predicate template:**
|    ``assertion(0)``
| **Mode and number of proofs:**
|    ``assertion(@callable)`` - ``one``


------------

.. index:: assertion/2
.. _assertions/1::assertion/2:

``assertion/2``
^^^^^^^^^^^^^^^

Checks that an assertion is true. Uses the structured message printing mechanism for printing the results using a silent message for assertion success and a error message for assertion failure. The context argument can be used to e.g. pass location data.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``assertion(Context,Goal)``
| **Meta-predicate template:**
|    ``assertion(*,0)``
| **Mode and number of proofs:**
|    ``assertion(@term,@callable)`` - ``one``


------------

Protected predicates
--------------------

(no local declarations; see entity ancestors if any)

Private predicates
------------------

(no local declarations; see entity ancestors if any)

Operators
---------

(none)

