commit 116f35a44a2f781646dd252a03a3a94ffdcbad5e
parent 037c716b6514cc717b7208457fb72085e4c278ab
Author: Quentin Carbonneaux <quentin.carbonneaux@yale.edu>
Date: Fri, 10 Jul 2015 03:16:39 -0400
add c version of some tests
Diffstat:
3 files changed, 50 insertions(+), 0 deletions(-)
diff --git a/proto/ctests/eucl.c b/proto/ctests/eucl.c
@@ -0,0 +1,17 @@
+#include <stdio.h>
+
+int main()
+{
+ int a = 123456;
+ int b = 32223;
+ int t;
+
+ do {
+ t = a % b;
+ a = b;
+ b = t;
+ } while (b);
+
+ printf("%d\n", a);
+ return 0;
+}
diff --git a/proto/ctests/pspill.c b/proto/ctests/pspill.c
@@ -0,0 +1,20 @@
+long f() {
+ long l00, l01, l02, l03, l04, l05, l06, l07, l08, l09, l10, l11, l12, l13;
+
+ l00 = 42;
+ l01 = l00 + l00;
+ l02 = l00 + l01;
+ l03 = l00 + l02;
+ l04 = l00 + l03;
+ l05 = l00 + l04;
+ l06 = l00 + l05;
+ l07 = l06 + l06;
+ l08 = l05 + l07;
+ l09 = l04 + l08;
+ l10 = l03 + l09;
+ l11 = l02 + l10;
+ l12 = l01 + l11;
+ l13 = l00 + l12;
+
+ return l13;
+}
diff --git a/proto/ctests/psum.c b/proto/ctests/psum.c
@@ -0,0 +1,13 @@
+long f() {
+ long n, n0, s;
+
+ s = 0;
+ n = 1234567;
+ for (;;) {
+ n0 = n - 1;
+ s = s + n;
+ if (!n0) break;
+ n = n0;
+ }
+ return s;
+}