Skip to content

Commit b5b8b95

Browse files
committed
test/odf-validate: more calcval cases for the post-#523 functions
Edge cases for ISOWEEKNUM, HYPGEOMDIST, F.DIST, F.INV, FINDB, SEARCHB and REPLACEB, from Pedro's cases with the expected values recomputed; several of his were wrong. SEARCHB goes by regex, not wildcards.
1 parent af013fe commit b5b8b95

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

‎test/odf-validate/calcval-cases14.tsv‎

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,3 +375,54 @@ ODDFPRICE.redemption =ODDFPRICE(DATE(2008;11;11);DATE(2021;3;1);DATE(2008;10;15)
375375
ODDFYIELD.short =ODDFYIELD(DATE(2008;11;11);DATE(2021;3;1);DATE(2008;10;15);DATE(2009;3;1);0.0575;84.5;100;2;0) cell 0.07724554159781741 6.12.32 Excel example
376376
ODDFYIELD.long =ODDFYIELD(DATE(2022;8;2);DATE(2028;4;5);DATE(2021;11;16);DATE(2023;10;5);0.0764;ODDFPRICE(DATE(2022;8;2);DATE(2028;4;5);DATE(2021;11;16);DATE(2023;10;5);0.0764;0.1492;100;2;2);100;2;2) cell 0.1492 6.12.32 inverse of ODDFPRICE
377377
ODDFYIELD.redemption =ODDFYIELD(DATE(2008;11;11);DATE(2021;3;1);DATE(2008;10;15);DATE(2009;3;1);0.0575;84.5;0;2;0) cell #ERR 6.12.32 Redemption > 0
378+
ISOWEEKNUM.jan1.mon =ISOWEEKNUM(DATE(2024;1;1)) cell 1 6.10.12 Monday 2024-01-01 starts week 1
379+
ISOWEEKNUM.jan1.wed =ISOWEEKNUM(DATE(2025;1;1)) cell 1 6.10.12 Wednesday 2025-01-01 is in week 1
380+
ISOWEEKNUM.jan4 =ISOWEEKNUM(DATE(2024;1;4)) cell 1 6.10.12 January 4 is always in week 1
381+
ISOWEEKNUM.dec31 =ISOWEEKNUM(DATE(2024;12;31)) cell 1 6.10.12 Tuesday 2024-12-31 is in week 1 of 2025
382+
ISOWEEKNUM.week53.2015 =ISOWEEKNUM(DATE(2015;12;31)) cell 53 6.10.12 2015 has 53 weeks
383+
ISOWEEKNUM.week52.2021 =ISOWEEKNUM(DATE(2021;12;31)) cell 52 6.10.12 Friday 2021-12-31 is in week 52
384+
ISOWEEKNUM.dec28.2020 =ISOWEEKNUM(DATE(2020;12;28)) cell 53 6.10.12 Monday 2020-12-28 starts week 53
385+
ISOWEEKNUM.jan4.2023 =ISOWEEKNUM(DATE(2023;1;4)) cell 1 6.10.12 Wednesday 2023-01-04 is in week 1
386+
ISOWEEKNUM.dec28.2023 =ISOWEEKNUM(DATE(2023;12;28)) cell 52 6.10.12 Thursday 2023-12-28 is in week 52
387+
ISOWEEKNUM.leap.feb28 =ISOWEEKNUM(DATE(2024;2;28)) cell 9 6.10.12 around the leap day
388+
ISOWEEKNUM.leap.feb29 =ISOWEEKNUM(DATE(2024;2;29)) cell 9 6.10.12 the leap day
389+
ISOWEEKNUM.leap.mar1 =ISOWEEKNUM(DATE(2024;3;1)) cell 9 6.10.12 after the leap day
390+
ISOWEEKNUM.y2000 =ISOWEEKNUM(DATE(2000;1;1)) cell 52 6.10.12 Saturday 2000-01-01 is in week 52 of 1999
391+
ISOWEEKNUM.y2100 =ISOWEEKNUM(DATE(2100;1;1)) cell 53 6.10.12 Friday 2100-01-01 is in week 53 of 2099
392+
ISOWEEKNUM.sunday =ISOWEEKNUM(DATE(2024;6;16)) cell 24 6.10.12 weeks end on Sunday
393+
ISOWEEKNUM.monday =ISOWEEKNUM(DATE(2024;6;17)) cell 25 6.10.12 weeks start on Monday
394+
ISOWEEKNUM.timefrac =ISOWEEKNUM(DATE(2024;6;15)+0.5) cell 24 6.10.12 the time of day is ignored
395+
ISOWEEKNUM.text =ISOWEEKNUM("not a date") cell #ERR 6.10.12 text that is no date
396+
HYPGEOMDIST.x0.pmf =HYPGEOMDIST(0;5;10;20) cell 0.016253869969040248 6.18.37 x = 0
397+
HYPGEOMDIST.x0.cdf =HYPGEOMDIST(0;5;10;20;1) cell 0.016253869969040248 6.18.37 cumulative at x = 0 is the probability of 0
398+
HYPGEOMDIST.small.pmf =HYPGEOMDIST(1;4;4;10;0) cell 0.38095238095238093 6.18.37 C(4,1)C(6,3)/C(10,4)
399+
HYPGEOMDIST.small.cdf =HYPGEOMDIST(1;4;4;10;1) cell 0.4523809523809524 6.18.37 cumulative, x past the mode
400+
HYPGEOMDIST.high.pmf =HYPGEOMDIST(2;2;90;100;0) cell 0.8090909090909091 6.18.37 mass close to 1
401+
HYPGEOMDIST.high.cdf =HYPGEOMDIST(2;2;90;100;1) cell 1 6.18.37 x = n takes in every outcome
402+
HYPGEOMDIST.x.neg =HYPGEOMDIST(-1;5;10;20) cell #ERR 6.18.37 x < 0
403+
HYPGEOMDIST.x.gt.M =HYPGEOMDIST(3;5;2;20) cell #ERR 6.18.37 x > M
404+
HYPGEOMDIST.n.gt.N =HYPGEOMDIST(1;11;5;10) cell #ERR 6.18.37 n > N
405+
HYPGEOMDIST.M.gt.N =HYPGEOMDIST(1;1;21;20) cell #ERR 6.18.37 M > N
406+
HYPGEOMDIST.x.lt.min =HYPGEOMDIST(0;10;15;20) cell #ERR 6.18.37 x < n - N + M
407+
HYPGEOMDIST.cdf.x.gt.n =HYPGEOMDIST(6;5;10;20;1) cell #ERR 6.18.37 the cumulative form checks the domain too
408+
F.DIST.df1.huge =F.DIST(2.5;1E10;10) cell #ERR 6.18.22 degrees of freedom below 1E10
409+
F.DIST.df2.huge =F.DIST(2.5;5;1E10) cell #ERR 6.18.22 degrees of freedom below 1E10
410+
F.DIST.df.floor =F.DIST(2.5;5.9;10.9)-F.DIST(2.5;5;10) cell 0 degrees of freedom are truncated to integers
411+
F.INV.df1.huge =F.INV(0.5;1E10;10) cell #ERR 6.18.24 degrees of freedom below 1E10
412+
F.INV.df2.huge =F.INV(0.5;5;1E10) cell #ERR 6.18.24 degrees of freedom below 1E10
413+
F.INV.df.bad =F.INV(0.5;0;10) cell #ERR 6.18.24 degrees of freedom of at least 1
414+
F.INV.p.neg =F.INV(-0.1;5;10) cell #ERR 6.18.24 probability below 0
415+
F.INV.p.over =F.INV(1.5;5;10) cell #ERR 6.18.24 probability above 1
416+
FINDB.start.second =FINDB("b";"abc";2) cell 2 6.7.2 start at the match
417+
FINDB.dbcs.first =FINDB("中";"中国") cell 1 6.7.2 first CJK character is at byte 1
418+
FINDB.dbcs.start =FINDB("国";"中国";3) cell 3 6.7.2 start at the second CJK character
419+
SEARCHB.regex.dot =SEARCHB("a.c";"abc") cell 1 6.7.8 regular expressions are on in a new document
420+
SEARCHB.regex.star =SEARCHB("a*c";"abc") cell 1 6.7.8 regular expression, not a wildcard
421+
SEARCHB.regex.opt =SEARCHB("a?c";"abc") cell 3 6.7.8 a? is optional a, so the match is the c; as a wildcard it would be 1
422+
SEARCHB.mixed =SEARCHB("b";"a中b") cell 4 6.7.8 1 + 2 bytes before b
423+
SEARCHB.start.past =SEARCHB("a";"abc";4) cell #ERR 6.7.8 start past the text
424+
REPLACEB.multi =REPLACEB("abcdef";2;2;"xy") cell s:axydef 6.7.6 replace two bytes
425+
REPLACEB.all =REPLACEB("abc";1;3;"xyz") cell s:xyz 6.7.6 replace the whole text
426+
REPLACEB.start.past =REPLACEB("abc";10;1;"x") cell s:abcx 6.7.6 start far past the end appends
427+
REPLACEB.dbcs.first =REPLACEB("中国";1;2;"家") cell s:家国 6.7.6 first CJK character is bytes 1-2
428+
REPLACEB.dbcs.last =REPLACEB("中国";3;2;"家") cell s:中家 6.7.6 second CJK character is bytes 3-4

0 commit comments

Comments
 (0)