<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
<!ENTITY version SYSTEM "version.xml">
]>
<refentry id="cutter-Assertions-with-C++-support">
<refmeta>
<refentrytitle role="top_of_page" id="cutter-Assertions-with-C++-support.top_of_page">Assertions with C++ support</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>CUTTER Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>Assertions with C++ support</refname>
<refpurpose>Checks that your program works as you
expect with C++ support.</refpurpose>
</refnamediv>

<refsect1 id="cutter-Assertions-with-C++-support.functions" role="functions_proto">
<title role="functions_proto.title">Functions</title>
<informaltable pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="functions_return" colwidth="150px"/>
<colspec colname="functions_name"/>
<tbody>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="cppcut-assert-equal">cppcut_assert_equal</link><phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="cppcut-assert-not-equal">cppcut_assert_not_equal</link><phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="cppcut-assert-null">cppcut_assert_null</link><phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="cppcut-assert-not-null">cppcut_assert_not_null</link><phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="cppcut-assert-operator">cppcut_assert_operator</link><phrase role="c_punctuation">()</phrase></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>


<refsect1 id="cutter-Assertions-with-C++-support.description" role="desc">
<title role="desc.title">Description</title>

</refsect1>
<refsect1 id="cutter-Assertions-with-C++-support.functions_details" role="details">
<title role="details.title">Functions</title>
<refsect2 id="cppcut-assert-equal" role="macro" condition="since:1.0.9">
<title>cppcut_assert_equal()</title>
<indexterm zone="cppcut-assert-equal" role="1.0.9"><primary>cppcut_assert_equal</primary></indexterm>
<programlisting language="C">#define             cppcut_assert_equal(expected, actual, ...)</programlisting>
<para>This assertion is a generic method based on template. You
can pass any object's reference as <parameter>expected</parameter>
 and <parameter>actual</parameter>
.</para>
<para>Passes if <parameter>expected</parameter>
 == <parameter>actual</parameter>
.</para>
<para>e.g.:</para>
<informalexample><programlisting><![CDATA[
cppcut_assert_equal(3, 1 + 2);
cppcut_assert_equal(3, 1 + 2, cppcut_message("easy expression"));
cppcut_assert_equal(3, 1 + 2, cppcut_message() << "easy expression"));
]]></programlisting></informalexample>
<para></para>
<refsect3 id="cppcut-assert-equal.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>expected</para></entry>
<entry role="parameter_description"><para>an expected value.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>actual</para></entry>
<entry role="parameter_description"><para>an actual value.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>...</para></entry>
<entry role="parameter_description"><para>an optional message. Use <link linkend="cppcut-message"><function>cppcut_message()</function></link> for this.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-1.0.9">1.0.9</link></para></refsect2>
<refsect2 id="cppcut-assert-not-equal" role="macro" condition="since:1.2.0">
<title>cppcut_assert_not_equal()</title>
<indexterm zone="cppcut-assert-not-equal" role="1.2.0"><primary>cppcut_assert_not_equal</primary></indexterm>
<programlisting language="C">#define             cppcut_assert_not_equal(expected, actual, ...)</programlisting>
<para>This assertion is a generic method based on template. You
can pass any object's reference as <parameter>expected</parameter>
 and <parameter>actual</parameter>
.</para>
<para>Passes if <parameter>expected</parameter>
 != <parameter>actual</parameter>
.</para>
<para>e.g.:</para>
<informalexample><programlisting><![CDATA[
cppcut_assert_not_equal(3, 3 + 1);
cppcut_assert_not_equal(3, 3 + 1, cppcut_message("easy expression"));
cppcut_assert_not_equal(3, 3 + 1, cppcut_message() << "easy expression"));
]]></programlisting></informalexample>
<para></para>
<refsect3 id="cppcut-assert-not-equal.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>expected</para></entry>
<entry role="parameter_description"><para>an expected value.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>actual</para></entry>
<entry role="parameter_description"><para>an actual value.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>...</para></entry>
<entry role="parameter_description"><para>an optional message. Use <link linkend="cppcut-message"><function>cppcut_message()</function></link> for this.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-1.2.0">1.2.0</link></para></refsect2>
<refsect2 id="cppcut-assert-null" role="macro" condition="since:1.2.0">
<title>cppcut_assert_null()</title>
<indexterm zone="cppcut-assert-null" role="1.2.0"><primary>cppcut_assert_null</primary></indexterm>
<programlisting language="C">#define             cppcut_assert_null(object, ...)</programlisting>
<para>This assertion is a generic method based on template. You
can pass any object's pointer as <parameter>object</parameter>
.</para>
<para>Passes if <parameter>object</parameter>
 is <link linkend="NULL:CAPS"><literal>NULL</literal></link>.</para>
<para>e.g.:</para>
<informalexample><programlisting><![CDATA[
std::string message("hello");
std::string *not_null_string = &message;
std::string *null_string = NULL;
cppcut_assert_null(not_null_string); // fail
cppcut_assert_null(null_string);     // pass
]]></programlisting></informalexample>
<para></para>
<refsect3 id="cppcut-assert-null.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>the object to be checked.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>...</para></entry>
<entry role="parameter_description"><para>an optional message. Use <link linkend="cppcut-message"><function>cppcut_message()</function></link> for this.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-1.2.0">1.2.0</link></para></refsect2>
<refsect2 id="cppcut-assert-not-null" role="macro" condition="since:1.2.0">
<title>cppcut_assert_not_null()</title>
<indexterm zone="cppcut-assert-not-null" role="1.2.0"><primary>cppcut_assert_not_null</primary></indexterm>
<programlisting language="C">#define             cppcut_assert_not_null(object, ...)</programlisting>
<para>This assertion is a generic method based on template. You
can pass any object's pointer as <parameter>object</parameter>
.</para>
<para>Passes if <parameter>object</parameter>
 is not <link linkend="NULL:CAPS"><literal>NULL</literal></link>.</para>
<para>e.g.:</para>
<informalexample><programlisting><![CDATA[
std::string message("hello");
std::string *not_null_string = &message;
std::string *null_string = NULL;
cppcut_assert_not_null(not_null_string); // pass
cppcut_assert_not_null(null_string);     // fail
]]></programlisting></informalexample>
<para></para>
<refsect3 id="cppcut-assert-not-null.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object</para></entry>
<entry role="parameter_description"><para>the object to be checked.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>...</para></entry>
<entry role="parameter_description"><para>an optional message. Use <link linkend="cppcut-message"><function>cppcut_message()</function></link> for this.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-1.2.0">1.2.0</link></para></refsect2>
<refsect2 id="cppcut-assert-operator" role="macro" condition="since:1.2.0">
<title>cppcut_assert_operator()</title>
<indexterm zone="cppcut-assert-operator" role="1.2.0"><primary>cppcut_assert_operator</primary></indexterm>
<programlisting language="C">#define             cppcut_assert_operator(lhs, operator, rhs, ...)</programlisting>
<para>This assertion is a generic method based on template. You
can pass any object as <parameter>lhs</parameter>
 and <parameter>rhs</parameter>
.</para>
<para>Passes if (<parameter>lhs</parameter>
 <parameter>operator</parameter>
 <parameter>rhs</parameter>
) is TRUE.</para>
<para>e.g.:</para>
<informalexample><programlisting><![CDATA[
cppcut_assert_operator(1, <, 2); // pass
cppcut_assert_operator(1, >, 2); // fail
]]></programlisting></informalexample>
<para></para>
<refsect3 id="cppcut-assert-operator.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>lhs</para></entry>
<entry role="parameter_description"><para>a left hand side value.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>operator</para></entry>
<entry role="parameter_description"><para>a binary operator.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>rhs</para></entry>
<entry role="parameter_description"><para>a right hand side value.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>...</para></entry>
<entry role="parameter_description"><para>an optional message. Use <link linkend="cppcut-message"><function>cppcut_message()</function></link> for this.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-1.2.0">1.2.0</link></para></refsect2>

</refsect1>
<refsect1 id="cutter-Assertions-with-C++-support.other_details" role="details">
<title role="details.title">Types and Values</title>

</refsect1>

</refentry>
