* business-core/test/*.c -- fix the tests for begin/commit edit

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7514 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Derek Atkins 2002-11-21 20:16:23 +00:00
parent c95d33c3da
commit 744de42079
5 changed files with 56 additions and 0 deletions

View File

@ -1,3 +1,6 @@
2002-11-21 Derek Atkins <derek@ihtfp.com>
* business-core/test/*.c -- fix the tests for begin/commit edit
2002-11-21 Benoit Grégoire <bock@step.polymtl.ca>
* src/import-export/Transaction-matcher.c: Tweak the matching
heuristics.

View File

@ -50,6 +50,7 @@ test_customer (void)
do_test (gncCustomerGetBook (customer) == book,
"getbook");
gncCustomerBeginEdit (customer);
gncCustomerDestroy (customer);
success ("create/destroy");
}
@ -125,8 +126,11 @@ test_string_fcn (GNCBook *book, const char *message,
char const *str = get_random_string ();
do_test (!gncCustomerIsDirty (customer), "test if start dirty");
gncCustomerBeginEdit (customer);
set (customer, str);
do_test (gncCustomerIsDirty (customer), "test dirty later");
gncCustomerCommitEdit (customer);
do_test (!gncCustomerIsDirty (customer), "test dirty after commit");
do_test (safe_strcmp (get (customer), str) == 0, message);
gncCustomerSetActive (customer, FALSE);
count++;
@ -141,8 +145,11 @@ test_numeric_fcn (GNCBook *book, const char *message,
gnc_numeric num = gnc_numeric_create (17, 1);
do_test (!gncCustomerIsDirty (customer), "test if start dirty");
gncCustomerBeginEdit (customer);
set (customer, num);
do_test (gncCustomerIsDirty (customer), "test dirty later");
gncCustomerCommitEdit (customer);
do_test (!gncCustomerIsDirty (customer), "test dirty after commit");
do_test (gnc_numeric_equal (get (customer), num), message);
gncCustomerSetActive (customer, FALSE);
count++;
@ -157,10 +164,13 @@ test_bool_fcn (GNCBook *book, const char *message,
gboolean num = get_random_boolean ();
do_test (!gncCustomerIsDirty (customer), "test if start dirty");
gncCustomerBeginEdit (customer);
set (customer, FALSE);
set (customer, TRUE);
set (customer, num);
do_test (gncCustomerIsDirty (customer), "test dirty later");
gncCustomerCommitEdit (customer);
do_test (!gncCustomerIsDirty (customer), "test dirty after commit");
do_test (get (customer) == num, message);
gncCustomerSetActive (customer, FALSE);
count++;
@ -176,8 +186,11 @@ test_gint_fcn (GNCBook *book, const char *message,
gint num = 17;
do_test (!gncCustomerIsDirty (customer), "test if start dirty");
gncCustomerBeginEdit (customer);
set (customer, num);
do_test (gncCustomerIsDirty (customer), "test dirty later");
gncCustomerCommitEdit (customer);
do_test (!gncCustomerIsDirty (customer), "test dirty after commit");
do_test (get (customer) == num, message);
gncCustomerSetActive (customer, FALSE);
count++;

View File

@ -50,6 +50,7 @@ test_employee (void)
do_test (gncEmployeeGetBook (employee) == book,
"getbook");
gncEmployeeBeginEdit (employee);
gncEmployeeDestroy (employee);
success ("create/destroy");
}
@ -110,8 +111,11 @@ test_string_fcn (GNCBook *book, const char *message,
char const *str = get_random_string ();
do_test (!gncEmployeeIsDirty (employee), "test if start dirty");
gncEmployeeBeginEdit (employee);
set (employee, str);
do_test (gncEmployeeIsDirty (employee), "test dirty later");
gncEmployeeCommitEdit (employee);
do_test (!gncEmployeeIsDirty (employee), "test dirty after commit");
do_test (safe_strcmp (get (employee), str) == 0, message);
gncEmployeeSetActive (employee, FALSE);
count++;
@ -126,8 +130,11 @@ test_numeric_fcn (GNCBook *book, const char *message,
gnc_numeric num = gnc_numeric_create (17, 1);
do_test (!gncEmployeeIsDirty (employee), "test if start dirty");
gncEmployeeBeginEdit (employee);
set (employee, num);
do_test (gncEmployeeIsDirty (employee), "test dirty later");
gncEmployeeCommitEdit (employee);
do_test (!gncEmployeeIsDirty (employee), "test dirty after commit");
do_test (gnc_numeric_equal (get (employee), num), message);
gncEmployeeSetActive (employee, FALSE);
count++;
@ -142,10 +149,13 @@ test_bool_fcn (GNCBook *book, const char *message,
gboolean num = get_random_boolean ();
do_test (!gncEmployeeIsDirty (employee), "test if start dirty");
gncEmployeeBeginEdit (employee);
set (employee, FALSE);
set (employee, TRUE);
set (employee, num);
do_test (gncEmployeeIsDirty (employee), "test dirty later");
gncEmployeeCommitEdit (employee);
do_test (!gncEmployeeIsDirty (employee), "test dirty after commit");
do_test (get (employee) == num, message);
gncEmployeeSetActive (employee, FALSE);
count++;
@ -161,8 +171,11 @@ test_gint_fcn (GNCBook *book, const char *message,
gint num = 17;
do_test (!gncEmployeeIsDirty (employee), "test if start dirty");
gncEmployeeBeginEdit (employee);
set (employee, num);
do_test (gncEmployeeIsDirty (employee), "test dirty later");
gncEmployeeCommitEdit (employee);
do_test (!gncEmployeeIsDirty (employee), "test dirty after commit");
do_test (get (employee) == num, message);
gncEmployeeSetActive (employee, FALSE);
count++;

View File

@ -52,6 +52,7 @@ test_job (void)
do_test (gncJobGetBook (job) == book,
"getbook");
gncJobBeginEdit (job);
gncJobDestroy (job);
success ("create/destroy");
}
@ -113,6 +114,7 @@ test_job (void)
do_test (list == NULL, "no active jobs");
list = gncCustomerGetJoblist (cust, TRUE);
do_test (list != NULL, "all jobs");
gncJobBeginEdit (job);
gncJobDestroy (job);
list = gncCustomerGetJoblist (cust, TRUE);
do_test (list == NULL, "no more jobs");
@ -128,8 +130,11 @@ test_string_fcn (GNCBook *book, const char *message,
char const *str = get_random_string ();
do_test (!gncJobIsDirty (job), "test if start dirty");
gncJobBeginEdit (job);
set (job, str);
do_test (gncJobIsDirty (job), "test dirty later");
gncJobCommitEdit (job);
do_test (!gncJobIsDirty (job), "test dirty after commit");
do_test (safe_strcmp (get (job), str) == 0, message);
gncJobSetActive (job, FALSE); count++;
}
@ -144,8 +149,11 @@ test_numeric_fcn (GNCBook *book, const char *message,
gnc_numeric num = gnc_numeric_create (17, 1);
do_test (!gncJobIsDirty (job), "test if start dirty");
gncJobBeginEdit (job);
set (job, num);
do_test (gncJobIsDirty (job), "test dirty later");
gncJobCommitEdit (job);
do_test (!gncJobIsDirty (job), "test dirty after commit");
do_test (gnc_numeric_equal (get (job), num), message);
gncJobSetActive (job, FALSE); count++;
}
@ -160,10 +168,13 @@ test_bool_fcn (GNCBook *book, const char *message,
gboolean num = get_random_boolean ();
do_test (!gncJobIsDirty (job), "test if start dirty");
gncJobBeginEdit (job);
set (job, FALSE);
set (job, TRUE);
set (job, num);
do_test (gncJobIsDirty (job), "test dirty later");
gncJobCommitEdit (job);
do_test (!gncJobIsDirty (job), "test dirty after commit");
do_test (get (job) == num, message);
gncJobSetActive (job, FALSE); count++;
}
@ -178,8 +189,11 @@ test_gint_fcn (GNCBook *book, const char *message,
gint num = 17;
do_test (!gncJobIsDirty (job), "test if start dirty");
gncJobBeginEdit (job);
set (job, num);
do_test (gncJobIsDirty (job), "test dirty later");
gncJobCommitEdit (job);
do_test (!gncJobIsDirty (job), "test dirty after commit");
do_test (get (job) == num, message);
gncJobSetActive (job, FALSE); count++;
}

View File

@ -52,6 +52,7 @@ test_vendor (void)
do_test (gncVendorGetBook (vendor) == book,
"getbook");
gncVendorBeginEdit (vendor);
gncVendorDestroy (vendor);
success ("create/destroy");
}
@ -111,8 +112,11 @@ test_string_fcn (GNCBook *book, const char *message,
char const *str = get_random_string ();
do_test (!gncVendorIsDirty (vendor), "test if start dirty");
gncVendorBeginEdit (vendor);
set (vendor, str);
do_test (gncVendorIsDirty (vendor), "test dirty later");
gncVendorCommitEdit (vendor);
do_test (!gncVendorIsDirty (vendor), "test dirty after commit");
do_test (safe_strcmp (get (vendor), str) == 0, message);
gncVendorSetActive (vendor, FALSE); count++;
}
@ -127,8 +131,11 @@ test_numeric_fcn (GNCBook *book, const char *message,
gnc_numeric num = gnc_numeric_create (17, 1);
do_test (!gncVendorIsDirty (vendor), "test if start dirty");
gncVendoryBeginEdit (vendor);
set (vendor, num);
do_test (gncVendorIsDirty (vendor), "test dirty later");
gncVendorCommitEdit (vendor);
do_test (!gncVendorIsDirty (vendor), "test dirty after commit");
do_test (gnc_numeric_equal (get (vendor), num), message);
gncVendorSetActive (vendor, FALSE); count++;
}
@ -143,10 +150,13 @@ test_bool_fcn (GNCBook *book, const char *message,
gboolean num = get_random_boolean ();
do_test (!gncVendorIsDirty (vendor), "test if start dirty");
gncVendorBeginEdit (vendor);
set (vendor, FALSE);
set (vendor, TRUE);
set (vendor, num);
do_test (gncVendorIsDirty (vendor), "test dirty later");
gncVendorCommitEdit (vendor);
do_test (!gncVendorIsDirty (vendor), "test dirty after commit");
do_test (get (vendor) == num, message);
gncVendorSetActive (vendor, FALSE); count++;
}
@ -161,8 +171,11 @@ test_gint_fcn (GNCBook *book, const char *message,
gint num = 17;
do_test (!gncVendorIsDirty (vendor), "test if start dirty");
gncVendorBeginEdit (vendor);
set (vendor, num);
do_test (gncVendorIsDirty (vendor), "test dirty later");
gncVendorCommitEdit (vendor);
do_test (!gncVendorIsDirty (vendor), "test dirty after commit");
do_test (get (vendor) == num, message);
gncVendorSetActive (vendor, FALSE); count++;
}