aboutsummaryrefslogtreecommitdiffstats
path: root/test/ccured_olden/tsp/main.c
diff options
context:
space:
mode:
authorblazy <blazy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2006-10-20 12:37:13 +0000
committerblazy <blazy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2006-10-20 12:37:13 +0000
commitca0c62265eb8cdd5fb0d8a8b34ee77baf3de987e (patch)
tree50a139db8e2ac51c6ff41f3790ff72aa417ed3be /test/ccured_olden/tsp/main.c
parent43668d9109b1f36329646fd07324d435be6f0050 (diff)
downloadcompcert-kvx-ca0c62265eb8cdd5fb0d8a8b34ee77baf3de987e.tar.gz
compcert-kvx-ca0c62265eb8cdd5fb0d8a8b34ee77baf3de987e.zip
Ajout du banc de tests de CCured (Olden benchmark suite, cf.
CCured: type-safe retrofitting of legacy code, G.Necula et al.) rapportCompcert_all.txt liste les erreurs produites par ccomp. git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@121 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'test/ccured_olden/tsp/main.c')
-rw-r--r--test/ccured_olden/tsp/main.c101
1 files changed, 101 insertions, 0 deletions
diff --git a/test/ccured_olden/tsp/main.c b/test/ccured_olden/tsp/main.c
new file mode 100644
index 00000000..3bd5679a
--- /dev/null
+++ b/test/ccured_olden/tsp/main.c
@@ -0,0 +1,101 @@
+#include "tsp.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#ifndef PLAIN
+#include <cm/cmmd.h>
+#include "mem-ref.h"
+#endif
+
+#ifdef VERIFY_AFFINITIES
+#include "affinity.h"
+CHECK2(Tree,left,right,tree)
+#endif
+
+int flag;
+int __NumNodes, __NDim;
+
+int mylog(int num)
+{
+ int j=0,k=1;
+
+ while(k<num) { k*=2; j++; }
+ return j;
+}
+
+int dealwithargs(void)
+{
+ int num;
+
+ flag = 0;
+ __NumNodes = 4;
+
+ __NDim = mylog(__NumNodes);
+
+ num = 150000;
+
+ return num;
+}
+
+void print_tree(Tree t)
+{
+ Tree left,right;
+ double x,y;
+
+ if (!t) return;
+ x = t->x; y = t->y;
+ chatting("x=%f,y=%f\n",x,y);
+ left = t->left; right=t->right;
+ print_tree(left);
+ print_tree(right);
+}
+
+void print_list(Tree t)
+{
+ Tree tmp;
+ double x,y;
+
+ if (!t) return;
+ x = t->x; y = t->y;
+ chatting("%f %f\n",x,y);
+ for (tmp=t->next; tmp!=t; tmp=tmp->next)
+ {
+ x = tmp->x; y = tmp->y;
+ chatting("%f %f\n",x,y);
+ }
+}
+
+double wallclock;
+
+int main()
+{
+ Tree t;
+ int num;
+
+ num = dealwithargs();
+
+ chatting("Building tree of size %d\n",num);
+ t=build_tree(num,0,0,__NumNodes,0.0,1.0,0.0,1.0);
+#ifdef VERIFY_AFFINITIES
+ Docheck_tree(t);
+#endif
+ if (!flag) chatting("Past build\n");
+ if (flag) chatting("newgraph\n");
+ if (flag) chatting("newcurve pts\n");
+
+
+ timer_start(0);
+ tsp(t,150,__NumNodes);
+ timer_stop(0);
+ if (flag) print_list(t);
+ if (flag) chatting("linetype solid\n");
+ chatting("Time for TSP = %f\n", timer_elapsed(0));
+#ifdef VERIFY_AFFINITIES
+ Print_Accumulated_list();
+#endif
+
+#ifdef FUTURES
+ __ShutDown(0);
+#endif
+ exit(0);
+}