From a8efb670df4f76cbfeab976d3b2a898a065da8f6 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 31 May 2005 01:52:14 +0000 Subject: r7128: added recursion to bugs list (This used to be commit 645e645a4ee94af5cb8d6021c63a48322478582c) --- testprogs/ejs/bugs.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'testprogs/ejs') diff --git a/testprogs/ejs/bugs.js b/testprogs/ejs/bugs.js index 3a211f3bdc..01174f9eaf 100644 --- a/testprogs/ejs/bugs.js +++ b/testprogs/ejs/bugs.js @@ -69,8 +69,27 @@ function objbug() { } +/**************************************** +demo lack of recursion +fix in http://build.samba.org/build.pl?function=diff;tree=samba4;revision=7127 +*****************************************/ +function fibonacci(n) { + if (n < 3) { + return 1; + } + return fibonacci(n-1) + fibonacci(n-2); +} + +function recursebug() { + println("First 10 fibonacci numbers:"); + for (i=0;i<10;i++) { + println("fibonacci(" + i + ")=" + fibonacci(i)); + } +} + /* run the tests */ arraybug(); argsbug("one", "two", "three"); +recursebug(); objbug() -- cgit