<?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-Assertion-Utilities-for-GHashTable">
<refmeta>
<refentrytitle role="top_of_page" id="cutter-Assertion-Utilities-for-GHashTable.top_of_page">Assertion Utilities for GHashTable</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>CUTTER Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>Assertion Utilities for GHashTable</refname>
<refpurpose>Utilities to write assertions related
to <link linkend="GHashTable"><type>GHashTable</type></link> more easily.</refpurpose>
</refnamediv>

<refsect1 id="cutter-Assertion-Utilities-for-GHashTable.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="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="gcut-hash-table-equal">gcut_hash_table_equal</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="gcut-hash-table-inspect">gcut_hash_table_inspect</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="gcut-hash-table-inspect-sorted">gcut_hash_table_inspect_sorted</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="gcut-hash-table-string-equal">gcut_hash_table_string_equal</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="gcut-hash-table-string-string-inspect">gcut_hash_table_string_string_inspect</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GHashTable"><returnvalue>GHashTable</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="gcut-hash-table-string-string-copy">gcut_hash_table_string_string_copy</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

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


<refsect1 id="cutter-Assertion-Utilities-for-GHashTable.description" role="desc">
<title role="desc.title">Description</title>
<para>To write assertions, you need to check equality and show
expected and actual values.</para>
<para>The utilities help you to write assertions that are
related to <link linkend="GHashTable"><type>GHashTable</type></link>.</para>

</refsect1>
<refsect1 id="cutter-Assertion-Utilities-for-GHashTable.functions_details" role="details">
<title role="details.title">Functions</title>
<refsect2 id="gcut-hash-table-equal" role="function" condition="since:1.0.5">
<title>gcut_hash_table_equal&#160;()</title>
<indexterm zone="gcut-hash-table-equal" role="1.0.5"><primary>gcut_hash_table_equal</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
gcut_hash_table_equal (<parameter><link linkend="GHashTable"><type>GHashTable</type></link> *hash1</parameter>,
                       <parameter><link linkend="GHashTable"><type>GHashTable</type></link> *hash2</parameter>,
                       <parameter><link linkend="GEqualFunc"><type>GEqualFunc</type></link> equal_func</parameter>);</programlisting>
<para>Compares two <link linkend="GHashTable"><type>GHashTable</type></link>, <parameter>hash1</parameter>
 and
<parameter>hash2</parameter>
. <parameter>equal_func</parameter>
 is called for each values of
the same key of <parameter>hash1</parameter>
 and <parameter>hash2</parameter>
.</para>
<para>e.g.:</para>
<informalexample><programlisting><![CDATA[
TODO
]]></programlisting></informalexample>
<para></para>
<refsect3 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>hash1</para></entry>
<entry role="parameter_description"><para>a <link linkend="GHashTable"><type>GHashTable</type></link> to be compared.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>hash2</para></entry>
<entry role="parameter_description"><para>a <link linkend="GHashTable"><type>GHashTable</type></link> to be compared.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>equal_func</para></entry>
<entry role="parameter_description"><para>a function that compares two values.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 role="returns">
<title>Returns</title>
<para> TRUE if all same key's values of <parameter>hash1</parameter>
and
<parameter>hash2</parameter>
are reported TRUE by <parameter>equal_func</parameter>
, FALSE
otherwise.</para>
</refsect3><para role="since">Since: <link linkend="api-index-1.0.5">1.0.5</link></para></refsect2>
<refsect2 id="gcut-hash-table-inspect" role="function" condition="since:1.0.5">
<title>gcut_hash_table_inspect&#160;()</title>
<indexterm zone="gcut-hash-table-inspect" role="1.0.5"><primary>gcut_hash_table_inspect</primary></indexterm>
<programlisting language="C"><link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
gcut_hash_table_inspect (<parameter><link linkend="GHashTable"><type>GHashTable</type></link> *hash</parameter>,
                         <parameter><link linkend="GCutInspectFunction"><type>GCutInspectFunction</type></link> key_inspect_func</parameter>,
                         <parameter><link linkend="GCutInspectFunction"><type>GCutInspectFunction</type></link> value_inspect_func</parameter>,
                         <parameter><link linkend="gpointer"><type>gpointer</type></link> user_data</parameter>);</programlisting>
<para>Inspects <parameter>hash</parameter>
. Each key of <parameter>hash</parameter>
 is inspected by
<parameter>key_inspect_func</parameter>
 and each value of <parameter>hash</parameter>
 is inspected by
<parameter>value_inspect_func</parameter>
. The returned string should be freed
when no longer needed.</para>
<para>e.g.:</para>
<informalexample><programlisting><![CDATA[
TODO
]]></programlisting></informalexample>
<para></para>
<refsect3 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>hash</para></entry>
<entry role="parameter_description"><para>a <link linkend="GHashTable"><type>GHashTable</type></link> to be inspected.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>key_inspect_func</para></entry>
<entry role="parameter_description"><para>a function that inspects each key.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>value_inspect_func</para></entry>
<entry role="parameter_description"><para>a function that inspects each value.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>user_data</para></entry>
<entry role="parameter_description"><para>user data to pass to the function.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 role="returns">
<title>Returns</title>
<para> inspected <parameter>hash</parameter>
as a string.</para>
</refsect3><para role="since">Since: <link linkend="api-index-1.0.5">1.0.5</link></para></refsect2>
<refsect2 id="gcut-hash-table-inspect-sorted" role="function" condition="since:1.0.9">
<title>gcut_hash_table_inspect_sorted&#160;()</title>
<indexterm zone="gcut-hash-table-inspect-sorted" role="1.0.9"><primary>gcut_hash_table_inspect_sorted</primary></indexterm>
<programlisting language="C"><link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
gcut_hash_table_inspect_sorted (<parameter><link linkend="GHashTable"><type>GHashTable</type></link> *hash</parameter>,
                                <parameter><link linkend="GCutInspectFunction"><type>GCutInspectFunction</type></link> key_inspect_func</parameter>,
                                <parameter><link linkend="GCutInspectFunction"><type>GCutInspectFunction</type></link> value_inspect_func</parameter>,
                                <parameter><link linkend="GCompareFunc"><type>GCompareFunc</type></link> key_compare_func</parameter>,
                                <parameter><link linkend="gpointer"><type>gpointer</type></link> user_data</parameter>);</programlisting>
<para>Sorts <parameter>hash</parameter>
 as key by <parameter>key_compare_func</parameter>
 and inspects
it. Each key of <parameter>hash</parameter>
 is inspected by <parameter>key_inspect_func</parameter>

and each value of <parameter>hash</parameter>
 is inspected by
<parameter>value_inspect_func</parameter>
. The returned string should be freed
when no longer needed.</para>
<para>If <parameter>key_compare_func</parameter>
 is <link linkend="NULL:CAPS"><literal>NULL</literal></link>, <parameter>hash</parameter>
 isn't sorted. It is
the same behavior as <link linkend="gcut-hash-table-inspect"><function>gcut_hash_table_inspect()</function></link>.</para>
<para>e.g.:</para>
<informalexample><programlisting><![CDATA[
TODO
]]></programlisting></informalexample>
<para></para>
<refsect3 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>hash</para></entry>
<entry role="parameter_description"><para>a <link linkend="GHashTable"><type>GHashTable</type></link> to be inspected and sorted.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>key_inspect_func</para></entry>
<entry role="parameter_description"><para>a function that inspects each key.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>value_inspect_func</para></entry>
<entry role="parameter_description"><para>a function that inspects each value.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>key_compare_func</para></entry>
<entry role="parameter_description"><para>a function that compares each key.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>user_data</para></entry>
<entry role="parameter_description"><para>user data to pass to the function.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 role="returns">
<title>Returns</title>
<para> inspected and sorted <parameter>hash</parameter>
as a string.</para>
</refsect3><para role="since">Since: <link linkend="api-index-1.0.9">1.0.9</link></para></refsect2>
<refsect2 id="gcut-hash-table-string-equal" role="function" condition="since:1.0.5">
<title>gcut_hash_table_string_equal&#160;()</title>
<indexterm zone="gcut-hash-table-string-equal" role="1.0.5"><primary>gcut_hash_table_string_equal</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
gcut_hash_table_string_equal (<parameter><link linkend="GHashTable"><type>GHashTable</type></link> *hash1</parameter>,
                              <parameter><link linkend="GHashTable"><type>GHashTable</type></link> *hash2</parameter>);</programlisting>
<para>Compares two <link linkend="GHashTable"><type>GHashTable</type></link>, <parameter>hash1</parameter>
 and
<parameter>hash2</parameter>
. <parameter>hash1</parameter>
 and <parameter>hash2</parameter>
 should have string key and
string value.</para>
<refsect3 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>hash1</para></entry>
<entry role="parameter_description"><para>a <link linkend="GHashTable"><type>GHashTable</type></link> to be compared.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>hash2</para></entry>
<entry role="parameter_description"><para>a <link linkend="GHashTable"><type>GHashTable</type></link> to be compared.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 role="returns">
<title>Returns</title>
<para> TRUE if all same key's values of <parameter>hash1</parameter>
and
<parameter>hash2</parameter>
are same string content, FALSE otherwise.</para>
</refsect3><para role="since">Since: <link linkend="api-index-1.0.5">1.0.5</link></para></refsect2>
<refsect2 id="gcut-hash-table-string-string-inspect" role="function" condition="since:1.0.5">
<title>gcut_hash_table_string_string_inspect&#160;()</title>
<indexterm zone="gcut-hash-table-string-string-inspect" role="1.0.5"><primary>gcut_hash_table_string_string_inspect</primary></indexterm>
<programlisting language="C"><link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
gcut_hash_table_string_string_inspect (<parameter><link linkend="GHashTable"><type>GHashTable</type></link> *hash</parameter>);</programlisting>
<para>Inspects <parameter>hash</parameter>
. <parameter>hash</parameter>
 should have string key and string
value. The returned string should be freed when no longer
needed.</para>
<refsect3 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>hash</para></entry>
<entry role="parameter_description"><para>a <link linkend="GHashTable"><type>GHashTable</type></link> to be inspected.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 role="returns">
<title>Returns</title>
<para> inspected <parameter>hash</parameter>
as a string.</para>
</refsect3><para role="since">Since: <link linkend="api-index-1.0.5">1.0.5</link></para></refsect2>
<refsect2 id="gcut-hash-table-string-string-copy" role="function" condition="since:1.0.8">
<title>gcut_hash_table_string_string_copy&#160;()</title>
<indexterm zone="gcut-hash-table-string-string-copy" role="1.0.8"><primary>gcut_hash_table_string_string_copy</primary></indexterm>
<programlisting language="C"><link linkend="GHashTable"><returnvalue>GHashTable</returnvalue></link>&#160;*
gcut_hash_table_string_string_copy (<parameter><link linkend="GHashTable"><type>GHashTable</type></link> *hash</parameter>);</programlisting>
<para>Copy <parameter>hash</parameter>
. <parameter>hash</parameter>
 should have string key and string
value. The returned <parameter>hash</parameter>
 should be freed by
<link linkend="g-hash-table-unref"><function>g_hash_table_unref()</function></link>.</para>
<refsect3 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>hash</para></entry>
<entry role="parameter_description"><para>a <link linkend="GHashTable"><type>GHashTable</type></link> to be copied.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 role="returns">
<title>Returns</title>
<para> copied <link linkend="GHashTable"><type>GHashTable</type></link>. It should be freed when no
longer needed.</para>
</refsect3><para role="since">Since: <link linkend="api-index-1.0.8">1.0.8</link></para></refsect2>

</refsect1>
<refsect1 id="cutter-Assertion-Utilities-for-GHashTable.other_details" role="details">
<title role="details.title">Types and Values</title>

</refsect1>

</refentry>
