summaryrefslogtreecommitdiff
path: root/test/c/qsort.c
diff options
context:
space:
mode:
authorGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2006-09-17 12:04:56 +0000
committerGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2006-09-17 12:04:56 +0000
commit2ec5b3fb2ccb0120be641e077089f3da5e53d8a3 (patch)
treed1e6f6a9a3d99f0095dc96fe320214de68918158 /test/c/qsort.c
parente37d620f5b9b05e16563545cba9c538f8d31c746 (diff)
Davantage de tests
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@104 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'test/c/qsort.c')
-rw-r--r--test/c/qsort.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/test/c/qsort.c b/test/c/qsort.c
index 1d70463..802ef9c 100644
--- a/test/c/qsort.c
+++ b/test/c/qsort.c
@@ -18,10 +18,10 @@ void quicksort(int lo, int hi, int base[])
}
}
-int cmplong(const void * i, const void * j)
+int cmpint(const void * i, const void * j)
{
- long vi = *((long *) i);
- long vj = *((long *) j);
+ int vi = *((int *) i);
+ int vj = *((int *) j);
if (vi == vj) return 0;
if (vi < vj) return -1;
return 1;
@@ -30,17 +30,17 @@ int cmplong(const void * i, const void * j)
int main(int argc, char ** argv)
{
int n, i;
- long * a, * b;
+ int * a, * b;
int bench = 0;
- if (argc >= 2) n = atoi(argv[1]); else n = 1000;
+ if (argc >= 2) n = atoi(argv[1]); else n = 1000000;
if (argc >= 3) bench = 1;
- a = malloc(n * sizeof(long));
- b = malloc(n * sizeof(long));
+ a = malloc(n * sizeof(int));
+ b = malloc(n * sizeof(int));
for (i = 0; i < n; i++) b[i] = a[i] = rand() & 0xFFFF;
quicksort(0, n - 1, a);
if (!bench) {
- qsort(b, n, sizeof(long), cmplong);
+ qsort(b, n, sizeof(int), cmpint);
for (i = 0; i < n; i++) {
if (a[i] != b[i]) { printf("Bug!\n"); return 2; }
}