From 7f7cef430ec78ccb811989093098cd2d9243070d Mon Sep 17 00:00:00 2001 From: Jacob Hume Date: Wed, 8 Sep 2010 19:06:29 +0100 Subject: [PATCH] Added factorial test case --- gcc/testsuite/python.dg/t_recursion_1.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 gcc/testsuite/python.dg/t_recursion_1.py diff --git a/gcc/testsuite/python.dg/t_recursion_1.py b/gcc/testsuite/python.dg/t_recursion_1.py new file mode 100644 index 00000000000..edc95b1f9ea --- /dev/null +++ b/gcc/testsuite/python.dg/t_recursion_1.py @@ -0,0 +1,27 @@ +# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE +# Version 2, December 2004 +# +# Copyright (C) 2004 Sam Hocevar +# +# Everyone is permitted to copy and distribute verbatim or modified +# copies of this license document, and changing it is allowed as long +# as the name is changed. +# +# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE +# TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION +# +# 0. You just DO WHAT THE FUCK YOU WANT TO. +# + +# @Author windigo - jacob@fragdev.com +# @Date 30/8/10 +# @Expected Result: <120> +# -Tested against Python Version <2.6.5> + +def factorial ( x ): + if x > 1: + return x * factorial ( x - 1 ) + else: + return 1 + +print factorial( 5 ) \ No newline at end of file -- 2.11.4.GIT