mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Convert non-trep-based report tests to new API
This commit is contained in:
parent
58147ea470
commit
cec27308d8
@ -36,10 +36,9 @@
|
||||
(gnc:options->sxml uuid options "test-accsum" test-title))
|
||||
|
||||
(define (set-option! options section name value)
|
||||
(let ((option (gnc:lookup-option options section name)))
|
||||
(if option
|
||||
(gnc:option-set-value option value)
|
||||
(test-assert (format #f "wrong-option ~a ~a" section name) #f))))
|
||||
(if (gnc-lookup-option options section name)
|
||||
(gnc-set-option options section name value)
|
||||
(test-assert (format #f "wrong-option ~a ~a" section name) #f)))
|
||||
|
||||
(define (accsum-tests)
|
||||
(let* ((account-alist (create-test-data))
|
||||
|
@ -38,10 +38,9 @@
|
||||
(gnc:options->sxml uuid options "test-balsheet-pnl" test-title))
|
||||
|
||||
(define (set-option! options section name value)
|
||||
(let ((option (gnc:lookup-option options section name)))
|
||||
(if option
|
||||
(gnc:option-set-value option value)
|
||||
(test-assert (format #f "wrong-option ~a ~a" section name) #f))))
|
||||
(if (gnc-lookup-option (gnc:optiondb options) section name)
|
||||
(gnc-set-option (gnc:optiondb options) section name value)
|
||||
(test-assert (format #f "wrong-option ~a ~a" section name) #f)))
|
||||
|
||||
(define (mnemonic->commodity sym)
|
||||
(gnc-commodity-table-lookup
|
||||
|
@ -55,7 +55,7 @@
|
||||
(test-end "budget"))
|
||||
|
||||
(define (set-option options page tag value)
|
||||
((gnc:option-setter (gnc:lookup-option options page tag)) value))
|
||||
(gnc-set-option (gnc:optiondb options) page tag value))
|
||||
|
||||
(define (teardown)
|
||||
(gnc-clear-current-session))
|
||||
|
@ -38,7 +38,7 @@
|
||||
(test-null-txn))
|
||||
|
||||
(define (set-option options page tag value)
|
||||
((gnc:option-setter (gnc:lookup-option options page tag)) value))
|
||||
(gnc-set-option (gnc:optiondb options) page tag value))
|
||||
|
||||
(define (str->num str)
|
||||
(string->number
|
||||
|
@ -83,10 +83,9 @@
|
||||
|
||||
(define (test-net-chart-variant variant)
|
||||
(define (set-option! options section name value)
|
||||
(let ((option (gnc:lookup-option options section name)))
|
||||
(if option
|
||||
(gnc:option-set-value option value)
|
||||
(test-assert (format #f "[~a] wrong-option ~a ~a" variant section name) #f))))
|
||||
(if (gnc-lookup-option (gnc:optiondb options) section name)
|
||||
(gnc-set-option (gnc:optiondb options) section name value)
|
||||
(test-assert (format #f "[~a] wrong-option ~a ~a" variant section name) #f)))
|
||||
(let* ((uuid (variant->uuid variant))
|
||||
(inc-exp? (memq variant '(income-expense-barchart income-expense-linechart)))
|
||||
(env (create-test-env))
|
||||
@ -147,10 +146,9 @@
|
||||
|
||||
(define (test-chart-variant variant)
|
||||
(define (set-option! options section name value)
|
||||
(let ((option (gnc:lookup-option options section name)))
|
||||
(if option
|
||||
(gnc:option-set-value option value)
|
||||
(test-assert (format #f "[~a] wrong-option ~a ~a" variant section name) #f))))
|
||||
(if (gnc-lookup-option (gnc:optiondb options) section name)
|
||||
(gnc-set-option (gnc:optiondb options) section name value)
|
||||
(test-assert (format #f "[~a] wrong-option ~a ~a" variant section name) #f)))
|
||||
(let* ((uuid (variant->uuid variant))
|
||||
(env (create-test-env))
|
||||
(account-alist (env-create-account-structure-alist env structure))
|
||||
@ -254,4 +252,3 @@
|
||||
|
||||
((net-worth-barchart income-expense-barchart net-worth-linechart income-expense-linechart)
|
||||
(test-net-chart-variant variant)))))
|
||||
|
||||
|
@ -42,7 +42,7 @@
|
||||
(test-end "equity-statement"))
|
||||
|
||||
(define (set-option options page tag value)
|
||||
((gnc:option-setter (gnc:lookup-option options page tag)) value))
|
||||
(gnc-set-option (gnc:optiondb options) page tag value))
|
||||
|
||||
(define (teardown)
|
||||
(gnc-clear-current-session))
|
||||
|
@ -27,10 +27,9 @@
|
||||
(gnc:options->sxml uuid options "test-ifrs-basis" test-title))
|
||||
|
||||
(define (set-option! options section name value)
|
||||
(let ((option (gnc:lookup-option options section name)))
|
||||
(if option
|
||||
(gnc:option-set-value option value)
|
||||
(test-assert (format #f "wrong-option ~a ~a" section name) #f))))
|
||||
(if (gnc-lookup-option (gnc:optiondb options) section name)
|
||||
(gnc-set-option (gnc:optiondb options) section name value)
|
||||
(test-assert (format #f "wrong-option ~a ~a" section name) #f)))
|
||||
|
||||
(define (null-test)
|
||||
;; This null-test tests for the presence of report.
|
||||
|
@ -52,10 +52,9 @@
|
||||
1 row col))
|
||||
|
||||
(define (set-option! options section name value)
|
||||
(let ((option (gnc:lookup-option options section name)))
|
||||
(if option
|
||||
(gnc:option-set-value option value)
|
||||
(test-assert (format #f "wrong-option ~a ~a" section name) #f))))
|
||||
(if (gnc-lookup-option (gnc:optiondb options) section name)
|
||||
(gnc-set-option (gnc:optiondb options) section name value)
|
||||
(test-assert (format #f "wrong-option ~a ~a" section name) #f)))
|
||||
|
||||
(define structure
|
||||
(list "Root" (list (cons 'type ACCT-TYPE-ASSET)
|
||||
|
@ -49,10 +49,9 @@
|
||||
(sxml->table-row-col sxml 3 row col))
|
||||
|
||||
(define (set-option! options section name value)
|
||||
(let ((option (gnc:lookup-option options section name)))
|
||||
(if option
|
||||
(gnc:option-set-value option value)
|
||||
(test-assert (format #f "wrong-option ~a ~a" section name) #f))))
|
||||
(if (gnc-lookup-option (gnc:optiondb options) section name)
|
||||
(gnc-set-option (gnc:optiondb options) section name value)
|
||||
(test-assert (format #f "wrong-option ~a ~a" section name) #f)))
|
||||
|
||||
(define (get-currency sym)
|
||||
(gnc-commodity-table-lookup
|
||||
|
@ -53,10 +53,9 @@
|
||||
(sxml->table-row-col sxml 3 row col))
|
||||
|
||||
(define (set-option! options section name value)
|
||||
(let ((option (gnc:lookup-option options section name)))
|
||||
(if option
|
||||
(gnc:option-set-value option value)
|
||||
(test-assert (format #f "wrong-option ~a ~a" section name) #f))))
|
||||
(if (gnc-lookup-option (gnc:optiondb options) section name)
|
||||
(gnc-set-option (gnc:optiondb options) section name value)
|
||||
(test-assert (format #f "wrong-option ~a ~a" section name) #f)))
|
||||
|
||||
(define (get-currency sym)
|
||||
(gnc-commodity-table-lookup
|
||||
|
@ -50,10 +50,9 @@
|
||||
(gnc:options->sxml uuid options "test-apr" test-title))
|
||||
|
||||
(define (set-option! options section name value)
|
||||
(let ((option (gnc:lookup-option options section name)))
|
||||
(if option
|
||||
(gnc:option-set-value option value)
|
||||
(test-assert (format #f "wrong-option ~a ~a" section name) #f))))
|
||||
(if (gnc-lookup-option (gnc:optiondb options) section name)
|
||||
(gnc-set-option (gnc:optiondb options) section name value)
|
||||
(test-assert (format #f "wrong-option ~a ~a" section name) #f)))
|
||||
|
||||
(define (teardown)
|
||||
(gnc-clear-current-session))
|
||||
|
@ -42,7 +42,7 @@
|
||||
(test-end "register"))
|
||||
|
||||
(define (set-option options page tag value)
|
||||
((gnc:option-setter (gnc:lookup-option options page tag)) value))
|
||||
(gnc-set-option (gnc:optiondb options) page tag value))
|
||||
|
||||
(define (teardown)
|
||||
(gnc-clear-current-session))
|
||||
|
@ -46,7 +46,7 @@
|
||||
(export run-category-asset-liability-test)
|
||||
|
||||
(define (set-option options page tag value)
|
||||
((gnc:option-setter (gnc:lookup-option options page tag)) value))
|
||||
(gnc-set-option (gnc:optiondb options) page tag value))
|
||||
|
||||
(define (str->num str)
|
||||
(string->number
|
||||
|
@ -38,7 +38,7 @@
|
||||
(test-end "standard-net-barchart"))
|
||||
|
||||
(define (set-option options page tag value)
|
||||
((gnc:option-setter (gnc:lookup-option options page tag)) value))
|
||||
(gnc-set-option (gnc:optiondb options) page tag value))
|
||||
|
||||
(define (run-net-asset-income-test asset-report-uuid income-report-uuid)
|
||||
(null-test asset-report-uuid)
|
||||
|
@ -38,7 +38,7 @@
|
||||
(test-end "standard-net-linechart"))
|
||||
|
||||
(define (set-option options page tag value)
|
||||
((gnc:option-setter (gnc:lookup-option options page tag)) value))
|
||||
(gnc-set-option (gnc:optiondb options) page tag value))
|
||||
|
||||
(define (run-net-asset-test asset-report-uuid)
|
||||
(null-test asset-report-uuid)
|
||||
|
@ -77,9 +77,9 @@
|
||||
(else #f))
|
||||
(set! report-options-tested
|
||||
(cons (make-combo
|
||||
(gnc:option-section option)
|
||||
(gnc:option-name option)
|
||||
(case (gnc:option-type option)
|
||||
(GncOption-get-section option)
|
||||
(GncOption-get-name option)
|
||||
(case (GncOption-get-type option)
|
||||
((multichoice)
|
||||
(map (cut GncOption-permissible-value option <>)
|
||||
(iota (GncOption-num-permissible-values option))))
|
||||
@ -97,9 +97,8 @@
|
||||
(get-environment-variable "COMBINATORICS"))
|
||||
|
||||
(define (set-option! options section name value)
|
||||
(let ((option (gnc:lookup-option options section name)))
|
||||
(if option
|
||||
(gnc:option-set-value option value))))
|
||||
(if (gnc-lookup-option (gnc:optiondb options) section name)
|
||||
(gnc-set-option (gnc:optiondb options) section name value)))
|
||||
|
||||
;; code snippet to run report uuid, with options object
|
||||
(define (try-run-report uuid options option-summary)
|
||||
@ -130,10 +129,10 @@
|
||||
(newline)
|
||||
(for-each
|
||||
(lambda (idx)
|
||||
(when (gnc:lookup-option options "General" "Start Date")
|
||||
(when (gnc-lookup-option (gnc:optiondb options) "General" "Start Date")
|
||||
(set-option! options "General" "Start Date"
|
||||
(cons 'absolute (gnc-dmy2time64 1 12 1969))))
|
||||
(when (gnc:lookup-option options "General" "End Date")
|
||||
(when (gnc-lookup-option (gnc:optiondb options) "General" "End Date")
|
||||
(set-option! options "General" "End Date"
|
||||
(cons 'absolute (gnc-dmy2time64 1 1 1972))))
|
||||
(let loop ((report-options report-options)
|
||||
@ -174,10 +173,10 @@
|
||||
(get-name option)))
|
||||
report-options)
|
||||
(newline)
|
||||
(when (gnc:lookup-option options "General" "Start Date")
|
||||
(when (gnc-lookup-option (gnc:optiondb options) "General" "Start Date")
|
||||
(set-option! options "General" "Start Date"
|
||||
(cons 'absolute (gnc-dmy2time64 1 12 1969))))
|
||||
(when (gnc:lookup-option options "General" "End Date")
|
||||
(when (gnc-lookup-option (gnc:optiondb options) "General" "End Date")
|
||||
(set-option! options "General" "End Date"
|
||||
(cons 'absolute (gnc-dmy2time64 1 1 1972))))
|
||||
;; generate combinatorics
|
||||
|
@ -42,7 +42,7 @@
|
||||
(test-end "trial-balance"))
|
||||
|
||||
(define (set-option options page tag value)
|
||||
((gnc:option-setter (gnc:lookup-option options page tag)) value))
|
||||
(gnc-set-option (gnc:optiondb options) page tag value))
|
||||
|
||||
(define (teardown)
|
||||
(gnc-clear-current-session))
|
||||
|
Loading…
Reference in New Issue
Block a user