/*! \file gksort.c \brief Testing module for the various sorting routines in GKlib \date Started 4/4/2007 \author George \version\verbatim $Id: gksort.c 11058 2011-11-10 00:02:50Z karypis $ \endverbatim */ #include #define N 10000 /*************************************************************************/ /*! Testing module for gk_?isort() routine */ /*************************************************************************/ void test_isort() { gk_idx_t i; int array[N]; /* test the increasing sort */ printf("Testing iisort...\n"); for (i=0; i array[i+1]) printf("gk_isorti error at index %jd [%d %d]\n", (intmax_t)i, array[i], array[i+1]); } /* test the decreasing sort */ printf("Testing disort...\n"); for (i=0; i array[i+1]) printf("gk_fsorti error at index %jd [%f %f]\n", (intmax_t)i, array[i], array[i+1]); } /* test the decreasing sort */ printf("Testing dfsort...\n"); for (i=0; i array[i+1]) printf("gk_idxsorti error at index %zd [%zd %zd]\n", (ssize_t)i, (ssize_t)array[i], (ssize_t)array[i+1]); } /* test the decreasing sort */ printf("Testing idxsortd...\n"); for (i=0; i array[i+1].key) printf("gk_ikvsorti error at index %jd [%d %d] [%jd %jd]\n", (intmax_t)i, array[i].key, array[i+1].key, (intmax_t)array[i].val, (intmax_t)array[i+1].val); } /* test the decreasing sort */ printf("Testing ikvsortd...\n"); for (i=0; i array[i+1].key) printf("gk_fkvsorti error at index %jd [%f %f] [%jd %jd]\n", (intmax_t)i, array[i].key, array[i+1].key, (intmax_t)array[i].val, (intmax_t)array[i+1].val); } /* test the decreasing sort */ printf("Testing fkvsortd...\n"); for (i=0; i array[i+1].key) printf("gk_dkvsorti error at index %jd [%lf %lf] [%jd %jd]\n", (intmax_t)i, array[i].key, array[i+1].key, (intmax_t)array[i].val, (intmax_t)array[i+1].val); } /* test the decreasing sort */ printf("Testing dkvsortd...\n"); for (i=0; i 0) printf("gk_skvsorti error at index %jd [%s %s] [%jd %jd]\n", (intmax_t)i, array[i].key, array[i+1].key, (intmax_t)array[i].val, (intmax_t)array[i+1].val); } /* test the decreasing sort */ printf("Testing skvsortd...\n"); for (i=0; i array[i+1].key) printf("gk_idxkvsorti error at index %zd [%zd %zd] [%zd %zd]\n", (ssize_t)i, (ssize_t)array[i].key, (ssize_t)array[i+1].key, (ssize_t)array[i].val, (ssize_t)array[i+1].val); } /* test the decreasing sort */ printf("Testing idxkvsortd...\n"); for (i=0; i