Changeset f76ff0b for tests/malloc.cfa


Ignore:
Timestamp:
Sep 2, 2020, 1:13:28 PM (5 years ago)
Author:
m3zulfiq <m3zulfiq@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
3a4834b3, 73f1b1c
Parents:
f6fe597
Message:

alloc2.txt: added expected output file for test alloc2.cfa. heap.cfa: removed alignment bugs from realloc and resize with alignment. stdlib.hfa: removed debug prints from alloc interface. alloc2.cfa, malloc.cfa: uncommented tests that were previously commented because of a bug in realloc and resize.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/malloc.cfa

    rf6fe597 rf76ff0b  
    252252
    253253        ip = (int *) (void *) malloc( size );
     254        ip = (int *) (void *) resize( (void *) ip, libAlign, size / 2 );
     255        test_base(ip, size / 2, libAlign);
     256        test_use(ip);
     257        free(ip);
     258
     259        ip = (int *) (void *) aligned_alloc( align, size );
     260        ip = (int *) (void *) resize( (void *) ip, align, size / 2 );
     261        test_base(ip, size / 2, align);
     262        test_use(ip);
     263        free(ip);
     264
     265        ip = (int *) (void *) malloc( size );
    254266        ip = (int *) (void *) resize( (void *) ip, align, size / 4 );
    255267        test_base(ip, size / 4, align);
     
    270282        ip = (int *) (void *) resize( 0p, align, size );
    271283        test_base(ip, size, align);
     284        test_use(ip);
     285        free(ip);
     286
     287        ip = (int *) (void *) calloc( dim, elemSize );
     288        ip = (int *) (void *) realloc( (void *) ip, libAlign, size / 2 );
     289        test_base(ip, size / 2, libAlign);
     290        test_fill(ip, 0, size / 2, '\0');
     291        test_use(ip);
     292        free(ip);
     293
     294        ip = (int *) (void *) cmemalign( align, dim, elemSize );
     295        ip = (int *) (void *) realloc( (void *) ip, align, size / 2 );
     296        test_base(ip, size / 2, align);
     297        test_fill(ip, 0, size / 2, '\0');
    272298        test_use(ip);
    273299        free(ip);
     
    437463        else printf("failed CFA malloc tests : %d/%d\n\n", tests_failed, tests_total);
    438464
    439         // testing CFA malloc
     465        // testing CFA malloc with aligned struct
    440466
    441467        elemSize = sizeof(T1);
     
    518544        free(tp);
    519545
    520 /*
    521546        tp = realloc( (T1*)0p, size  );
    522         est_base(tp, size , tAlign );
    523         est_use(tp);
     547        test_base(tp, size , tAlign );
     548        test_use(tp);
    524549        free(tp);
    525550
    526551        tp = realloc( (T1*)0p, size );
    527         est_base(tp, size, tAlign );
    528         est_use(tp);
    529         free(tp);
    530 */
     552        test_base(tp, size, tAlign );
     553        test_use(tp);
     554        free(tp);
    531555
    532556        tp = memalign( align );
Note: See TracChangeset for help on using the changeset viewer.