From: W. Trevor King Date: Fri, 29 Oct 2010 15:42:46 +0000 (-0400) Subject: Copy sort-check from src/sorting/main.c to assignments/archive/sorting/soln/main.c. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=157d4a7ff67f168aeabe77985a126f560e6ff571;p=parallel_computing.git Copy sort-check from src/sorting/main.c to assignments/archive/sorting/soln/main.c. --- diff --git a/assignments/archive/sorting/soln/main.c b/assignments/archive/sorting/soln/main.c index 0810318..9bcb219 100644 --- a/assignments/archive/sorting/soln/main.c +++ b/assignments/archive/sorting/soln/main.c @@ -320,6 +320,14 @@ void master(int rank, int size, const char *file_name) printarray(stderr, array_size, array, NUM_SHOWN); fprintf(stderr, "check: sum of %d elements = %g\n", array_size, checkarray(array_size, array)); + for (i = 0; i < array_size - 1; i++) { + if (array[i] > array[i + 1]) { + fprintf(stderr, + "error: sorted array[%d] = %g > %g = array[%d]\n", + i, array[i], array[i + 1], i + 1); + exit(EXIT_FAILURE); + } + } #endif /* DEBUG */ #ifdef DEBUG_TIMING