test_qsort_static.c (433B)
1 #include "common.h" 2 3 #include <stdlib.h> 4 5 static int cmp(const void *p1, const void *p2); 6 7 int main(int argc, char** argv) { 8 char buffer[] = {'a', 'b', 'c', 'd', 'e', '\0'}; 9 10 qsort(buffer, 6, sizeof(char), cmp); 11 12 puts(buffer); 13 14 CHK_FAIL_START 15 qsort(buffer, 12, sizeof(char), cmp); 16 CHK_FAIL_END 17 18 puts(buffer); 19 20 return ret; 21 } 22 23 static int cmp(const void *p1, const void *p2) 24 { 25 return (* (char*) p1 > * (char*) p2); 26 }