gnucash stable: [test-report-utilities] more tests for gnc:account-accumulate-at-dates

Christopher Lam clam at code.gnucash.org
Tue Apr 22 10:06:51 EDT 2025


Updated	 via  https://github.com/Gnucash/gnucash/commit/03d8db58 (commit)
	from  https://github.com/Gnucash/gnucash/commit/fee62532 (commit)



commit 03d8db580a5ca28140b47e9d54e297806a29cf9e
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Tue Apr 22 22:00:12 2025 +0800

    [test-report-utilities] more tests for gnc:account-accumulate-at-dates
    
    testing balances at date boundaries

diff --git a/gnucash/report/test/test-report-utilities.scm b/gnucash/report/test/test-report-utilities.scm
index db54a3fe23..cbdc060ca1 100644
--- a/gnucash/report/test/test-report-utilities.scm
+++ b/gnucash/report/test/test-report-utilities.scm
@@ -612,6 +612,7 @@
                                   (list "Bank1")
                                   (list "Bank2")
                                   (list "Bank3")
+                                  (list "Bank5")
                                   (list "Bank4"))
                             (list "Income" (list (cons 'type ACCT-TYPE-INCOME)))))
            (accounts (env-create-account-structure-alist env structure))
@@ -619,6 +620,7 @@
            (bank2 (assoc-ref accounts "Bank2"))
            (bank3 (assoc-ref accounts "Bank3"))
            (bank4 (assoc-ref accounts "Bank4"))
+           (bank5 (assoc-ref accounts "Bank5"))
            (income (assoc-ref accounts "Income"))
            (dates (gnc:make-date-list (gnc-dmy2time64 01 01 1970)
                                       (gnc-dmy2time64 01 04 1970)
@@ -692,6 +694,15 @@
         '(#f 18 18 18)
         (gnc:account-accumulate-at-dates bank4 dates))
 
+      ;; create 3 transactions but modify posted dates to exact time64 numbers
+      (xaccTransSetDatePostedSecs (env-transfer env 1 1 2000 income bank5 2) 200)
+      (xaccTransSetDatePostedSecs (env-transfer env 1 1 2000 income bank5 3) 300)
+      (xaccTransSetDatePostedSecs (env-transfer env 1 1 2000 income bank5 5) 400)
+
+      (test-equal "transactions at date boundaries"
+                  '(#f 2 5 10 10)
+                  (gnc:account-accumulate-at-dates bank5 (list 100 200 300 400 500)))
+
       ;; Tests split->date sorting. note the 3 txns created below are
       ;; initially sorted by posted_date ie txn2 < txn3 <
       ;; txn1. However the reconciled_date sorting will be



Summary of changes:
 gnucash/report/test/test-report-utilities.scm | 11 +++++++++++
 1 file changed, 11 insertions(+)



More information about the gnucash-changes mailing list