add a test on Birthday's problema
authorLaurent Mazet <laurent.mazet@thalesgroup.com>
Tue, 21 Nov 2023 11:26:44 +0000 (12:26 +0100)
committerLaurent Mazet <laurent.mazet@thalesgroup.com>
Tue, 21 Nov 2023 11:26:44 +0000 (12:26 +0100)
calc.c

diff --git a/calc.c b/calc.c
index 98ca963c74e5e45decb1d20816ac740c78ff9430..b2b3fbf689ac21f655dd99657f7ed38480c1a2dd 100644 (file)
--- a/calc.c
+++ b/calc.c
@@ -416,4 +416,7 @@ int main (int argc, char *argv[])
 // Factorial sequence
 // test: echo -e 'prog (1, cond (arg (1) > 1, arg (1) * call (1, arg (1) - 1), 1))\ncall (1, 10)' | calc.exe | grep -q '=> 3.6288e+06'
 
+// Birthday problem
+// test: echo -e '{sto (1, 365), sto (2, 0), sto (10, 1), while (inc (2) < 50, {sto (10, rcl (10) * (rcl (1) - rcl (2)) / rcl (1)), print (rcl (2) + 1), print ((1 - rcl (10)) * 100)})};' | calc.exe | grep -q '=> 97.0374'
+
 /* vim: set ts=4 sw=4 et: */