Skip to content

Commit

Permalink
Fix business-core tests so that all pass
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@19754 57a11ea4-9604-0410-9ed3-97b8803252fd
  • Loading branch information
jralls committed Nov 4, 2010
1 parent d40faca commit 88b0e26
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 10 deletions.
16 changes: 13 additions & 3 deletions src/business/business-core/test/test-customer.c
Expand Up @@ -161,9 +161,11 @@ test_string_fcn (QofBook *book, const char *message,
do_test (!gncCustomerIsDirty (customer), "test if start dirty");
gncCustomerBeginEdit (customer);
set (customer, str);
/* Customer record should be dirty */
do_test (gncCustomerIsDirty (customer), "test dirty later");
gncCustomerCommitEdit (customer);
do_test (gncCustomerIsDirty (customer), "test dirty after commit");
/* Customer record should be not dirty */
do_test (!gncCustomerIsDirty (customer), "test dirty after commit");
do_test (safe_strcmp (get (customer), str) == 0, message);
gncCustomerSetActive (customer, FALSE);
count++;
Expand All @@ -180,9 +182,11 @@ test_numeric_fcn (QofBook *book, const char *message,
do_test (!gncCustomerIsDirty (customer), "test if start dirty");
gncCustomerBeginEdit (customer);
set (customer, num);
/* Customer record should be dirty */
do_test (gncCustomerIsDirty (customer), "test dirty later");
gncCustomerCommitEdit (customer);
do_test (gncCustomerIsDirty (customer), "test dirty after commit");
/* Customer record should be not dirty */
do_test (!gncCustomerIsDirty (customer), "test dirty after commit");
do_test (gnc_numeric_equal (get (customer), num), message);
gncCustomerSetActive (customer, FALSE);
count++;
Expand All @@ -201,9 +205,11 @@ test_bool_fcn (QofBook *book, const char *message,
set (customer, FALSE);
set (customer, TRUE);
set (customer, num);
/* Customer record should be dirty */
do_test (gncCustomerIsDirty (customer), "test dirty later");
gncCustomerCommitEdit (customer);
do_test (gncCustomerIsDirty (customer), "test dirty after commit");
/* Customer record should be not dirty */
do_test (!gncCustomerIsDirty (customer), "test dirty after commit");
do_test (get (customer) == num, message);
gncCustomerSetActive (customer, FALSE);
count++;
Expand All @@ -215,9 +221,13 @@ main (int argc, char **argv)
qof_init();
qof_load_backend_library ("../../../backend/xml/.libs/", GNC_LIB_NAME);
do_test (cashobjects_register(), "Cannot register cash objects");
/* These three registrations are done during cashobjects_register,
so trying to register them again naturally fails. */
#if 0
do_test (gncInvoiceRegister(), "Cannot register GncInvoice");
do_test (gncJobRegister (), "Cannot register GncJob");
do_test (gncCustomerRegister(), "Cannot register GncCustomer");
#endif
test_customer();
print_test_results();
qof_close ();
Expand Down
14 changes: 11 additions & 3 deletions src/business/business-core/test/test-employee.c
Expand Up @@ -151,9 +151,11 @@ test_string_fcn (QofBook *book, const char *message,
do_test (!gncEmployeeIsDirty (employee), "test if start dirty");
gncEmployeeBeginEdit (employee);
set (employee, str);
/* Employee record should be dirty */
do_test (gncEmployeeIsDirty (employee), "test dirty later");
gncEmployeeCommitEdit (employee);
do_test (gncEmployeeIsDirty (employee), "test dirty after commit");
/* Employee record should be not dirty */
do_test (!gncEmployeeIsDirty (employee), "test dirty after commit");
do_test (safe_strcmp (get (employee), str) == 0, message);
gncEmployeeSetActive (employee, FALSE);
count++;
Expand All @@ -170,9 +172,11 @@ test_numeric_fcn (QofBook *book, const char *message,
do_test (!gncEmployeeIsDirty (employee), "test if start dirty");
gncEmployeeBeginEdit (employee);
set (employee, num);
/* Employee record should be dirty */
do_test (gncEmployeeIsDirty (employee), "test dirty later");
gncEmployeeCommitEdit (employee);
do_test (gncEmployeeIsDirty (employee), "test dirty after commit");
/* Employee record should be not dirty */
do_test (!gncEmployeeIsDirty (employee), "test dirty after commit");
do_test (gnc_numeric_equal (get (employee), num), message);
gncEmployeeSetActive (employee, FALSE);
count++;
Expand All @@ -191,9 +195,11 @@ test_bool_fcn (QofBook *book, const char *message,
set (employee, FALSE);
set (employee, TRUE);
set (employee, num);
/* Employee record should be dirty */
do_test (gncEmployeeIsDirty (employee), "test dirty later");
gncEmployeeCommitEdit (employee);
do_test (gncEmployeeIsDirty (employee), "test dirty after commit");
/* Employee record should be not dirty */
do_test (!gncEmployeeIsDirty (employee), "test dirty after commit");
do_test (get (employee) == num, message);
gncEmployeeSetActive (employee, FALSE);
count++;
Expand All @@ -211,8 +217,10 @@ test_gint_fcn (QofBook *book, const char *message,
do_test (!gncEmployeeIsDirty (employee), "test if start dirty");
gncEmployeeBeginEdit (employee);
set (employee, num);
/* Employee record should be dirty */
do_test (gncEmployeeIsDirty (employee), "test dirty later");
gncEmployeeCommitEdit (employee);
/* Employee record should be not dirty */
do_test (!gncEmployeeIsDirty (employee), "test dirty after commit");
do_test (get (employee) == num, message);
gncEmployeeSetActive (employee, FALSE);
Expand Down
12 changes: 10 additions & 2 deletions src/business/business-core/test/test-job.c
Expand Up @@ -171,9 +171,11 @@ test_string_fcn (QofBook *book, const char *message,
do_test (!qof_instance_is_dirty (QOF_INSTANCE(job)), "test if start dirty");
gncJobBeginEdit (job);
set (job, str);
/* Job record should be dirty */
do_test (qof_instance_is_dirty (QOF_INSTANCE(job)), "test dirty later");
gncJobCommitEdit (job);
do_test (qof_instance_is_dirty (QOF_INSTANCE(job)), "test dirty after commit");
/* Job record should be not dirty */
do_test (!qof_instance_is_dirty (QOF_INSTANCE(job)), "test dirty after commit");
do_test (safe_strcmp (get (job), str) == 0, message);
gncJobSetActive (job, FALSE);
count++;
Expand All @@ -191,8 +193,10 @@ test_numeric_fcn (QofBook *book, const char *message,
do_test (!qof_instance_is_dirty (QOF_INSTANCE(job)), "test if start dirty");
gncJobBeginEdit (job);
set (job, num);
/* Job record should be dirty */
do_test (qof_instance_is_dirty (QOF_INSTANCE(job)), "test dirty later");
gncJobCommitEdit (job);
/* Job record should be not dirty */
do_test (!qof_instance_is_dirty (QOF_INSTANCE(job)), "test dirty after commit");
do_test (gnc_numeric_equal (get (job), num), message);
gncJobSetActive (job, FALSE);
Expand All @@ -213,9 +217,11 @@ test_bool_fcn (QofBook *book, const char *message,
set (job, FALSE);
set (job, TRUE);
set (job, num);
/* Job record should be dirty */
do_test (qof_instance_is_dirty (QOF_INSTANCE(job)), "test dirty later");
gncJobCommitEdit (job);
do_test (qof_instance_is_dirty (QOF_INSTANCE(job)), "test dirty after commit");
/* Job record should be not dirty */
do_test (!qof_instance_is_dirty (QOF_INSTANCE(job)), "test dirty after commit");
do_test (get (job) == num, message);
gncJobSetActive (job, FALSE);
count++;
Expand All @@ -233,8 +239,10 @@ test_gint_fcn (QofBook *book, const char *message,
do_test (!qof_instance_is_dirty (QOF_INSTANCE(job)), "test if start dirty");
gncJobBeginEdit (job);
set (job, num);
/* Job record should be dirty */
do_test (qof_instance_is_dirty (QOF_INSTANCE(job)), "test dirty later");
gncJobCommitEdit (job);
/* Job record should be not dirty */
do_test (!qof_instance_is_dirty (QOF_INSTANCE(job)), "test dirty after commit");
do_test (get (job) == num, message);
gncJobSetActive (job, FALSE);
Expand Down
12 changes: 10 additions & 2 deletions src/business/business-core/test/test-vendor.c
Expand Up @@ -150,9 +150,11 @@ test_string_fcn (QofBook *book, const char *message,
do_test (!gncVendorIsDirty (vendor), "test if start dirty");
gncVendorBeginEdit (vendor);
set (vendor, str);
/* Vendor record should be dirty */
do_test (gncVendorIsDirty (vendor), "test dirty later");
gncVendorCommitEdit (vendor);
do_test (gncVendorIsDirty (vendor), "test dirty after commit");
/* Vendor record should be not dirty */
do_test (!gncVendorIsDirty (vendor), "test dirty after commit");
do_test (safe_strcmp (get (vendor), str) == 0, message);
gncVendorSetActive (vendor, FALSE);
count++;
Expand All @@ -170,8 +172,10 @@ test_numeric_fcn (QofBook *book, const char *message,
do_test (!gncVendorIsDirty (vendor), "test if start dirty");
gncVendoryBeginEdit (vendor);
set (vendor, num);
/* Vendor record should be dirty */
do_test (gncVendorIsDirty (vendor), "test dirty later");
gncVendorCommitEdit (vendor);
/* Vendor record should be not dirty */
do_test (!gncVendorIsDirty (vendor), "test dirty after commit");
do_test (gnc_numeric_equal (get (vendor), num), message);
gncVendorSetActive (vendor, FALSE);
Expand All @@ -192,9 +196,11 @@ test_bool_fcn (QofBook *book, const char *message,
set (vendor, FALSE);
set (vendor, TRUE);
set (vendor, num);
/* Vendor record should be dirty */
do_test (gncVendorIsDirty (vendor), "test dirty later");
gncVendorCommitEdit (vendor);
do_test (gncVendorIsDirty (vendor), "test dirty after commit");
/* Vendor record should be not dirty */
do_test (!gncVendorIsDirty (vendor), "test dirty after commit");
do_test (get (vendor) == num, message);
gncVendorSetActive (vendor, FALSE);
count++;
Expand All @@ -212,8 +218,10 @@ test_gint_fcn (QofBook *book, const char *message,
do_test (!gncVendorIsDirty (vendor), "test if start dirty");
gncVendorBeginEdit (vendor);
set (vendor, num);
/* Vendor record should be dirty */
do_test (gncVendorIsDirty (vendor), "test dirty later");
gncVendorCommitEdit (vendor);
/* Vendor record should be not dirty */
do_test (!gncVendorIsDirty (vendor), "test dirty after commit");
do_test (get (vendor) == num, message);
gncVendorSetActive (vendor, FALSE);
Expand Down

0 comments on commit 88b0e26

Please sign in to comment.