fix up the way the test cases test for the 'dirty' flag; add notes to

the README file asbout dirty flag testing.  All tests pass at this
point.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@9578 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Linas Vepstas
2003-10-19 15:03:32 +00:00
parent 2afc11fd9a
commit 0bcc7874a0
6 changed files with 58 additions and 8 deletions
@@ -13,6 +13,7 @@ LDADD = \
${top_builddir}/src/test-core/libgncmod-test.la \
${top_builddir}/src/engine/libgncmod-engine.la \
${top_builddir}/src/engine/libgw-engine.la \
${top_builddir}/src/backend/file/libgncmod-backend-file.la \
../libgncmod-business-core.la \
../libgw-business-core.la \
${GLIB_LIBS} \
+19 -8
View File
@@ -2,14 +2,25 @@
This directory contains unit test cases for the core business objects.
Notes on test of dirty/clean flag:
---------------------------------
Test casees will fail the test of the 'dirty' flag if a backend
is not set up. That's because the 'dirty' flag is supposed to be
cleared by the backend only.
An object cannot be marked 'clean' unless it has actually
been saved to a file or sql db. (Or, in the case of the file
backend, the 'dirtyness' of the data has been dully noted, and
will be taken care of for teh next file save.
Until its saved, it lives in perpetual dirtiness. Thus, the
test cases need to specify a backend, then do the commit,
then test the dirty flag.
Actually, the use of the dirty flag in gnucash is, at this time,
mildly ambiguous, and its semantics are not clearly defined.
TODO
----
Some of these test casees are failing on the 'dirty' test.
That's because the test cases are not setting up a backend.
An object cannot be marked 'clean' unless it has actually
been saved to a file or sql db. Until its saved, it lives in
perpetual dirtiness. Thus, the test cases need to specify
a backend, then do the commit, then test the dirty flag.
Make tests better
@@ -1,3 +1,8 @@
/*
* Test the customer object
*/
#include <glib.h>
#include <libguile.h>
@@ -34,14 +39,23 @@ test_gint_fcn (QofBook *book, const char *message,
gint (*get) (GncCustomer *));
#endif
extern QofBackend * libgncmod_backend_file_LTX_gnc_backend_new(void);
static void
test_customer (void)
{
QofBackend *fbe;
QofBook *book;
GncCustomer *customer;
book = qof_book_new ();
/* The book *must* have a backend to pass the test of the 'dirty' flag */
/* See the README file for details */
fbe = libgncmod_backend_file_LTX_gnc_backend_new();
qof_book_set_backend (book, fbe);
/* Test creation/destruction */
{
do_test (gncCustomerCreate (NULL) == NULL, "customer create NULL");
@@ -35,14 +35,22 @@ test_gint_fcn (QofBook *book, const char *message,
gint (*get) (GncEmployee *));
#endif
extern QofBackend * libgncmod_backend_file_LTX_gnc_backend_new(void);
static void
test_employee (void)
{
QofBackend *fbe;
QofBook *book;
GncEmployee *employee;
book = qof_book_new ();
/* The book *must* have a backend to pass the test of the 'dirty' flag */
/* See the README file for details */
fbe = libgncmod_backend_file_LTX_gnc_backend_new();
qof_book_set_backend (book, fbe);
/* Test creation/destruction */
{
do_test (gncEmployeeCreate (NULL) == NULL, "employee create NULL");
@@ -36,14 +36,22 @@ test_gint_fcn (QofBook *book, const char *message,
gint (*get) (GncJob *));
#endif
extern QofBackend * libgncmod_backend_file_LTX_gnc_backend_new(void);
static void
test_job (void)
{
QofBackend *fbe;
QofBook *book;
GncJob *job;
book = qof_book_new ();
/* The book *must* have a backend to pass the test of the 'dirty' flag */
/* See the README file for details */
fbe = libgncmod_backend_file_LTX_gnc_backend_new();
qof_book_set_backend (book, fbe);
/* Test creation/destruction */
{
do_test (gncJobCreate (NULL) == NULL, "job create NULL");
@@ -36,14 +36,22 @@ test_gint_fcn (QofBook *book, const char *message,
gint (*get) (GncVendor *));
#endif
extern QofBackend * libgncmod_backend_file_LTX_gnc_backend_new(void);
static void
test_vendor (void)
{
QofBackend *fbe;
QofBook *book;
GncVendor *vendor;
book = qof_book_new ();
/* The book *must* have a backend to pass the test of the 'dirty' flag */
/* See the README file for details */
fbe = libgncmod_backend_file_LTX_gnc_backend_new();
qof_book_set_backend (book, fbe);
/* Test creation/destruction */
{
do_test (gncVendorCreate (NULL) == NULL, "vendor create NULL");