mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-20 11:48:30 -06:00
transaction voiding now tested and works :)
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@5469 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
2408e0f983
commit
67849a74ca
15
ChangeLog
15
ChangeLog
@ -1,3 +1,13 @@
|
||||
2001-10-08 Robert Graham Merkel <rgmerk@mira.net>
|
||||
|
||||
* src/engine/test/test-transaction-voiding.c (run_test): remove
|
||||
diagnostic stuff needed for initial debugging, fix bug in test.
|
||||
|
||||
* src/engine/Transaction.c: removed transaction void debugging
|
||||
stuff.
|
||||
|
||||
* src/engine/test/Makefile.am: enable transaction voiding test.
|
||||
|
||||
2001-10-05 Robert Graham Merkel <rgmerk@mira.net>
|
||||
|
||||
* src/engine/test/test-transaction-voiding.c: new file.
|
||||
@ -25,8 +35,9 @@
|
||||
|
||||
* src/engine/gw-engine-spec.scm: wrap voiding functions
|
||||
|
||||
* src/report/report-system/report-utilities.scm: added some convenience functions
|
||||
for adding voiding checks to queries and checking the voiding status of splits.
|
||||
* src/report/report-system/report-utilities.scm: added some
|
||||
convenience functions for adding voiding checks to queries and
|
||||
checking the voiding status of splits.
|
||||
|
||||
* src/report/standard-reports/*: fixed up queries to exclude voids as appropriate.
|
||||
|
||||
|
@ -2633,16 +2633,7 @@ xaccTransVoid(Transaction *transaction,
|
||||
|
||||
xaccTransCommitEdit(transaction);
|
||||
|
||||
for(split_list = xaccTransGetSplitList(transaction);
|
||||
split_list;
|
||||
split_list = g_list_next(split_list))
|
||||
{
|
||||
char *string = gnc_numeric_to_string(xaccSplitGetAmount(split_list->data));
|
||||
|
||||
fprintf(stderr, "%s\n", string);
|
||||
g_free(string);
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -25,8 +25,8 @@ TESTS = \
|
||||
test-group-vs-book \
|
||||
test-resolve-file-path \
|
||||
test-scm-query \
|
||||
test-split-vs-account
|
||||
# test-transaction-voiding
|
||||
test-split-vs-account \
|
||||
test-transaction-voiding
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
GNC_MODULE_PATH="${top_srcdir}/src/engine" \
|
||||
@ -41,8 +41,8 @@ bin_PROGRAMS = \
|
||||
test-load-engine \
|
||||
test-resolve-file-path \
|
||||
test-scm-query \
|
||||
test-split-vs-account
|
||||
# test-transaction-voiding
|
||||
test-split-vs-account \
|
||||
test-transaction-voiding
|
||||
|
||||
EXTRA_DIST = \
|
||||
test-create-account \
|
||||
|
@ -38,7 +38,7 @@ run_test (void)
|
||||
Account *acc1, *acc2;
|
||||
Transaction *transaction;
|
||||
gnc_numeric old_amt, new_amt, new_kvp_amt, old_val, new_val, new_kvp_val;
|
||||
|
||||
int rval;
|
||||
GNCSession *session;
|
||||
|
||||
char *reason = "because I can";
|
||||
@ -64,9 +64,6 @@ run_test (void)
|
||||
old_amt = xaccSplitGetAmount(xaccTransGetSplit(transaction, 0));
|
||||
old_val = xaccSplitGetValue(xaccTransGetSplit(transaction, 1));
|
||||
|
||||
print_gnc_numeric(old_amt);
|
||||
print_gnc_numeric(old_val);
|
||||
getchar();
|
||||
|
||||
|
||||
xaccTransVoid(transaction, reason);
|
||||
@ -87,25 +84,23 @@ run_test (void)
|
||||
|
||||
if (!gnc_numeric_zero_p( new_amt))
|
||||
{
|
||||
fprintf(stderr, "%s\n", gnc_numeric_to_string(new_amt));
|
||||
failure("Amount not zero after voiding");
|
||||
}
|
||||
|
||||
new_val = xaccSplitGetValue(xaccTransGetSplit(transaction, 1));
|
||||
print_gnc_numeric(new_val);
|
||||
if (!gnc_numeric_zero_p(new_val));
|
||||
|
||||
if (!(gnc_numeric_zero_p(new_val)))
|
||||
{
|
||||
fprintf(stderr, "%s\n", gnc_numeric_to_string(new_val));
|
||||
failure("Amount not zero after voiding");
|
||||
}
|
||||
|
||||
|
||||
if(!gnc_numeric_eq(old_amt, xaccSplitVoidFormerAmount(xaccTransGetSplit(transaction, 0))))
|
||||
if(!(gnc_numeric_eq(old_amt, xaccSplitVoidFormerAmount(xaccTransGetSplit(transaction, 0)))))
|
||||
{
|
||||
failure("former amount (after voiding) didn't match actual old amount");
|
||||
}
|
||||
|
||||
if(!gnc_numeric_eq(old_val, xaccSplitVoidFormerValue(xaccTransGetSplit(transaction, 1))))
|
||||
if(!(gnc_numeric_eq(old_val, xaccSplitVoidFormerValue(xaccTransGetSplit(transaction, 1)))))
|
||||
{
|
||||
failure("former value (after voiding) didn't match actual old value");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user