From 460a8df81f52435a7c4fa1c227576f814cd43006 Mon Sep 17 00:00:00 2001 From: "zik.saleeba" Date: Mon, 9 Mar 2009 00:49:01 +0000 Subject: [PATCH] Added missing tests git-svn-id: http://picoc.googlecode.com/svn/trunk@178 21eae674-98b7-11dd-bd71-f92a316d2d60 --- tests/14_if.c | 13 +++++++++++++ tests/14_if.expect | 2 ++ tests/15_recursion.c | 10 ++++++++++ tests/15_recursion.expect | 2 ++ 4 files changed, 27 insertions(+) create mode 100644 tests/14_if.c create mode 100644 tests/14_if.expect create mode 100644 tests/15_recursion.c create mode 100644 tests/15_recursion.expect diff --git a/tests/14_if.c b/tests/14_if.c new file mode 100644 index 0000000..6a1d43a --- /dev/null +++ b/tests/14_if.c @@ -0,0 +1,13 @@ +int a = 1; + +if (a) + printf("a is true\n"); +else + printf("a is false\n"); + +int b = 0; +if (b) + printf("b is true\n"); +else + printf("b is false\n"); + diff --git a/tests/14_if.expect b/tests/14_if.expect new file mode 100644 index 0000000..c32c415 --- /dev/null +++ b/tests/14_if.expect @@ -0,0 +1,2 @@ +a is true +b is false diff --git a/tests/15_recursion.c b/tests/15_recursion.c new file mode 100644 index 0000000..03a7845 --- /dev/null +++ b/tests/15_recursion.c @@ -0,0 +1,10 @@ +int fact(int i) { + if (i < 2) { + return i; + } + return (i * fact(i - 1)); +} + +fact(5) +fact(6) + diff --git a/tests/15_recursion.expect b/tests/15_recursion.expect new file mode 100644 index 0000000..7401823 --- /dev/null +++ b/tests/15_recursion.expect @@ -0,0 +1,2 @@ +120 +720