diff options
Diffstat (limited to 'misc/examples/sort.c')
| -rw-r--r-- | misc/examples/sort.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/misc/examples/sort.c b/misc/examples/sort.c index af74ff51..de94cede 100644 --- a/misc/examples/sort.c +++ b/misc/examples/sort.c @@ -42,6 +42,8 @@ int main(int argc, char *argv[]) { for (i = 0; i < 20; i++) printf(" " fmt_Elem, a[i]); puts(""); + for (i = 1; i < size; i++) + if (a[i - 1] > a[i]) return -1; testsort(a, size, "sorted"); @@ -55,7 +57,7 @@ int main(int argc, char *argv[]) { a[size - 1] = 0; testsort(a, size, "rotated"); - for (i = 0; i < size; i++) a[i] = i % (size / 2); + for (i = 0; i < size; i++) a[i] = i % (size / 8); testsort(a, size, "repeated"); free(a); |
