Files
gnucash/libgnucash/engine/test/test-split.scm
Geert Janssens 83d14e1c1c Restructure the src directory
It is split into
- /libgnucash (for the non-gui bits)
- /gnucash (for the gui)
- /common (misc source files used by both)
- /bindings (currently only holds python bindings)

This is the first step in restructuring the code. It will need much
more fine tuning later on.
2017-08-10 18:45:00 +02:00

29 lines
1.2 KiB
Scheme

(use-modules (gnucash gnc-module))
(use-modules (srfi srfi-1))
(gnc:module-begin-syntax (gnc:module-load "gnucash/app-utils" 0))
(use-modules (gnucash engine))
(use-modules (gnucash engine test test-extras))
(use-modules (gnucash app-utils))
(define (run-test)
(test test-split-in-list?))
(define (test-split-in-list?)
(let* ((env (create-test-env))
(today (gnc:date->timepair (gnc-localtime (current-time))))
(account-alist (env-create-test-accounts env))
(bank-account (cdr (assoc "Bank" account-alist)))
(expense-account (cdr (assoc "Expenses" account-alist)))
(wallet-account (cdr (assoc "Wallet" account-alist)))
(tx1 (env-create-transaction env today bank-account wallet-account (gnc:make-gnc-numeric 20 1)))
(tx2 (env-create-transaction env today bank-account expense-account (gnc:make-gnc-numeric 10 1)))
(splits-tx1 (xaccTransGetSplitList tx1))
(splits-tx2 (xaccTransGetSplitList tx2)))
(and (split-in-list? (first splits-tx1) splits-tx1)
(split-in-list? (second splits-tx1) splits-tx1)
(not (split-in-list? (first splits-tx1) splits-tx2))
(not (split-in-list? (second splits-tx1) splits-tx2))
(not (split-in-list? (first splits-tx1) '())))))