"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "gnucash/report/report-system/test/test-report-utilities.scm" between
gnucash-3.6.tar.bz2 and gnucash-3.7.tar.bz2

About: GnuCash is personal and small-business financial-accounting software.

test-report-utilities.scm  (gnucash-3.6.tar.bz2):test-report-utilities.scm  (gnucash-3.7.tar.bz2)
skipping to change at line 26 skipping to change at line 26
(test-begin "report-utilities") (test-begin "report-utilities")
(test-account-get-trans-type-splits-interval) (test-account-get-trans-type-splits-interval)
(test-list-ref-safe) (test-list-ref-safe)
(test-list-set-safe) (test-list-set-safe)
(test-gnc-pk) (test-gnc-pk)
(test-gnc:monetary->string) (test-gnc:monetary->string)
(test-commodity-collector) (test-commodity-collector)
(test-get-account-balances) (test-get-account-balances)
(test-monetary-adders) (test-monetary-adders)
(test-make-stats-collector) (test-make-stats-collector)
(test-utility-functions)
(test-end "report-utilities")) (test-end "report-utilities"))
(define (NDayDelta t64 n) (define (NDayDelta t64 n)
(let* ((day-secs (* 60 60 24 n)) ; n days in seconds is n times 60 sec/min * 6 0 min/h * 24 h/day (let* ((day-secs (* 60 60 24 n)) ; n days in seconds is n times 60 sec/min * 6 0 min/h * 24 h/day
(new-secs (- t64 day-secs))) (new-secs (- t64 day-secs)))
new-secs)) new-secs))
(define (collector->list coll) (define (collector->list coll)
;; input: collector ;; input: collector
;; output: list of monetary pairs e.g. '(("USD" . 25) ("GBP" . 15.00)) ;; output: list of monetary pairs e.g. '(("USD" . 25) ("GBP" . 15.00))
skipping to change at line 133 skipping to change at line 134
(test-equal "gnc:strify \"str\"" (test-equal "gnc:strify \"str\""
"str" "str"
(gnc:strify "str")) (gnc:strify "str"))
(test-equal "gnc:strify '(1 2 3)" (test-equal "gnc:strify '(1 2 3)"
"(list 1 2 3)" "(list 1 2 3)"
(gnc:strify '(1 2 3))) (gnc:strify '(1 2 3)))
(test-equal "gnc:strify (a . 2)" (test-equal "gnc:strify (a . 2)"
"('a . 2)" "('a . 2)"
(gnc:strify (cons 'a 2))) (gnc:strify (cons 'a 2)))
(test-equal "gnc:strify cons" (test-equal "gnc:strify cons"
"Proc<cons>" "Proc<identity>"
(gnc:strify cons)) (gnc:strify identity))
(let ((coll (gnc:make-commodity-collector)))
(test-equal "gnc:strify <mon-coll>"
"coll<()>"
(gnc:strify coll))
(coll 'add (gnc-commodity-table-lookup
(gnc-commodity-table-get-table
(gnc-get-current-book)) "CURRENCY" "USD") 10)
(test-equal "gnc:strify <mon-coll $10>"
"coll<([$10.00])>"
(gnc:strify coll)))
(let ((coll (gnc:make-value-collector)))
(test-equal "gnc:strify <val-coll 0>"
"coll<0>"
(gnc:strify coll))
(coll 'add 10)
(test-equal "gnc:strify <val-coll 10>"
"coll<10>"
(gnc:strify coll)))
(test-end "debugging tools")) (test-end "debugging tools"))
(define (test-commodity-collector) (define (test-commodity-collector)
(test-group-with-cleanup "test-commodity-collector" (test-group-with-cleanup "test-commodity-collector"
(let* ((book (gnc-get-current-book)) (let* ((book (gnc-get-current-book))
(comm-table (gnc-commodity-table-get-table book)) (comm-table (gnc-commodity-table-get-table book))
(USD (gnc-commodity-table-lookup comm-table "CURRENCY" "USD")) (USD (gnc-commodity-table-lookup comm-table "CURRENCY" "USD"))
(GBP (gnc-commodity-table-lookup comm-table "CURRENCY" "GBP")) (GBP (gnc-commodity-table-lookup comm-table "CURRENCY" "GBP"))
(EUR (gnc-commodity-table-lookup comm-table "CURRENCY" "EUR")) (EUR (gnc-commodity-table-lookup comm-table "CURRENCY" "EUR"))
(coll-A (gnc:make-commodity-collector)) (coll-A (gnc:make-commodity-collector))
skipping to change at line 236 skipping to change at line 255
(define (structure) (define (structure)
(list "Root" (list (cons 'type ACCT-TYPE-ASSET)) (list "Root" (list (cons 'type ACCT-TYPE-ASSET))
(list "Asset" (list "Asset"
(list "Bank") (list "Bank")
(list "GBP Bank" (list (cons 'commodity (mnemonic->commodity "GBP" ))) (list "GBP Bank" (list (cons 'commodity (mnemonic->commodity "GBP" )))
(list "GBP Savings")) (list "GBP Savings"))
(list "Wallet")) (list "Wallet"))
(list "Income" (list (cons 'type ACCT-TYPE-INCOME))) (list "Income" (list (cons 'type ACCT-TYPE-INCOME)))
(list "Income-GBP" (list (cons 'type ACCT-TYPE-INCOME) (list "Income-GBP" (list (cons 'type ACCT-TYPE-INCOME)
(cons 'commodity (mnemonic->commodity "GBP")))) (cons 'commodity (mnemonic->commodity "GBP"))))
(list "Expenses" (list (cons 'type ACCT-TYPE-EXPENSE))) (list "Expenses" (list (cons 'type ACCT-TYPE-EXPENSE))
(list "Fuel"))
(list "Liabilities" (list (cons 'type ACCT-TYPE-LIABILITY))) (list "Liabilities" (list (cons 'type ACCT-TYPE-LIABILITY)))
(list "Equity" (list (cons 'type ACCT-TYPE-EQUITY))) (list "Equity" (list (cons 'type ACCT-TYPE-EQUITY)))
)) ))
(define (create-test-data) (define (create-test-data)
(let* ((env (create-test-env)) (let* ((env (create-test-env))
(account-alist (env-create-account-structure-alist env (structure))) (account-alist (env-create-account-structure-alist env (structure)))
(asset (cdr (assoc "Asset" account-alist))) (asset (cdr (assoc "Asset" account-alist)))
(bank (cdr (assoc "Bank" account-alist))) (bank (cdr (assoc "Bank" account-alist)))
(gbp-bank (cdr (assoc "GBP Bank" account-alist))) (gbp-bank (cdr (assoc "GBP Bank" account-alist)))
skipping to change at line 466 skipping to change at line 486
#f #f
(collector->list (collector->list
(gnc:select-assoc-account-balance account-balances expense))) (gnc:select-assoc-account-balance account-balances expense)))
(test-equal "gnc:get-assoc-account-balances-total" (test-equal "gnc:get-assoc-account-balances-total"
'(("GBP" . 603) ("USD" . 2286)) '(("GBP" . 603) ("USD" . 2286))
(collector->list (collector->list
(gnc:get-assoc-account-balances-total account-balances))))) (gnc:get-assoc-account-balances-total account-balances)))))
(teardown))) (teardown)))
(define (test-utility-functions)
(define (account-lookup str)
(gnc-account-lookup-by-name
(gnc-book-get-root-account (gnc-get-current-book))
str))
(test-group-with-cleanup "utility functions"
(create-test-data)
(test-equal "gnc:accounts-get-commodities"
(list "GBP" "USD")
(map gnc-commodity-get-mnemonic
(gnc:accounts-get-commodities (gnc-account-get-descendants-sorted
(gnc-get-current-root-account))
#f)))
(test-equal "gnc:get-current-account-tree-depth"
5
(gnc:get-current-account-tree-depth))
(test-equal "gnc:acccounts-get-all-subaccounts"
(list (account-lookup "Fuel")
(account-lookup "GBP Savings"))
(gnc:acccounts-get-all-subaccounts
(list (account-lookup "Expenses")
(account-lookup "GBP Bank"))))
(test-equal "gnc:accounts-and-all-descendants"
(list (account-lookup "GBP Bank")
(account-lookup "GBP Savings")
(account-lookup "Expenses")
(account-lookup "Fuel"))
(gnc:accounts-and-all-descendants
(list (account-lookup "Expenses")
(account-lookup "GBP Bank"))))
(teardown)))
(define (test-monetary-adders) (define (test-monetary-adders)
(define (monetary->pair mon) (define (monetary->pair mon)
(let ((comm (gnc:gnc-monetary-commodity mon)) (let ((comm (gnc:gnc-monetary-commodity mon))
(amt (gnc:gnc-monetary-amount mon))) (amt (gnc:gnc-monetary-amount mon)))
(cons (gnc-commodity-get-mnemonic comm) amt))) (cons (gnc-commodity-get-mnemonic comm) amt)))
(let* ((book (gnc-get-current-book)) (let* ((book (gnc-get-current-book))
(comm-table (gnc-commodity-table-get-table book)) (comm-table (gnc-commodity-table-get-table book))
(USD (gnc-commodity-table-lookup comm-table "CURRENCY" "USD")) (USD (gnc-commodity-table-lookup comm-table "CURRENCY" "USD"))
(GBP (gnc-commodity-table-lookup comm-table "CURRENCY" "GBP")) (GBP (gnc-commodity-table-lookup comm-table "CURRENCY" "GBP"))
(EUR (gnc-commodity-table-lookup comm-table "CURRENCY" "EUR")) (EUR (gnc-commodity-table-lookup comm-table "CURRENCY" "EUR"))
 End of changes. 4 change blocks. 
3 lines changed or deleted 61 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)