From e4a859c5e3289d28c371290798ce1a2d4440ceb4 Mon Sep 17 00:00:00 2001 From: Mark Baker Date: Sun, 8 Apr 2012 20:40:50 +0000 Subject: [PATCH] Unit tests git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@88997 2327b42d-5241-43d6-9e2a-de5ac946f064 --- .../rawTestData/Calculation/DateTime/HOUR.data | 1 + .../Calculation/DateTime/MINUTE.data | 1 + .../Calculation/DateTime/SECOND.data | 1 + .../Calculation/DateTime/WORKDAY.data | 1 + .../Calculation/Financial/ACCRINT.data | 5 +++++ .../Calculation/Financial/ACCRINTM.data | 6 +++++- .../Calculation/Financial/AMORDEGRC.data | 1 + .../Calculation/Financial/AMORLINC.data | 1 + .../Calculation/Financial/COUPDAYBS.data | 6 ++++++ .../Calculation/Financial/COUPDAYS.data | 6 ++++++ .../Calculation/Financial/COUPDAYSNC.data | 6 ++++++ .../Calculation/Financial/COUPNCD.data | 6 ++++++ .../Calculation/Financial/COUPNUM.data | 7 +++++++ .../Calculation/Financial/COUPPCD.data | 6 ++++++ .../Calculation/Financial/CUMIPMT.data | 10 ++++++++++ .../Calculation/Financial/CUMPRINC.data | 10 ++++++++++ .../rawTestData/Calculation/Financial/DB.data | 17 +++++++++++++++++ .../rawTestData/Calculation/Financial/DDB.data | 16 ++++++++++++++++ .../rawTestData/Calculation/Financial/DISC.data | 6 ++++++ .../Calculation/Financial/DOLLARDE.data | 10 ++++++++++ .../Calculation/Financial/DOLLARFR.data | 10 ++++++++++ 21 files changed, 132 insertions(+), 1 deletion(-) create mode 100644 unitTests/rawTestData/Calculation/Financial/COUPDAYBS.data create mode 100644 unitTests/rawTestData/Calculation/Financial/COUPDAYS.data create mode 100644 unitTests/rawTestData/Calculation/Financial/COUPDAYSNC.data create mode 100644 unitTests/rawTestData/Calculation/Financial/COUPNCD.data create mode 100644 unitTests/rawTestData/Calculation/Financial/COUPNUM.data create mode 100644 unitTests/rawTestData/Calculation/Financial/COUPPCD.data create mode 100644 unitTests/rawTestData/Calculation/Financial/CUMIPMT.data create mode 100644 unitTests/rawTestData/Calculation/Financial/CUMPRINC.data create mode 100644 unitTests/rawTestData/Calculation/Financial/DB.data create mode 100644 unitTests/rawTestData/Calculation/Financial/DDB.data create mode 100644 unitTests/rawTestData/Calculation/Financial/DISC.data create mode 100644 unitTests/rawTestData/Calculation/Financial/DOLLARDE.data create mode 100644 unitTests/rawTestData/Calculation/Financial/DOLLARFR.data diff --git a/unitTests/rawTestData/Calculation/DateTime/HOUR.data b/unitTests/rawTestData/Calculation/DateTime/HOUR.data index bcdfa13c..76276fd4 100644 --- a/unitTests/rawTestData/Calculation/DateTime/HOUR.data +++ b/unitTests/rawTestData/Calculation/DateTime/HOUR.data @@ -9,3 +9,4 @@ -3600, 0 7200, 3 65535, 19 +"1 O'Clock", "#VALUE!" diff --git a/unitTests/rawTestData/Calculation/DateTime/MINUTE.data b/unitTests/rawTestData/Calculation/DateTime/MINUTE.data index d7a75984..4de34c8a 100644 --- a/unitTests/rawTestData/Calculation/DateTime/MINUTE.data +++ b/unitTests/rawTestData/Calculation/DateTime/MINUTE.data @@ -9,3 +9,4 @@ -3600, 0 12500, 28 65535, 12 +"Half past 1 O'Clock", "#VALUE!" diff --git a/unitTests/rawTestData/Calculation/DateTime/SECOND.data b/unitTests/rawTestData/Calculation/DateTime/SECOND.data index d83a9d7a..d242875e 100644 --- a/unitTests/rawTestData/Calculation/DateTime/SECOND.data +++ b/unitTests/rawTestData/Calculation/DateTime/SECOND.data @@ -9,3 +9,4 @@ -3601, 59 12500, 20 65535, 15 +"Half past 1 O'Clock", "#VALUE!" diff --git a/unitTests/rawTestData/Calculation/DateTime/WORKDAY.data b/unitTests/rawTestData/Calculation/DateTime/WORKDAY.data index c4def47a..b1443380 100644 --- a/unitTests/rawTestData/Calculation/DateTime/WORKDAY.data +++ b/unitTests/rawTestData/Calculation/DateTime/WORKDAY.data @@ -10,3 +10,4 @@ "19-Dec-2008", 10, "25-Dec-2008", "26-Dec-2008", "01-Jan-2009", 39820 "19-Dec-2008", 10, {"25-Dec-2008"|"26-Dec-2008"|"01-Jan-2009"}, 39820 39820, -10, {"25-Dec-2008"|"26-Dec-2008"|"01-Jan-2009"}, 39801 +"5-Apr-2012", 3, {"6-Apr-2012"|"9-Apr-2012"}, 41010 diff --git a/unitTests/rawTestData/Calculation/Financial/ACCRINT.data b/unitTests/rawTestData/Calculation/Financial/ACCRINT.data index 6a510cf1..351fe27e 100644 --- a/unitTests/rawTestData/Calculation/Financial/ACCRINT.data +++ b/unitTests/rawTestData/Calculation/Financial/ACCRINT.data @@ -1,3 +1,8 @@ #Issue date 1st Interest Settlement Rate Par Freq Basis Result "2008-03-01", "2008-08-31", "2008-05-01", 0.10, 1000, 2, 0, 16.666666666667 "2008-03-05", "2008-08-31", "2008-05-01", 0.10, 1000, 2, 0, 15.555555555556 +"2010-01-01", "2010-06-30", "2010-04-01", 0.08, 10000, 4, 202.222222222222 +"2008-03-05", "2008-08-31", "2008-05-01", -0.10, 1000, 2, 0, "#NUM!" +"Invalid Date", "2008-08-31", "2008-05-01", 0.10, 1000, 2, 0, "#VALUE!" +"2008-03-01", "2008-08-31", "2008-05-01", "ABC", 1000, 2, 0, "#VALUE!" +"2008-03-01", "2008-08-31", "2008-05-01", 0.10, 1000, 2, "ABC", "#VALUE!" diff --git a/unitTests/rawTestData/Calculation/Financial/ACCRINTM.data b/unitTests/rawTestData/Calculation/Financial/ACCRINTM.data index 2c4dcf5c..ea77e1b3 100644 --- a/unitTests/rawTestData/Calculation/Financial/ACCRINTM.data +++ b/unitTests/rawTestData/Calculation/Financial/ACCRINTM.data @@ -1,2 +1,6 @@ #Issue date Settlement Rate Par Basis Result -"2008-04-01", "2008-06-15", 0.10, 1000, 3, 20.54795 +"2008-04-01", "2008-06-15", 0.10, 1000, 3, 20.547945205479 +"2010-01-01", "2010-12-31", 0.08, 10000, 800 +"2008-03-05", "2008-08-31", -0.10, 1000, 2, "#NUM!" +"Invalid Date", "2008-08-31", 0.10, 1000, 2, "#VALUE!" +"2008-03-01", "2008-08-31", "ABC", 1000, 2, "#VALUE!" diff --git a/unitTests/rawTestData/Calculation/Financial/AMORDEGRC.data b/unitTests/rawTestData/Calculation/Financial/AMORDEGRC.data index c81186f3..be2abd5c 100644 --- a/unitTests/rawTestData/Calculation/Financial/AMORDEGRC.data +++ b/unitTests/rawTestData/Calculation/Financial/AMORDEGRC.data @@ -1,2 +1,3 @@ #Cost Date purchased End of the 1st period Salvage Period Depreciation Basis Result 2400, "2008-08-19", "2008-12-31", 300, 1, 0.15, 1, 776 +150, "2011-01-01", "2011-09-30", 20, 1, 0.2, 4, 42 diff --git a/unitTests/rawTestData/Calculation/Financial/AMORLINC.data b/unitTests/rawTestData/Calculation/Financial/AMORLINC.data index cda631c5..42bfa4b8 100644 --- a/unitTests/rawTestData/Calculation/Financial/AMORLINC.data +++ b/unitTests/rawTestData/Calculation/Financial/AMORLINC.data @@ -1,2 +1,3 @@ #Cost Date purchased End of the 1st period Salvage Period Depreciation Basis Result 2400, "2008-08-19", "2008-12-31", 300, 1, 0.15, 1, 360 +150, "2011-01-01", "2011-09-30", 20, 1, 0.2, 4, 30 diff --git a/unitTests/rawTestData/Calculation/Financial/COUPDAYBS.data b/unitTests/rawTestData/Calculation/Financial/COUPDAYBS.data new file mode 100644 index 00000000..7b239560 --- /dev/null +++ b/unitTests/rawTestData/Calculation/Financial/COUPDAYBS.data @@ -0,0 +1,6 @@ +#Settlement Maturity Frequency Basis Result +"25-Jan-2007", "15-Nov-2008", 2, 1, 71 +"2011-01-01", "2012-10-25", 4, 66 +"Invalid Date", "15-Nov-2008", 2, 1, "#VALUE!" +"25-Jan-2007", "Invalid Date", 2, 1, "#VALUE!" +"25-Jan-2007", "15-Nov-2008", 3, 1, "#NUM!" diff --git a/unitTests/rawTestData/Calculation/Financial/COUPDAYS.data b/unitTests/rawTestData/Calculation/Financial/COUPDAYS.data new file mode 100644 index 00000000..f7e9baf3 --- /dev/null +++ b/unitTests/rawTestData/Calculation/Financial/COUPDAYS.data @@ -0,0 +1,6 @@ +#Settlement Maturity Frequency Basis Result +"25-Jan-2007", "15-Nov-2008", 2, 1, 181 +"2011-01-01", "2012-10-25", 4, 90 +"Invalid Date", "15-Nov-2008", 2, 1, "#VALUE!" +"25-Jan-2007", "Invalid Date", 2, 1, "#VALUE!" +"25-Jan-2007", "15-Nov-2008", 3, 1, "#NUM!" diff --git a/unitTests/rawTestData/Calculation/Financial/COUPDAYSNC.data b/unitTests/rawTestData/Calculation/Financial/COUPDAYSNC.data new file mode 100644 index 00000000..2bd5263a --- /dev/null +++ b/unitTests/rawTestData/Calculation/Financial/COUPDAYSNC.data @@ -0,0 +1,6 @@ +#Settlement Maturity Frequency Basis Result +"25-Jan-2007", "15-Nov-2008", 2, 1, 110 +"2011-01-01", "2012-10-25", 4, 24 +"Invalid Date", "15-Nov-2008", 2, 1, "#VALUE!" +"25-Jan-2007", "Invalid Date", 2, 1, "#VALUE!" +"25-Jan-2007", "15-Nov-2008", 3, 1, "#NUM!" diff --git a/unitTests/rawTestData/Calculation/Financial/COUPNCD.data b/unitTests/rawTestData/Calculation/Financial/COUPNCD.data new file mode 100644 index 00000000..8bdaa7f2 --- /dev/null +++ b/unitTests/rawTestData/Calculation/Financial/COUPNCD.data @@ -0,0 +1,6 @@ +#Settlement Maturity Frequency Basis Result +"25-Jan-2007", "15-Nov-2008", 2, 1, 39217 +"2011-01-01", "2012-10-25", 4, 40568 +"Invalid Date", "15-Nov-2008", 2, 1, "#VALUE!" +"25-Jan-2007", "Invalid Date", 2, 1, "#VALUE!" +"25-Jan-2007", "15-Nov-2008", 3, 1, "#NUM!" diff --git a/unitTests/rawTestData/Calculation/Financial/COUPNUM.data b/unitTests/rawTestData/Calculation/Financial/COUPNUM.data new file mode 100644 index 00000000..e3f7e82f --- /dev/null +++ b/unitTests/rawTestData/Calculation/Financial/COUPNUM.data @@ -0,0 +1,7 @@ +#Settlement Maturity Frequency Basis Result +"25-Jan-2007", "15-Nov-2008", 2, 1, 4 +"2011-01-01", "2012-10-25", 4, 0, 8 +"Invalid Date", "15-Nov-2008", 2, 1, "#VALUE!" +"25-Jan-2007", "Invalid Date", 2, 1, "#VALUE!" +"25-Jan-2007", "15-Nov-2008", 3, 1, "#NUM!" +"01-Jan-2008", "31-Dec-2012", 1, 1, 5 diff --git a/unitTests/rawTestData/Calculation/Financial/COUPPCD.data b/unitTests/rawTestData/Calculation/Financial/COUPPCD.data new file mode 100644 index 00000000..f6b23bd7 --- /dev/null +++ b/unitTests/rawTestData/Calculation/Financial/COUPPCD.data @@ -0,0 +1,6 @@ +#Settlement Maturity Frequency Basis Result +"25-Jan-2007", "15-Nov-2008", 2, 1, 39036 +"2011-01-01", "2012-10-25", 4, 40476 +"Invalid Date", "15-Nov-2008", 2, 1, "#VALUE!" +"25-Jan-2007", "Invalid Date", 2, 1, "#VALUE!" +"25-Jan-2007", "15-Nov-2008", 3, 1, "#NUM!" diff --git a/unitTests/rawTestData/Calculation/Financial/CUMIPMT.data b/unitTests/rawTestData/Calculation/Financial/CUMIPMT.data new file mode 100644 index 00000000..cf6b6763 --- /dev/null +++ b/unitTests/rawTestData/Calculation/Financial/CUMIPMT.data @@ -0,0 +1,10 @@ +#rate nper pv start_period end_period type result +0.0075, 360, 125000, 13, 24, 0, -11135.232130751 +0.0075, 360, 125000, 1, 1, 0, -937.50 +0.004166666667, 60, 50000, 1, 12, 0, -2294.9775375121 +0.004166666667, 60, 50000, 13, 24, 0, -1833.1000667254 +0.004166666667, 60, 50000, 25, 36, 0, -1347.5920679425 +0.004166666667, 60, 50000, 37, 48, 0, -837.24455850309 +0.004166666667, 60, 50000, 49, 60, 0, -300.78670189939 +0.0075, 360, 125000, 24, 13, 0, "#VALUE!" +0.0075, 360, 125000, 24, 13, 2, "#NUM!" diff --git a/unitTests/rawTestData/Calculation/Financial/CUMPRINC.data b/unitTests/rawTestData/Calculation/Financial/CUMPRINC.data new file mode 100644 index 00000000..ca340c78 --- /dev/null +++ b/unitTests/rawTestData/Calculation/Financial/CUMPRINC.data @@ -0,0 +1,10 @@ +#rate nper pv start_period end_period type result +0.0075, 360, 125000, 13, 24, 0, -934.10712342088 +0.0075, 360, 125000, 1, 1, 0, -68.278271180977 +0.004166666667, 60, 50000, 1, 12, 0, -9027.7626490046 +0.004166666667, 60, 50000, 13, 24, 0, -9489.6401197913 +0.004166666667, 60, 50000, 25, 36, 0, -9975.1481185741 +0.004166666667, 60, 50000, 37, 48, 0, -10485.495628014 +0.004166666667, 60, 50000, 49, 60, 0, -11021.953484617 +0.0075, 360, 125000, 24, 13, 0, "#VALUE!" +0.0075, 360, 125000, 24, 13, 2, "#NUM!" diff --git a/unitTests/rawTestData/Calculation/Financial/DB.data b/unitTests/rawTestData/Calculation/Financial/DB.data new file mode 100644 index 00000000..eb38638d --- /dev/null +++ b/unitTests/rawTestData/Calculation/Financial/DB.data @@ -0,0 +1,17 @@ +#cost salvage life period month result +1000000, 100000, 6, 1, 7, 186083.33333333 +1000000, 100000, 6, 2, 7, 259639.41666667 +1000000, 100000, 6, 3, 7, 176814.44275 +1000000, 100000, 6, 4, 7, 120410.63551275 +1000000, 100000, 6, 5, 7, 81999.642784183 +1000000, 100000, 6, 6, 7, 55841.756736028 +1000000, 100000, 6, 7, 7, 15845.098473848 +10000, 1000, 5, 1, 6, 1845.00 +10000, 1000, 5, 2, 6, 3009.195 +10000, 1000, 5, 3, 6, 1898.802045 +10000, 1000, 5, 4, 6, 1198.144090395 +10000, 1000, 5, 5, 6, 756.02892103925 +10000, 1000, 5, 6, 6, 238.52712458788 +0, 0, 5, 6, 6, 0.0 +-1000, 100, 5, 6, 6, "#NUM!" +"ABC", 100, 5, 6, 6, "#VALUE!" diff --git a/unitTests/rawTestData/Calculation/Financial/DDB.data b/unitTests/rawTestData/Calculation/Financial/DDB.data new file mode 100644 index 00000000..c8002f77 --- /dev/null +++ b/unitTests/rawTestData/Calculation/Financial/DDB.data @@ -0,0 +1,16 @@ +#cost salvage life period month result +2400, 300, 36500, 1, 0.13150684931507 +2400, 300, 36500, 2, 0.13149964346031 +2400, 300, 36500, 7, 0.13146362010871 +2400, 300, 36500, 7, 14, 0.91843145432708 +2400, 300, 120, 1, 2, 40.00 +2400, 300, 10, 1, 2, 480.00 +2400, 300, 10, 2, 1.5, 306.00 +2400, 300, 10, 10, 22.12254720000030 +10000, 1000, 5, 1, 4000.00 +10000, 1000, 5, 2, 2400.00 +10000, 1000, 5, 3, 1440.00 +10000, 1000, 5, 4, 864.00 +10000, 1000, 5, 5, 296.00 +-2400, 300, 36500, 1, "#NUM!" +"ABC", 300, 36500, 1, "#VALUE!" diff --git a/unitTests/rawTestData/Calculation/Financial/DISC.data b/unitTests/rawTestData/Calculation/Financial/DISC.data new file mode 100644 index 00000000..d14b1980 --- /dev/null +++ b/unitTests/rawTestData/Calculation/Financial/DISC.data @@ -0,0 +1,6 @@ +#settlement maturity price redemption basis result +"2007-01-25", "2007-06-15", 97.975, 100, 1, 0.052420213 +"2010-04-01", "2015-03-31", 95, 100, 0.01 +"2010-04-01", "2015-03-31", 0, 100, "#NUM!" +"2010-04-01", "2015-03-31", "ABC", 100, "#VALUE!" +"Invalid Date", "2007-06-15", 97.975, 100, 1, "#VALUE!" diff --git a/unitTests/rawTestData/Calculation/Financial/DOLLARDE.data b/unitTests/rawTestData/Calculation/Financial/DOLLARDE.data new file mode 100644 index 00000000..c11b9fc4 --- /dev/null +++ b/unitTests/rawTestData/Calculation/Financial/DOLLARDE.data @@ -0,0 +1,10 @@ +#fractional_dollar fraction result +1.02, 16, 1.125 +1.1, 32, 1.3125 +1.01, 16, 1.0625 +1.1, 16, 1.625 +1.03, 32, 1.09375 +1.3, 32, 1.9375 +1.12, 32, 1.375 +1.2345, 0, "#DIV/0!" +1.2345, -2, "#NUM!" diff --git a/unitTests/rawTestData/Calculation/Financial/DOLLARFR.data b/unitTests/rawTestData/Calculation/Financial/DOLLARFR.data new file mode 100644 index 00000000..2a3dead6 --- /dev/null +++ b/unitTests/rawTestData/Calculation/Financial/DOLLARFR.data @@ -0,0 +1,10 @@ +#decimal_dollar fraction result +1.125, 16, 1.02 +1.125, 32, 1.04 +1.0625, 16, 1.01 +1.625, 16, 1.1 +1.09375, 32, 1.03 +1.9375, 32, 1.3 +1.375, 32, 1.12 +1.2345, 0, "#DIV/0!" +1.2345, -2, "#NUM!"