]> gitweb.factorcode.org Git - factor.git/blob - extra/bank/bank-tests.factor
mason: made build targets into a table and added timestamp on report
[factor.git] / extra / bank / bank-tests.factor
1 USING: accessors arrays bank calendar kernel math math.functions
2 namespaces make tools.test tools.walker ;
3 FROM: bank => balance>> ;
4 IN: bank.tests
5
6 SYMBOL: my-account
7 "Alex's Take Over the World Fund" 0.07 1 2007 11 1 <date> 6101.94 open-account
8 my-account [
9     [ 6137 ] [ my-account get 2007 12 2 <date> process-to-date balance>> round >integer ] unit-test
10     [ 6137 ] [ my-account get 2007 12 2 <date> process-to-date balance>> round >integer ] unit-test
11 ] with-variable
12
13 "Petty Cash" 0.07 1 2006 12 1 <date> 10962.18 open-account
14 my-account [
15     [ 11027 ] [ my-account get 2007 1 2 <date> process-to-date balance>> round >integer ] unit-test
16 ] with-variable
17
18 "Saving to buy a pony" 0.0725 1 2008 3 3 <date> 11106.24 open-account
19 my-account [
20     [ 8416 ] [
21         my-account get [
22            2008 3 11 <date> -750 "Need to buy food" <transaction> ,
23            2008 3 25 <date> -500 "Going to a party" <transaction> ,
24            2008 4  8 <date> -800 "Losing interest in the pony..." <transaction> ,
25            2008 4  8 <date> -700 "Buying a rocking horse" <transaction> ,
26         ] { } make inserting-transactions balance>> round >integer
27     ] unit-test
28 ] with-variable
29
30 { 6781 } [
31     "..." 0.07 1 2007 4 10 <date> 4398.50 open-account
32     2007 10 26 <date> 2000 "..." <transaction> 1array inserting-transactions
33     2008 4 10 <date> process-to-date dup balance>> swap unpaid-interest>> + round >integer
34 ] unit-test