mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Add tests for the reconcile account functions
This commit is contained in:
parent
fd37ee997d
commit
6df866f876
@ -1089,6 +1089,11 @@ test_gnc_account_kvp_setters_getters (Fixture *fixture, gconstpointer pData)
|
|||||||
{
|
{
|
||||||
Account *account = xaccMallocAccount (gnc_account_get_book (fixture->acct));
|
Account *account = xaccMallocAccount (gnc_account_get_book (fixture->acct));
|
||||||
xaccAccountSetType (account, ACCT_TYPE_EQUITY);
|
xaccAccountSetType (account, ACCT_TYPE_EQUITY);
|
||||||
|
gnc_numeric post_balance = gnc_numeric_create (2345, 100);
|
||||||
|
gnc_numeric returned_post_balance;
|
||||||
|
time64 date = gnc_time (nullptr);
|
||||||
|
time64 returned_date;
|
||||||
|
int prev_months, prev_days;
|
||||||
|
|
||||||
// equity_type getter/setter
|
// equity_type getter/setter
|
||||||
g_assert (xaccAccountGetIsOpeningBalance (account) == FALSE);
|
g_assert (xaccAccountGetIsOpeningBalance (account) == FALSE);
|
||||||
@ -1231,6 +1236,35 @@ test_gnc_account_kvp_setters_getters (Fixture *fixture, gconstpointer pData)
|
|||||||
xaccAccountSetNotes (account, nullptr);
|
xaccAccountSetNotes (account, nullptr);
|
||||||
g_assert_cmpstr (xaccAccountGetNotes (account), ==, nullptr);
|
g_assert_cmpstr (xaccAccountGetNotes (account), ==, nullptr);
|
||||||
|
|
||||||
|
// Reconcile getter/setter
|
||||||
|
date = date - (60*60*24*7); // -7 days
|
||||||
|
xaccAccountSetReconcileLastDate (account, date);
|
||||||
|
xaccAccountGetReconcileLastDate (account, &returned_date);
|
||||||
|
g_assert (date == returned_date);
|
||||||
|
|
||||||
|
date = date + (60*60*24*2); // +2 days
|
||||||
|
xaccAccountSetReconcilePostponeDate (account, date);
|
||||||
|
xaccAccountGetReconcilePostponeDate (account, &returned_date);
|
||||||
|
g_assert (date == returned_date);
|
||||||
|
|
||||||
|
g_assert (xaccAccountGetReconcilePostponeBalance (account, &returned_post_balance) == false);
|
||||||
|
xaccAccountSetReconcilePostponeBalance (account, post_balance);
|
||||||
|
g_assert (xaccAccountGetReconcilePostponeBalance (account, &returned_post_balance) == true);
|
||||||
|
g_assert_cmpint (gnc_numeric_compare (post_balance, returned_post_balance), ==, 0);
|
||||||
|
|
||||||
|
xaccAccountClearReconcilePostpone (account);
|
||||||
|
g_assert (xaccAccountGetReconcilePostponeBalance (account, &returned_post_balance) == false);
|
||||||
|
|
||||||
|
g_assert (xaccAccountGetReconcileLastInterval (account, &prev_months, &prev_days) == false);
|
||||||
|
xaccAccountSetReconcileLastInterval (account, 2, 6);
|
||||||
|
g_assert (xaccAccountGetReconcileLastInterval (account, &prev_months, &prev_days) == true);
|
||||||
|
g_assert (prev_months == 2);
|
||||||
|
g_assert (prev_days == 6);
|
||||||
|
|
||||||
|
g_assert (xaccAccountGetReconcileChildrenStatus (account) == false); //default
|
||||||
|
xaccAccountSetReconcileChildrenStatus (account, true);
|
||||||
|
g_assert (xaccAccountGetReconcileChildrenStatus (account) == true);
|
||||||
|
|
||||||
// STOCK_ACCOUNT tests from now on
|
// STOCK_ACCOUNT tests from now on
|
||||||
xaccAccountSetType (account, ACCT_TYPE_STOCK);
|
xaccAccountSetType (account, ACCT_TYPE_STOCK);
|
||||||
|
|
||||||
@ -2555,26 +2589,7 @@ test_xaccAccountType_Compatibility (void)
|
|||||||
g_assert_cmpint (check2->hits, ==, 1);
|
g_assert_cmpint (check2->hits, ==, 1);
|
||||||
g_free (msg2);
|
g_free (msg2);
|
||||||
}
|
}
|
||||||
/* More KVP getters & setters
|
|
||||||
* xaccAccountGetReconcileLastDate
|
|
||||||
* xaccAccountSetReconcileLastDate
|
|
||||||
* xaccAccountGetReconcilePostponeDate
|
|
||||||
* xaccAccountSetReconcilePostponeDate
|
|
||||||
* xaccAccountGetReconcilePostponeBalance
|
|
||||||
* xaccAccountSetReconcilePostponeBalance
|
|
||||||
* xaccAccountClearReconcilePostpone
|
|
||||||
* xaccAccountGetAutoInterestXfer
|
|
||||||
* xaccAccountSetAutoInterestXfer
|
|
||||||
* xaccAccountGetLastNum
|
|
||||||
* xaccAccountSetLastNum
|
|
||||||
* xaccAccountSetReconcileChildrenStatus
|
|
||||||
* xaccAccountGetReconcileChildrenStatus
|
|
||||||
* xaccAccountGetReconcileLastInterval
|
|
||||||
* xaccAccountSetReconcileLastInterval
|
|
||||||
* dxaccAccountSetPriceSrc
|
|
||||||
* dxaccAccountSetQuoteTZ
|
|
||||||
* dxaccAccountGetQuoteTZ
|
|
||||||
*/
|
|
||||||
/* finder_help_function
|
/* finder_help_function
|
||||||
static void
|
static void
|
||||||
finder_help_function (const Account *acc, const char *description,// 3
|
finder_help_function (const Account *acc, const char *description,// 3
|
||||||
|
Loading…
Reference in New Issue
Block a user