diff options
| author | HarmoGlace <23212967+HarmoGlace@users.noreply.github.com> | 2023-04-13 14:38:51 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-13 14:38:51 +0200 |
| commit | e11bd2a193f170bebbb2723acc6c52bab2106b0c (patch) | |
| tree | 3bfb42b678ae6d4633d80ddaeaddb18d919c3de2 /tests | |
| parent | 89cf4054d61d296245b34a20f9ad0b749c0f83e2 (diff) | |
Add factorial, permutation and binomial to calculation functions (#639)
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/typ/compute/calc.typ | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/typ/compute/calc.typ b/tests/typ/compute/calc.typ index 18c2e2c9..9d52355c 100644 --- a/tests/typ/compute/calc.typ +++ b/tests/typ/compute/calc.typ @@ -115,6 +115,34 @@ #calc.log(10, base: -1) --- +// Test the `fact` function. +#test(calc.fact(0), 1) +#test(calc.fact(5), 120) + +--- +// Error: 12-14 the factorial result is too large +#calc.fact(21) + +--- +// Test the `perm` function. +#test(calc.perm(0, 0), 1) +#test(calc.perm(5, 3), 60) +#test(calc.perm(5, 5), 120) +#test(calc.perm(5, 6), 0) + +--- +// Error: 12-14 the permutation result is too large +#calc.perm(21, 21) + +--- +// Test the `binom` function. +#test(calc.binom(0, 0), 1) +#test(calc.binom(5, 3), 10) +#test(calc.binom(5, 5), 1) +#test(calc.binom(5, 6), 0) +#test(calc.binom(6, 2), 15) + +--- // Error: 10-12 expected at least one value #calc.min() |
