mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
* 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:
parent
c95d33c3da
commit
744de42079
@ -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>
|
2002-11-21 Benoit Grégoire <bock@step.polymtl.ca>
|
||||||
* src/import-export/Transaction-matcher.c: Tweak the matching
|
* src/import-export/Transaction-matcher.c: Tweak the matching
|
||||||
heuristics.
|
heuristics.
|
||||||
|
@ -50,6 +50,7 @@ test_customer (void)
|
|||||||
do_test (gncCustomerGetBook (customer) == book,
|
do_test (gncCustomerGetBook (customer) == book,
|
||||||
"getbook");
|
"getbook");
|
||||||
|
|
||||||
|
gncCustomerBeginEdit (customer);
|
||||||
gncCustomerDestroy (customer);
|
gncCustomerDestroy (customer);
|
||||||
success ("create/destroy");
|
success ("create/destroy");
|
||||||
}
|
}
|
||||||
@ -125,8 +126,11 @@ test_string_fcn (GNCBook *book, const char *message,
|
|||||||
char const *str = get_random_string ();
|
char const *str = get_random_string ();
|
||||||
|
|
||||||
do_test (!gncCustomerIsDirty (customer), "test if start dirty");
|
do_test (!gncCustomerIsDirty (customer), "test if start dirty");
|
||||||
|
gncCustomerBeginEdit (customer);
|
||||||
set (customer, str);
|
set (customer, str);
|
||||||
do_test (gncCustomerIsDirty (customer), "test dirty later");
|
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);
|
do_test (safe_strcmp (get (customer), str) == 0, message);
|
||||||
gncCustomerSetActive (customer, FALSE);
|
gncCustomerSetActive (customer, FALSE);
|
||||||
count++;
|
count++;
|
||||||
@ -141,8 +145,11 @@ test_numeric_fcn (GNCBook *book, const char *message,
|
|||||||
gnc_numeric num = gnc_numeric_create (17, 1);
|
gnc_numeric num = gnc_numeric_create (17, 1);
|
||||||
|
|
||||||
do_test (!gncCustomerIsDirty (customer), "test if start dirty");
|
do_test (!gncCustomerIsDirty (customer), "test if start dirty");
|
||||||
|
gncCustomerBeginEdit (customer);
|
||||||
set (customer, num);
|
set (customer, num);
|
||||||
do_test (gncCustomerIsDirty (customer), "test dirty later");
|
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);
|
do_test (gnc_numeric_equal (get (customer), num), message);
|
||||||
gncCustomerSetActive (customer, FALSE);
|
gncCustomerSetActive (customer, FALSE);
|
||||||
count++;
|
count++;
|
||||||
@ -157,10 +164,13 @@ test_bool_fcn (GNCBook *book, const char *message,
|
|||||||
gboolean num = get_random_boolean ();
|
gboolean num = get_random_boolean ();
|
||||||
|
|
||||||
do_test (!gncCustomerIsDirty (customer), "test if start dirty");
|
do_test (!gncCustomerIsDirty (customer), "test if start dirty");
|
||||||
|
gncCustomerBeginEdit (customer);
|
||||||
set (customer, FALSE);
|
set (customer, FALSE);
|
||||||
set (customer, TRUE);
|
set (customer, TRUE);
|
||||||
set (customer, num);
|
set (customer, num);
|
||||||
do_test (gncCustomerIsDirty (customer), "test dirty later");
|
do_test (gncCustomerIsDirty (customer), "test dirty later");
|
||||||
|
gncCustomerCommitEdit (customer);
|
||||||
|
do_test (!gncCustomerIsDirty (customer), "test dirty after commit");
|
||||||
do_test (get (customer) == num, message);
|
do_test (get (customer) == num, message);
|
||||||
gncCustomerSetActive (customer, FALSE);
|
gncCustomerSetActive (customer, FALSE);
|
||||||
count++;
|
count++;
|
||||||
@ -176,8 +186,11 @@ test_gint_fcn (GNCBook *book, const char *message,
|
|||||||
gint num = 17;
|
gint num = 17;
|
||||||
|
|
||||||
do_test (!gncCustomerIsDirty (customer), "test if start dirty");
|
do_test (!gncCustomerIsDirty (customer), "test if start dirty");
|
||||||
|
gncCustomerBeginEdit (customer);
|
||||||
set (customer, num);
|
set (customer, num);
|
||||||
do_test (gncCustomerIsDirty (customer), "test dirty later");
|
do_test (gncCustomerIsDirty (customer), "test dirty later");
|
||||||
|
gncCustomerCommitEdit (customer);
|
||||||
|
do_test (!gncCustomerIsDirty (customer), "test dirty after commit");
|
||||||
do_test (get (customer) == num, message);
|
do_test (get (customer) == num, message);
|
||||||
gncCustomerSetActive (customer, FALSE);
|
gncCustomerSetActive (customer, FALSE);
|
||||||
count++;
|
count++;
|
||||||
|
@ -50,6 +50,7 @@ test_employee (void)
|
|||||||
do_test (gncEmployeeGetBook (employee) == book,
|
do_test (gncEmployeeGetBook (employee) == book,
|
||||||
"getbook");
|
"getbook");
|
||||||
|
|
||||||
|
gncEmployeeBeginEdit (employee);
|
||||||
gncEmployeeDestroy (employee);
|
gncEmployeeDestroy (employee);
|
||||||
success ("create/destroy");
|
success ("create/destroy");
|
||||||
}
|
}
|
||||||
@ -110,8 +111,11 @@ test_string_fcn (GNCBook *book, const char *message,
|
|||||||
char const *str = get_random_string ();
|
char const *str = get_random_string ();
|
||||||
|
|
||||||
do_test (!gncEmployeeIsDirty (employee), "test if start dirty");
|
do_test (!gncEmployeeIsDirty (employee), "test if start dirty");
|
||||||
|
gncEmployeeBeginEdit (employee);
|
||||||
set (employee, str);
|
set (employee, str);
|
||||||
do_test (gncEmployeeIsDirty (employee), "test dirty later");
|
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);
|
do_test (safe_strcmp (get (employee), str) == 0, message);
|
||||||
gncEmployeeSetActive (employee, FALSE);
|
gncEmployeeSetActive (employee, FALSE);
|
||||||
count++;
|
count++;
|
||||||
@ -126,8 +130,11 @@ test_numeric_fcn (GNCBook *book, const char *message,
|
|||||||
gnc_numeric num = gnc_numeric_create (17, 1);
|
gnc_numeric num = gnc_numeric_create (17, 1);
|
||||||
|
|
||||||
do_test (!gncEmployeeIsDirty (employee), "test if start dirty");
|
do_test (!gncEmployeeIsDirty (employee), "test if start dirty");
|
||||||
|
gncEmployeeBeginEdit (employee);
|
||||||
set (employee, num);
|
set (employee, num);
|
||||||
do_test (gncEmployeeIsDirty (employee), "test dirty later");
|
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);
|
do_test (gnc_numeric_equal (get (employee), num), message);
|
||||||
gncEmployeeSetActive (employee, FALSE);
|
gncEmployeeSetActive (employee, FALSE);
|
||||||
count++;
|
count++;
|
||||||
@ -142,10 +149,13 @@ test_bool_fcn (GNCBook *book, const char *message,
|
|||||||
gboolean num = get_random_boolean ();
|
gboolean num = get_random_boolean ();
|
||||||
|
|
||||||
do_test (!gncEmployeeIsDirty (employee), "test if start dirty");
|
do_test (!gncEmployeeIsDirty (employee), "test if start dirty");
|
||||||
|
gncEmployeeBeginEdit (employee);
|
||||||
set (employee, FALSE);
|
set (employee, FALSE);
|
||||||
set (employee, TRUE);
|
set (employee, TRUE);
|
||||||
set (employee, num);
|
set (employee, num);
|
||||||
do_test (gncEmployeeIsDirty (employee), "test dirty later");
|
do_test (gncEmployeeIsDirty (employee), "test dirty later");
|
||||||
|
gncEmployeeCommitEdit (employee);
|
||||||
|
do_test (!gncEmployeeIsDirty (employee), "test dirty after commit");
|
||||||
do_test (get (employee) == num, message);
|
do_test (get (employee) == num, message);
|
||||||
gncEmployeeSetActive (employee, FALSE);
|
gncEmployeeSetActive (employee, FALSE);
|
||||||
count++;
|
count++;
|
||||||
@ -161,8 +171,11 @@ test_gint_fcn (GNCBook *book, const char *message,
|
|||||||
gint num = 17;
|
gint num = 17;
|
||||||
|
|
||||||
do_test (!gncEmployeeIsDirty (employee), "test if start dirty");
|
do_test (!gncEmployeeIsDirty (employee), "test if start dirty");
|
||||||
|
gncEmployeeBeginEdit (employee);
|
||||||
set (employee, num);
|
set (employee, num);
|
||||||
do_test (gncEmployeeIsDirty (employee), "test dirty later");
|
do_test (gncEmployeeIsDirty (employee), "test dirty later");
|
||||||
|
gncEmployeeCommitEdit (employee);
|
||||||
|
do_test (!gncEmployeeIsDirty (employee), "test dirty after commit");
|
||||||
do_test (get (employee) == num, message);
|
do_test (get (employee) == num, message);
|
||||||
gncEmployeeSetActive (employee, FALSE);
|
gncEmployeeSetActive (employee, FALSE);
|
||||||
count++;
|
count++;
|
||||||
|
@ -52,6 +52,7 @@ test_job (void)
|
|||||||
do_test (gncJobGetBook (job) == book,
|
do_test (gncJobGetBook (job) == book,
|
||||||
"getbook");
|
"getbook");
|
||||||
|
|
||||||
|
gncJobBeginEdit (job);
|
||||||
gncJobDestroy (job);
|
gncJobDestroy (job);
|
||||||
success ("create/destroy");
|
success ("create/destroy");
|
||||||
}
|
}
|
||||||
@ -113,6 +114,7 @@ test_job (void)
|
|||||||
do_test (list == NULL, "no active jobs");
|
do_test (list == NULL, "no active jobs");
|
||||||
list = gncCustomerGetJoblist (cust, TRUE);
|
list = gncCustomerGetJoblist (cust, TRUE);
|
||||||
do_test (list != NULL, "all jobs");
|
do_test (list != NULL, "all jobs");
|
||||||
|
gncJobBeginEdit (job);
|
||||||
gncJobDestroy (job);
|
gncJobDestroy (job);
|
||||||
list = gncCustomerGetJoblist (cust, TRUE);
|
list = gncCustomerGetJoblist (cust, TRUE);
|
||||||
do_test (list == NULL, "no more jobs");
|
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 ();
|
char const *str = get_random_string ();
|
||||||
|
|
||||||
do_test (!gncJobIsDirty (job), "test if start dirty");
|
do_test (!gncJobIsDirty (job), "test if start dirty");
|
||||||
|
gncJobBeginEdit (job);
|
||||||
set (job, str);
|
set (job, str);
|
||||||
do_test (gncJobIsDirty (job), "test dirty later");
|
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);
|
do_test (safe_strcmp (get (job), str) == 0, message);
|
||||||
gncJobSetActive (job, FALSE); count++;
|
gncJobSetActive (job, FALSE); count++;
|
||||||
}
|
}
|
||||||
@ -144,8 +149,11 @@ test_numeric_fcn (GNCBook *book, const char *message,
|
|||||||
gnc_numeric num = gnc_numeric_create (17, 1);
|
gnc_numeric num = gnc_numeric_create (17, 1);
|
||||||
|
|
||||||
do_test (!gncJobIsDirty (job), "test if start dirty");
|
do_test (!gncJobIsDirty (job), "test if start dirty");
|
||||||
|
gncJobBeginEdit (job);
|
||||||
set (job, num);
|
set (job, num);
|
||||||
do_test (gncJobIsDirty (job), "test dirty later");
|
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);
|
do_test (gnc_numeric_equal (get (job), num), message);
|
||||||
gncJobSetActive (job, FALSE); count++;
|
gncJobSetActive (job, FALSE); count++;
|
||||||
}
|
}
|
||||||
@ -160,10 +168,13 @@ test_bool_fcn (GNCBook *book, const char *message,
|
|||||||
gboolean num = get_random_boolean ();
|
gboolean num = get_random_boolean ();
|
||||||
|
|
||||||
do_test (!gncJobIsDirty (job), "test if start dirty");
|
do_test (!gncJobIsDirty (job), "test if start dirty");
|
||||||
|
gncJobBeginEdit (job);
|
||||||
set (job, FALSE);
|
set (job, FALSE);
|
||||||
set (job, TRUE);
|
set (job, TRUE);
|
||||||
set (job, num);
|
set (job, num);
|
||||||
do_test (gncJobIsDirty (job), "test dirty later");
|
do_test (gncJobIsDirty (job), "test dirty later");
|
||||||
|
gncJobCommitEdit (job);
|
||||||
|
do_test (!gncJobIsDirty (job), "test dirty after commit");
|
||||||
do_test (get (job) == num, message);
|
do_test (get (job) == num, message);
|
||||||
gncJobSetActive (job, FALSE); count++;
|
gncJobSetActive (job, FALSE); count++;
|
||||||
}
|
}
|
||||||
@ -178,8 +189,11 @@ test_gint_fcn (GNCBook *book, const char *message,
|
|||||||
gint num = 17;
|
gint num = 17;
|
||||||
|
|
||||||
do_test (!gncJobIsDirty (job), "test if start dirty");
|
do_test (!gncJobIsDirty (job), "test if start dirty");
|
||||||
|
gncJobBeginEdit (job);
|
||||||
set (job, num);
|
set (job, num);
|
||||||
do_test (gncJobIsDirty (job), "test dirty later");
|
do_test (gncJobIsDirty (job), "test dirty later");
|
||||||
|
gncJobCommitEdit (job);
|
||||||
|
do_test (!gncJobIsDirty (job), "test dirty after commit");
|
||||||
do_test (get (job) == num, message);
|
do_test (get (job) == num, message);
|
||||||
gncJobSetActive (job, FALSE); count++;
|
gncJobSetActive (job, FALSE); count++;
|
||||||
}
|
}
|
||||||
|
@ -52,6 +52,7 @@ test_vendor (void)
|
|||||||
do_test (gncVendorGetBook (vendor) == book,
|
do_test (gncVendorGetBook (vendor) == book,
|
||||||
"getbook");
|
"getbook");
|
||||||
|
|
||||||
|
gncVendorBeginEdit (vendor);
|
||||||
gncVendorDestroy (vendor);
|
gncVendorDestroy (vendor);
|
||||||
success ("create/destroy");
|
success ("create/destroy");
|
||||||
}
|
}
|
||||||
@ -111,8 +112,11 @@ test_string_fcn (GNCBook *book, const char *message,
|
|||||||
char const *str = get_random_string ();
|
char const *str = get_random_string ();
|
||||||
|
|
||||||
do_test (!gncVendorIsDirty (vendor), "test if start dirty");
|
do_test (!gncVendorIsDirty (vendor), "test if start dirty");
|
||||||
|
gncVendorBeginEdit (vendor);
|
||||||
set (vendor, str);
|
set (vendor, str);
|
||||||
do_test (gncVendorIsDirty (vendor), "test dirty later");
|
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);
|
do_test (safe_strcmp (get (vendor), str) == 0, message);
|
||||||
gncVendorSetActive (vendor, FALSE); count++;
|
gncVendorSetActive (vendor, FALSE); count++;
|
||||||
}
|
}
|
||||||
@ -127,8 +131,11 @@ test_numeric_fcn (GNCBook *book, const char *message,
|
|||||||
gnc_numeric num = gnc_numeric_create (17, 1);
|
gnc_numeric num = gnc_numeric_create (17, 1);
|
||||||
|
|
||||||
do_test (!gncVendorIsDirty (vendor), "test if start dirty");
|
do_test (!gncVendorIsDirty (vendor), "test if start dirty");
|
||||||
|
gncVendoryBeginEdit (vendor);
|
||||||
set (vendor, num);
|
set (vendor, num);
|
||||||
do_test (gncVendorIsDirty (vendor), "test dirty later");
|
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);
|
do_test (gnc_numeric_equal (get (vendor), num), message);
|
||||||
gncVendorSetActive (vendor, FALSE); count++;
|
gncVendorSetActive (vendor, FALSE); count++;
|
||||||
}
|
}
|
||||||
@ -143,10 +150,13 @@ test_bool_fcn (GNCBook *book, const char *message,
|
|||||||
gboolean num = get_random_boolean ();
|
gboolean num = get_random_boolean ();
|
||||||
|
|
||||||
do_test (!gncVendorIsDirty (vendor), "test if start dirty");
|
do_test (!gncVendorIsDirty (vendor), "test if start dirty");
|
||||||
|
gncVendorBeginEdit (vendor);
|
||||||
set (vendor, FALSE);
|
set (vendor, FALSE);
|
||||||
set (vendor, TRUE);
|
set (vendor, TRUE);
|
||||||
set (vendor, num);
|
set (vendor, num);
|
||||||
do_test (gncVendorIsDirty (vendor), "test dirty later");
|
do_test (gncVendorIsDirty (vendor), "test dirty later");
|
||||||
|
gncVendorCommitEdit (vendor);
|
||||||
|
do_test (!gncVendorIsDirty (vendor), "test dirty after commit");
|
||||||
do_test (get (vendor) == num, message);
|
do_test (get (vendor) == num, message);
|
||||||
gncVendorSetActive (vendor, FALSE); count++;
|
gncVendorSetActive (vendor, FALSE); count++;
|
||||||
}
|
}
|
||||||
@ -161,8 +171,11 @@ test_gint_fcn (GNCBook *book, const char *message,
|
|||||||
gint num = 17;
|
gint num = 17;
|
||||||
|
|
||||||
do_test (!gncVendorIsDirty (vendor), "test if start dirty");
|
do_test (!gncVendorIsDirty (vendor), "test if start dirty");
|
||||||
|
gncVendorBeginEdit (vendor);
|
||||||
set (vendor, num);
|
set (vendor, num);
|
||||||
do_test (gncVendorIsDirty (vendor), "test dirty later");
|
do_test (gncVendorIsDirty (vendor), "test dirty later");
|
||||||
|
gncVendorCommitEdit (vendor);
|
||||||
|
do_test (!gncVendorIsDirty (vendor), "test dirty after commit");
|
||||||
do_test (get (vendor) == num, message);
|
do_test (get (vendor) == num, message);
|
||||||
gncVendorSetActive (vendor, FALSE); count++;
|
gncVendorSetActive (vendor, FALSE); count++;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user