Exemple #1
0
int main(int argc, const char * argv[]) {
    int i, cur, prev;
    
    int array[NUM];
    
    srand((unsigned)time(NULL));
    for(i=0;i<NUM;i++)    array[i] = rand()%NUM;
    for(i=0; i <NUM; i++){
        printf("%d ", array[i] );
        if(i == NUM -1) printf("\n\n");
    }
    
    test_qsort(array, NUM, sizeof(int), compare_int);
    
    cur = prev = array[0];
    for(i=0; i <NUM; i++){
        prev = cur;
        cur = array[i];
        assert(prev <= cur);
        printf("%d ", array[i]);
        if(i == NUM -1) printf("\n");
    }
    
    return 0;
}
Exemple #2
0
void
vec_c_tests ()
{
  test_quick_push ();
  test_safe_push ();
  test_truncate ();
  test_safe_grow_cleared ();
  test_pop ();
  test_safe_insert ();
  test_ordered_remove ();
  test_ordered_remove_if ();
  test_unordered_remove ();
  test_block_remove ();
  test_qsort ();
  test_reverse ();
}