the test succeeded.</p>
<h4>Using run_tests()</h4>
-<a href="../src/example/run_tests.c">run_tests.c</a>
+<a href="../example/run_tests.c">run_tests.c</a>
<listing>
#include <stdarg.h>
#include <stddef.h>
<b>expect_assert_failure()</b> a test failure is signalled.</p>
<h4>Using mock_assert()</h4>
-<a href="../src/example/assert_module.c">assert_module.c</a>
+<a href="../example/assert_module.c">assert_module.c</a>
<listing>
#include <assert.h>
}
}
</listing>
-<a href="../src/example/assert_module_test.c">assert_module_test.c</a>
+<a href="../example/assert_module_test.c">assert_module_test.c</a>
<listing>
#include <stdarg.h>
#include <stddef.h>
debugging of failing test cases.</p>
<h4>Using assert_{type}_equal() macros</h4>
-<a href="../src/example/assert_macro.c">assert_macro.c</a>
+<a href="../example/assert_macro.c">assert_macro.c</a>
<listing>
#include <string.h>
return ~0U;
}
</listing>
-<a href="../src/example/assert_macro_test.c">assert_macro_test.c</a>
+<a href="../example/assert_macro_test.c">assert_macro_test.c</a>
<listing>
#include <stdarg.h>
#include <stddef.h>
the test application to exit prematurely.</p>
<h4>Using cmocka's Allocators</h4>
-<a href="../src/example/allocate_module.c">allocate_module.c</a>
+<a href="../example/allocate_module.c">allocate_module.c</a>
<listing>
#include <malloc.h>
free(memory);
}
</listing>
-<a href="../src/example/allocate_module_test.c">allocate_module_test.c</a>
+<a href="../example/allocate_module_test.c">allocate_module_test.c</a>
<listing>
#include <stdarg.h>
#include <stddef.h>
multiple calls to a mock function.</p>
<h4>Using will_return()</h4>
-<a name="../src/example/database.h" href="database.h">database.h</a>
+<a href="../example/database.h">database.h</a>
<listing>
typedef struct DatabaseConnection DatabaseConnection;
DatabaseConnection* connect_to_database(const char * const url,
const unsigned int port);
</listing>
-<a href="../src/example/customer_database.c">customer_database.c</a>
+<a href="../example/customer_database.c">customer_database.c</a>
<listing>
#include <stddef.h>
#include <stdio.h>
return (unsigned int)results[0];
}
</listing>
-<a href="../src/example/customer_database_test.c">customer_database_test.c</a>
+<a href="../example/customer_database_test.c">customer_database_test.c</a>
<listing>
#include <stdarg.h>
#include <stddef.h>
no more parameter values are queued a test failure occurs.</p>
<h4>Using expect_*()</h4>
-<a href="../src/example/product_database.c">product_database.c</a>
+<a href="../example/product_database.c">product_database.c</a>
<listing>
#include <database.h>
return connect_to_database("products.abcd.org", 322);
}
</listing>
-<a href="../src/example/product_database_test.c">product_database_test.c</a>
+<a href="../example/product_database_test.c">product_database_test.c</a>
<listing>
#include <stdarg.h>
#include <stddef.h>
executed for a test case even when it fails.</p>
<h4>Using unit_test_setup_teardown()</h4>
-<a href="../src/example/key_value.c">key_value.c</a>
+<a href="../example/key_value.c">key_value.c</a>
<listing>
#include <stddef.h>
#include <stdlib.h>
key_value_compare_keys);
}
</listing>
-<a href="../src/example/key_value_test.c">key_value_test.c</a>
+<a href="../example/key_value_test.c">key_value_test.c</a>
<listing>
#include <stdarg.h>
#include <stddef.h>
<a name="Example"><h2>Example</h2></a>
<p>A small command line calculator
-<a href="../src/example/calculator.c">calculator.c</a> application
+<a href="../example/calculator.c">calculator.c</a> application
and test application that full exercises the calculator application
-<a href="../src/example/calculator_test.c">calculator_test.c</a>
+<a href="../example/calculator_test.c">calculator_test.c</a>
are provided as an example of cmocka's features discussed in this document.
</p>