mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Merge Richard Cohen's 'valgrind-test-fixes' into stable.
This commit is contained in:
@@ -204,12 +204,7 @@ get_random_time (void)
|
||||
GncGUID*
|
||||
get_random_guid(void)
|
||||
{
|
||||
GncGUID *ret;
|
||||
|
||||
ret = g_new(GncGUID, 1);
|
||||
guid_replace(ret);
|
||||
|
||||
return ret;
|
||||
return guid_new();
|
||||
}
|
||||
|
||||
/* ========================================================== */
|
||||
@@ -1502,14 +1497,9 @@ get_random_guids(int max)
|
||||
}
|
||||
|
||||
static void
|
||||
free_random_guids(GList *guids)
|
||||
free_guids(GList *guids)
|
||||
{
|
||||
GList *node;
|
||||
|
||||
for (node = guids; node; node = node->next)
|
||||
g_free (node->data);
|
||||
|
||||
g_list_free (guids);
|
||||
g_list_free_full (guids, (GDestroyNotify)guid_free);
|
||||
}
|
||||
|
||||
static QofQueryOp
|
||||
@@ -1676,7 +1666,7 @@ get_random_query(void)
|
||||
guids,
|
||||
compare_param<QofGuidMatch>(QOF_GUID_MATCH_NONE),
|
||||
get_random_queryop ());
|
||||
free_random_guids (guids);
|
||||
free_guids (guids);
|
||||
break;
|
||||
|
||||
case 2: /*PR_ACTION */
|
||||
@@ -1737,7 +1727,7 @@ get_random_query(void)
|
||||
guid,
|
||||
get_random_id_type (),
|
||||
get_random_queryop ());
|
||||
g_free (guid);
|
||||
guid_free (guid);
|
||||
break;
|
||||
|
||||
case 8: /* PR_KVP */
|
||||
@@ -2031,9 +2021,7 @@ make_trans_query (Transaction *trans, TestQueryTypes query_types)
|
||||
}
|
||||
xaccQueryAddAccountGUIDMatch (q, list, QOF_GUID_MATCH_ANY, QOF_QUERY_AND);
|
||||
|
||||
for (node = list; node; node = node->next)
|
||||
g_free (node->data);
|
||||
g_list_free (list);
|
||||
free_guids (list);
|
||||
}
|
||||
|
||||
if (query_types & GUID_QT)
|
||||
|
||||
@@ -87,12 +87,13 @@ test_customer (void)
|
||||
|
||||
test_bool_fcn (book, "Active", gncCustomerSetActive, gncCustomerGetActive);
|
||||
|
||||
do_test (gncCustomerGetAddr (customer) != NULL, "Addr");
|
||||
do_test (gncCustomerGetShipAddr (customer) != NULL, "ShipAddr");
|
||||
|
||||
guid_replace (&guid);
|
||||
customer = gncCustomerCreate (book);
|
||||
count++;
|
||||
|
||||
do_test (gncCustomerGetAddr (customer) != NULL, "Addr");
|
||||
do_test (gncCustomerGetShipAddr (customer) != NULL, "ShipAddr");
|
||||
|
||||
gncCustomerSetGUID (customer, &guid);
|
||||
do_test (guid_equal (&guid, gncCustomerGetGUID (customer)), "guid compare");
|
||||
}
|
||||
|
||||
@@ -94,11 +94,12 @@ test_employee (void)
|
||||
|
||||
test_bool_fcn (book, "Active", gncEmployeeSetActive, gncEmployeeGetActive);
|
||||
|
||||
do_test (gncEmployeeGetAddr (employee) != NULL, "Addr");
|
||||
|
||||
guid_replace (&guid);
|
||||
employee = gncEmployeeCreate (book);
|
||||
count++;
|
||||
|
||||
do_test (gncEmployeeGetAddr (employee) != NULL, "Addr");
|
||||
|
||||
gncEmployeeSetGUID (employee, &guid);
|
||||
do_test (guid_equal (&guid, qof_instance_get_guid(QOF_INSTANCE(employee))), "guid compare");
|
||||
}
|
||||
|
||||
@@ -70,6 +70,7 @@ TEST (KvpValueTest, Copy)
|
||||
v2 = std::unique_ptr<KvpValueImpl> {new KvpValueImpl {*v1}};
|
||||
EXPECT_EQ (compare (*v1, *v2), 0);
|
||||
|
||||
guid = guid_new ();
|
||||
v1 = std::unique_ptr<KvpValueImpl> {new KvpValueImpl {guid}};
|
||||
v2 = std::unique_ptr<KvpValueImpl> {new KvpValueImpl {*v1}};
|
||||
/*This should delete the guid*/
|
||||
|
||||
@@ -94,11 +94,12 @@ test_vendor (void)
|
||||
//test_bool_fcn (book, "TaxIncluded", gncVendorSetTaxIncluded, gncVendorGetTaxIncluded);
|
||||
test_bool_fcn (book, "Active", gncVendorSetActive, gncVendorGetActive);
|
||||
|
||||
do_test (gncVendorGetAddr (vendor) != NULL, "Addr");
|
||||
|
||||
guid_replace (&guid);
|
||||
vendor = gncVendorCreate (book);
|
||||
count++;
|
||||
|
||||
do_test (gncVendorGetAddr (vendor) != NULL, "Addr");
|
||||
|
||||
gncVendorSetGUID (vendor, &guid);
|
||||
do_test (guid_equal (&guid, qof_instance_get_guid(QOF_INSTANCE(vendor))), "guid compare");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user