summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-20 14:29:28 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-20 15:41:49 -0400
commit42f94d2b8bcbc58abd5e09c0c1e98b8dd167552b (patch)
tree48ce22675748550d6f66d0f28503a34d05d72f15
parente05f29bff0c8c566845c06089aa5416a5166914f (diff)
downloadfork-ledger-42f94d2b8bcbc58abd5e09c0c1e98b8dd167552b.tar.gz
fork-ledger-42f94d2b8bcbc58abd5e09c0c1e98b8dd167552b.tar.bz2
fork-ledger-42f94d2b8bcbc58abd5e09c0c1e98b8dd167552b.zip
Added several new baseline tests
-rw-r--r--test/baseline/opt-abbrev-len.test2
-rw-r--r--test/baseline/opt-account-width.test11
-rw-r--r--test/baseline/opt-account.test12
-rw-r--r--test/baseline/opt-amount-data.test10
-rw-r--r--test/baseline/opt-amount-width.test11
-rw-r--r--test/baseline/opt-amount.test10
-rw-r--r--test/baseline/opt-anon.test11
-rw-r--r--test/baseline/opt-average.test244
-rwxr-xr-xtest/regress.py14
9 files changed, 318 insertions, 7 deletions
diff --git a/test/baseline/opt-abbrev-len.test b/test/baseline/opt-abbrev-len.test
index 58023785..7ef7df08 100644
--- a/test/baseline/opt-abbrev-len.test
+++ b/test/baseline/opt-abbrev-len.test
@@ -1,4 +1,4 @@
-reg --columns=80 --abbrev-len=4
+reg --args-only --columns=80 --abbrev-len=4
<<<
2007/02/02 RD VMMXX
Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00
diff --git a/test/baseline/opt-account-width.test b/test/baseline/opt-account-width.test
new file mode 100644
index 00000000..cddaae7e
--- /dev/null
+++ b/test/baseline/opt-account-width.test
@@ -0,0 +1,11 @@
+reg --args-only --columns=80 --account-width=40
+<<<
+2007/02/02 RD VMMXX
+ Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00
+ Income:Dividends:Vanguard:VMMXX $-0.35
+>>>1
+07-Feb-02 RD VMMXX Assets:Investments:Vanguard:VMMXX 0.350 VMMXX 0.350 VMMXX
+ Income:Dividends:Vanguard:VMMXX $-0.35 $-0.35
+ 0.350 VMMXX
+>>>2
+=== 0
diff --git a/test/baseline/opt-account.test b/test/baseline/opt-account.test
new file mode 100644
index 00000000..169df120
--- /dev/null
+++ b/test/baseline/opt-account.test
@@ -0,0 +1,12 @@
+bal --args-only --columns=80 --account=Master
+<<<
+2007/02/02 RD VMMXX
+ Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00
+ Income:Dividends:Vanguard:VMMXX $-0.35
+>>>1
+ $-0.35
+ 0.350 VMMXX Master
+ 0.350 VMMXX Assets:Investments:Vanguard:VMMXX
+ $-0.35 Income:Dividends:Vanguard:VMMXX
+>>>2
+=== 0
diff --git a/test/baseline/opt-amount-data.test b/test/baseline/opt-amount-data.test
new file mode 100644
index 00000000..b93eeeb9
--- /dev/null
+++ b/test/baseline/opt-amount-data.test
@@ -0,0 +1,10 @@
+reg --args-only --columns=80 --amount-data
+<<<
+2007/02/02 RD VMMXX
+ Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00
+ Income:Dividends:Vanguard:VMMXX $-0.35
+>>>1
+2007-02-02 0.350
+2007-02-02 -0.35
+>>>2
+=== 0
diff --git a/test/baseline/opt-amount-width.test b/test/baseline/opt-amount-width.test
new file mode 100644
index 00000000..fbdcb07b
--- /dev/null
+++ b/test/baseline/opt-amount-width.test
@@ -0,0 +1,11 @@
+reg --args-only --columns=80 --amount-width=18
+<<<
+2007/02/02 RD VMMXX
+ Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00
+ Income:Dividends:Vanguard:VMMXX $-0.35
+>>>1
+07-Feb-02 RD VMMXX As:In:Vanguard:VMMXX 0.350 VMMXX 0.350 VMMXX
+ In:Di:Vanguard:VMMXX $-0.35 $-0.35
+ 0.350 VMMXX
+>>>2
+=== 0
diff --git a/test/baseline/opt-amount.test b/test/baseline/opt-amount.test
new file mode 100644
index 00000000..2ba7d204
--- /dev/null
+++ b/test/baseline/opt-amount.test
@@ -0,0 +1,10 @@
+reg --args-only --columns=80 --amount 10
+<<<
+2007/02/02 RD VMMXX
+ Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00
+ Income:Dividends:Vanguard:VMMXX $-0.35
+>>>1
+07-Feb-02 RD VMMXX As:In:Vanguard:VMMXX 10 10
+ In:Di:Vanguard:VMMXX 10 20
+>>>2
+=== 0
diff --git a/test/baseline/opt-anon.test b/test/baseline/opt-anon.test
new file mode 100644
index 00000000..739bc5b7
--- /dev/null
+++ b/test/baseline/opt-anon.test
@@ -0,0 +1,11 @@
+reg --columns=80 --anon
+<<<
+2007/02/02 RD VMMXX
+ Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00
+ Income:Dividends:Vanguard:VMMXX $-0.35
+>>>1
+07-Feb-02 6a93dcb30aa7722e967.. ..8000cfb2807d6a978b43 0.350 VMMXX 0.350 VMMXX
+ ..b52e4fbac0065bfcc300 $-0.35 $-0.35
+ 0.350 VMMXX
+>>>2
+=== 0
diff --git a/test/baseline/opt-average.test b/test/baseline/opt-average.test
new file mode 100644
index 00000000..fc34682e
--- /dev/null
+++ b/test/baseline/opt-average.test
@@ -0,0 +1,244 @@
+reg --args-only --columns=80 --average books
+<<<
+2008/01/01 January
+ Expenses:Books $10.00
+ Assets:Cash
+
+2008/01/31 End of January
+ Expenses:Books $10.00
+ Assets:Cash
+
+2008/02/01 February
+ Expenses:Books $20.00
+ Assets:Cash
+
+2008/02/28 End of February
+ Expenses:Books $20.00
+ Assets:Cash
+
+2008/03/01 March
+ Expenses:Books $30.00
+ Assets:Cash
+
+2008/03/31 End of March
+ Expenses:Books $30.00
+ Assets:Cash
+
+2008/04/01 April
+ Expenses:Books $40.00
+ Assets:Cash
+
+2008/04/30 End of April
+ Expenses:Books $40.00
+ Assets:Cash
+
+2008/05/01 May
+ Expenses:Books $50.00
+ Assets:Cash
+
+2008/05/31 End of May
+ Expenses:Books $50.00
+ Assets:Cash
+
+2008/06/01 June
+ Expenses:Books $60.00
+ Assets:Cash
+
+2008/06/30 End of June
+ Expenses:Books $60.00
+ Assets:Cash
+
+2008/07/01 July
+ Expenses:Books $70.00
+ Assets:Cash
+
+2008/07/31 End of July
+ Expenses:Books $70.00
+ Assets:Cash
+
+2008/08/01 August
+ Expenses:Books $80.00
+ Assets:Cash
+
+2008/08/31 End of August
+ Expenses:Books $80.00
+ Assets:Cash
+
+2008/09/01 September
+ Expenses:Books $90.00
+ Assets:Cash
+
+2008/09/30 End of September
+ Expenses:Books $90.00
+ Assets:Cash
+
+2008/10/01 October
+ Expenses:Books $100.00
+ Assets:Cash
+
+2008/10/31 End of October
+ Expenses:Books $100.00
+ Assets:Cash
+
+2008/11/01 November
+ Expenses:Books $110.00
+ Assets:Cash
+
+2008/11/30 End of November
+ Expenses:Books $110.00
+ Assets:Cash
+
+2008/12/01 December
+ Expenses:Books $120.00
+ Assets:Cash
+
+2008/12/31 End of December
+ Expenses:Books $120.00
+ Assets:Cash
+
+2009/01/01 January
+ Expenses:Books $10.00
+ Assets:Cash
+
+2009/01/31 End of January
+ Expenses:Books $10.00
+ Assets:Cash
+
+2009/02/01 February
+ Expenses:Books $20.00
+ Assets:Cash
+
+2009/02/28 End of February
+ Expenses:Books $20.00
+ Assets:Cash
+
+2009/03/01 March
+ Expenses:Books $30.00
+ Assets:Cash
+
+2009/03/31 End of March
+ Expenses:Books $30.00
+ Assets:Cash
+
+2009/04/01 April
+ Expenses:Books $40.00
+ Assets:Cash
+
+2009/04/30 End of April
+ Expenses:Books $40.00
+ Assets:Cash
+
+2009/05/01 May
+ Expenses:Books $50.00
+ Assets:Cash
+
+2009/05/31 End of May
+ Expenses:Books $50.00
+ Assets:Cash
+
+2009/06/01 June
+ Expenses:Books $60.00
+ Assets:Cash
+
+2009/06/30 End of June
+ Expenses:Books $60.00
+ Assets:Cash
+
+2009/07/01 July
+ Expenses:Books $70.00
+ Assets:Cash
+
+2009/07/31 End of July
+ Expenses:Books $70.00
+ Assets:Cash
+
+2009/08/01 August
+ Expenses:Books $80.00
+ Assets:Cash
+
+2009/08/31 End of August
+ Expenses:Books $80.00
+ Assets:Cash
+
+2009/09/01 September
+ Expenses:Books $90.00
+ Assets:Cash
+
+2009/09/30 End of September
+ Expenses:Books $90.00
+ Assets:Cash
+
+2009/10/01 October
+ Expenses:Books $100.00
+ Assets:Cash
+
+2009/10/31 End of October
+ Expenses:Books $100.00
+ Assets:Cash
+
+2009/11/01 November
+ Expenses:Books $110.00
+ Assets:Cash
+
+2009/11/30 End of November
+ Expenses:Books $110.00
+ Assets:Cash
+
+2009/12/01 December
+ Expenses:Books $120.00
+ Assets:Cash
+
+2009/12/31 End of December
+ Expenses:Books $120.00
+ Assets:Cash
+>>>1
+08-Jan-01 January Expenses:Books $10.00 $10.00
+08-Jan-31 End of January Expenses:Books $10.00 $10.00
+08-Feb-01 February Expenses:Books $20.00 $13.33
+08-Feb-28 End of February Expenses:Books $20.00 $15.00
+08-Mar-01 March Expenses:Books $30.00 $18.00
+08-Mar-31 End of March Expenses:Books $30.00 $20.00
+08-Apr-01 April Expenses:Books $40.00 $22.86
+08-Apr-30 End of April Expenses:Books $40.00 $25.00
+08-May-01 May Expenses:Books $50.00 $27.78
+08-May-31 End of May Expenses:Books $50.00 $30.00
+08-Jun-01 June Expenses:Books $60.00 $32.73
+08-Jun-30 End of June Expenses:Books $60.00 $35.00
+08-Jul-01 July Expenses:Books $70.00 $37.69
+08-Jul-31 End of July Expenses:Books $70.00 $40.00
+08-Aug-01 August Expenses:Books $80.00 $42.67
+08-Aug-31 End of August Expenses:Books $80.00 $45.00
+08-Sep-01 September Expenses:Books $90.00 $47.65
+08-Sep-30 End of September Expenses:Books $90.00 $50.00
+08-Oct-01 October Expenses:Books $100.00 $52.63
+08-Oct-31 End of October Expenses:Books $100.00 $55.00
+08-Nov-01 November Expenses:Books $110.00 $57.62
+08-Nov-30 End of November Expenses:Books $110.00 $60.00
+08-Dec-01 December Expenses:Books $120.00 $62.61
+08-Dec-31 End of December Expenses:Books $120.00 $65.00
+09-Jan-01 January Expenses:Books $10.00 $62.80
+09-Jan-31 End of January Expenses:Books $10.00 $60.77
+09-Feb-01 February Expenses:Books $20.00 $59.26
+09-Feb-28 End of February Expenses:Books $20.00 $57.86
+09-Mar-01 March Expenses:Books $30.00 $56.90
+09-Mar-31 End of March Expenses:Books $30.00 $56.00
+09-Apr-01 April Expenses:Books $40.00 $55.48
+09-Apr-30 End of April Expenses:Books $40.00 $55.00
+09-May-01 May Expenses:Books $50.00 $54.85
+09-May-31 End of May Expenses:Books $50.00 $54.71
+09-Jun-01 June Expenses:Books $60.00 $54.86
+09-Jun-30 End of June Expenses:Books $60.00 $55.00
+09-Jul-01 July Expenses:Books $70.00 $55.41
+09-Jul-31 End of July Expenses:Books $70.00 $55.79
+09-Aug-01 August Expenses:Books $80.00 $56.41
+09-Aug-31 End of August Expenses:Books $80.00 $57.00
+09-Sep-01 September Expenses:Books $90.00 $57.80
+09-Sep-30 End of September Expenses:Books $90.00 $58.57
+09-Oct-01 October Expenses:Books $100.00 $59.53
+09-Oct-31 End of October Expenses:Books $100.00 $60.45
+09-Nov-01 November Expenses:Books $110.00 $61.56
+09-Nov-30 End of November Expenses:Books $110.00 $62.61
+09-Dec-01 December Expenses:Books $120.00 $63.83
+09-Dec-31 End of December Expenses:Books $120.00 $65.00
+>>>2
+=== 0
diff --git a/test/regress.py b/test/regress.py
index aff17687..e8da3f93 100755
--- a/test/regress.py
+++ b/test/regress.py
@@ -14,7 +14,7 @@ tests = sys.argv[2]
if not os.path.isfile(ledger):
sys.exit(1)
-if not os.path.isdir(tests):
+if not os.path.isdir(tests) and not os.path.isfile(tests):
sys.exit(1)
succeeded = 0
@@ -44,7 +44,7 @@ def test_regression(test_file):
else:
tempdata = tempfile.mkstemp()
- os.write(tempdata[0], string.join(data))
+ os.write(tempdata[0], string.join(data, ''))
os.close(tempdata[0])
command = ("%s -f \"%s\" " % (ledger, tempdata[1])) + command
@@ -74,7 +74,6 @@ def test_regression(test_file):
p.stdin.close()
success = True
-
printed = False
index = 0
for line in difflib.unified_diff(output, p.stdout.readlines()):
@@ -119,9 +118,12 @@ def test_regression(test_file):
if not use_stdin:
os.remove(tempdata[1])
-for test in os.listdir(tests):
- if re.search('\.test$', test):
- test_regression(os.path.join(tests, test))
+if os.path.isdir(tests):
+ for test in os.listdir(tests):
+ if re.search('\.test$', test):
+ test_regression(os.path.join(tests, test))
+else:
+ test_regression(tests)
print
if succeeded > 0: