Changeset 53ee27e for tests


Ignore:
Timestamp:
Aug 4, 2020, 5:13:51 PM (5 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
eafec07
Parents:
3f850d7 (diff), 21b0a23 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Location:
tests
Files:
8 added
11 edited

Legend:

Unmodified
Added
Removed
  • tests/.expect/castError.txt

    r3f850d7 r53ee27e  
    1 castError.cfa:21:1 error: Cannot choose between 3 alternatives for expression
     1castError.cfa:23:1 error: Cannot choose between 3 alternatives for expression
    22Explicit Cast of:
    33  Name: f
     
    3535
    3636
    37 castError.cfa:26:1 error: Cannot choose between 2 alternatives for expression
     37castError.cfa:28:1 error: Cannot choose between 2 alternatives for expression
    3838Generated Cast of:
    3939  Comma Expression:
     
    6262
    6363
     64castError.cfa:30:1 error: No reasonable alternatives for expression Explicit Cast of:
     65  Name: sint
     66... to:
     67  instance of struct S with body 1
     68  ... with parameters
     69    char
     70
  • tests/Makefile.in

    r3f850d7 r53ee27e  
    355355AUTOMAKE_OPTIONS = foreign    # do not require all the GNU file names
    356356ACLOCAL_AMFLAGS = -I automake
    357 CFACOMPILE = $(CFACC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CFAFLAGS) $(CFAFLAGS) $(AM_CFLAGS) $(CFLAGS)
    358 LTCFACOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
     357AM_T_CFA = $(am__t_CFA_@AM_T@)
     358am__t_CFA_ =
     359am__t_CFA_0 =
     360am__t_CFA_1 = /usr/bin/time --quiet -f "$@ %E" # trailling space is necessary
     361CFACOMPILE = $(AM_T_CFA)$(CFACC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CFAFLAGS) $(CFAFLAGS) $(AM_CFLAGS) $(CFLAGS)
     362LTCFACOMPILE = $(AM_T_CFA)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
    359363        $(LIBTOOLFLAGS) --mode=compile $(CFACC) $(DEFS) \
    360364        $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CFAFLAGS) $(AM_CFLAGS) $(CFAFLAGS) $(CFLAGS)
  • tests/avltree/avl1.cfa

    r3f850d7 r53ee27e  
    2424tree(K, V) * create(K key, V value) {
    2525  // infinite loop trying to resolve ... t = malloc();
    26   tree(K, V) * t = malloc(sizeof(tree(K,V)));
     26  tree(K, V) * t = ( tree(K, V) * ) malloc(sizeof(tree(K,V)));
    2727  (*t){ key, value };
    2828  return t;
  • tests/bugs/66.cfa

    r3f850d7 r53ee27e  
    55
    66int main() {
    7         int * next = (void*)0;
     7        int * next = 0p;
    88        if( next ) {
    99                return 1;
  • tests/castError.cfa

    r3f850d7 r53ee27e  
    1414//
    1515
     16forall(otype T) struct S { T p; };
    1617int f;
     18S(int) sint;
    1719
    1820void f() {
     
    2527        short int v;
    2628        3, v;           // implicit void cast
     29
     30        (S(char)) sint;
    2731}
    2832
  • tests/concurrent/signal/block.cfa

    r3f850d7 r53ee27e  
    8282        if( !is_empty( cond ) ) {
    8383
    84                 $thread * next = front( cond );
     84                $thread * next = ( $thread * ) front( cond );
    8585
    8686                if( ! signal_block( cond ) ) {
  • tests/exceptions/conditional.cfa

    r3f850d7 r53ee27e  
    1717};
    1818
    19 void num_error_msg(num_error * this) {
     19const char * num_error_msg(num_error * this) {
    2020    if ( ! this->msg ) {
    2121        static const char * base = "Num Error with code: X";
  • tests/exceptions/defaults.cfa

    r3f850d7 r53ee27e  
    1313}
    1414
    15 char * get_log_message(log_message * this) {
     15const char * get_log_message(log_message * this) {
    1616        return this->msg;
    1717}
     
    2828        // We can catch log:
    2929        try {
    30                 throwResume (log_message){(char *)"Should be printed.\n"};
     30                throwResume (log_message){"Should be printed.\n"};
    3131        } catchResume (log_message * this) {
    3232                printf("%s", this->virtual_table->msg(this));
    3333        }
    3434        // But we don't have to:
    35         throwResume (log_message){(char *)"Should not be printed.\n"};
     35        throwResume (log_message){"Should not be printed.\n"};
    3636}
    3737
  • tests/heap.cfa

    r3f850d7 r53ee27e  
    1010// Created On       : Tue Nov  6 17:54:56 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Nov 24 12:34:51 2019
    13 // Update Count     : 28
     12// Last Modified On : Tue Aug  4 06:36:17 2020
     13// Update Count     : 56
    1414//
    1515
     
    7575                size_t s = (i + 1) * 20;
    7676                char * area = (char *)malloc( s );
    77                 if ( area == 0p ) abort( "malloc/free out of memory" );
    7877                area[0] = '\345'; area[s - 1] = '\345';                 // fill first/last
    7978                area[malloc_usable_size( area ) - 1] = '\345';  // fill ultimate byte
     
    8483                size_t s = i + 1;                                                               // +1 to make initialization simpler
    8584                locns[i] = (char *)malloc( s );
    86                 if ( locns[i] == 0p ) abort( "malloc/free out of memory" );
    8785                locns[i][0] = '\345'; locns[i][s - 1] = '\345'; // fill first/last
    8886                locns[i][malloc_usable_size( locns[i] ) - 1] = '\345'; // fill ultimate byte
     
    10098                size_t s = i + default_mmap_start();                    // cross over point
    10199                char * area = (char *)malloc( s );
    102                 if ( area == 0p ) abort( "malloc/free out of memory" );
    103100                area[0] = '\345'; area[s - 1] = '\345';                 // fill first/last
    104101                area[malloc_usable_size( area ) - 1] = '\345';  // fill ultimate byte
     
    109106                size_t s = i + default_mmap_start();                    // cross over point
    110107                locns[i] = (char *)malloc( s );
    111                 if ( locns[i] == 0p ) abort( "malloc/free out of memory" );
    112108                locns[i][0] = '\345'; locns[i][s - 1] = '\345'; // fill first/last
    113109                locns[i][malloc_usable_size( locns[i] ) - 1] = '\345'; // fill ultimate byte
     
    125121                size_t s = (i + 1) * 20;
    126122                char * area = (char *)calloc( 5, s );
    127                 if ( area == 0p ) abort( "calloc/free out of memory" );
    128123                if ( area[0] != '\0' || area[s - 1] != '\0' ||
    129                          area[malloc_usable_size( area ) - 1] != '\0' ||
     124                         area[malloc_size( area ) - 1] != '\0' ||
    130125                         ! malloc_zero_fill( area ) ) abort( "calloc/free corrupt storage1" );
    131126                area[0] = '\345'; area[s - 1] = '\345';                 // fill first/last
     
    137132                size_t s = i + 1;
    138133                locns[i] = (char *)calloc( 5, s );
    139                 if ( locns[i] == 0p ) abort( "calloc/free out of memory" );
    140134                if ( locns[i][0] != '\0' || locns[i][s - 1] != '\0' ||
    141                          locns[i][malloc_usable_size( locns[i] ) - 1] != '\0' ||
     135                         locns[i][malloc_size( locns[i] ) - 1] != '\0' ||
    142136                         ! malloc_zero_fill( locns[i] ) ) abort( "calloc/free corrupt storage2" );
    143137                locns[i][0] = '\345'; locns[i][s - 1] = '\345'; // fill first/last
     
    156150                size_t s = i + default_mmap_start();                    // cross over point
    157151                char * area = (char *)calloc( 1, s );
    158                 if ( area == 0p ) abort( "calloc/free out of memory" );
    159152                if ( area[0] != '\0' || area[s - 1] != '\0' ) abort( "calloc/free corrupt storage4.1" );
    160                 if ( area[malloc_usable_size( area ) - 1] != '\0' ) abort( "calloc/free corrupt storage4.2" );
     153                if ( area[malloc_size( area ) - 1] != '\0' ) abort( "calloc/free corrupt storage4.2" );
    161154                if ( ! malloc_zero_fill( area ) ) abort( "calloc/free corrupt storage4.3" );
    162155                area[0] = '\345'; area[s - 1] = '\345';                 // fill first/last
     
    168161                size_t s = i + default_mmap_start();                    // cross over point
    169162                locns[i] = (char *)calloc( 1, s );
    170                 if ( locns[i] == 0p ) abort( "calloc/free out of memory" );
    171163                if ( locns[i][0] != '\0' || locns[i][s - 1] != '\0' ||
    172                          locns[i][malloc_usable_size( locns[i] ) - 1] != '\0' ||
     164                         locns[i][malloc_size( locns[i] ) - 1] != '\0' ||
    173165                         ! malloc_zero_fill( locns[i] ) ) abort( "calloc/free corrupt storage5" );
    174166                locns[i][0] = '\345'; locns[i][s - 1] = '\345'; // fill first/last
     
    188180                for ( s; 1 ~ NoOfAllocs ) {                                             // allocation of size 0 can return null
    189181                        char * area = (char *)memalign( a, s );
    190                         if ( area == 0p ) abort( "memalign/free out of memory" );
    191182                        //sout | i | area;
    192183                        if ( (size_t)area % a != 0 || malloc_alignment( area ) != a ) { // check for initial alignment
     
    206197                        size_t s = i + default_mmap_start();            // cross over point
    207198                        char * area = (char *)memalign( a, s );
    208                         if ( area == 0p ) abort( "memalign/free out of memory" );
    209199                        //sout | i | area;
    210200                        if ( (size_t)area % a != 0 || malloc_alignment( area ) != a ) { // check for initial alignment
     
    222212                // initial N byte allocation
    223213                char * area = (char *)calloc( 5, i );
    224                 if ( area == 0p ) abort( "calloc/realloc/free out of memory" );
    225214                if ( area[0] != '\0' || area[i - 1] != '\0' ||
    226                          area[malloc_usable_size( area ) - 1] != '\0' ||
     215                         area[malloc_size( area ) - 1] != '\0' ||
    227216                         ! malloc_zero_fill( area ) ) abort( "calloc/realloc/free corrupt storage1" );
    228217
     
    230219                for ( s; i ~ 256 * 1024 ~ 26 ) {                                // start at initial memory request
    231220                        area = (char *)realloc( area, s );                      // attempt to reuse storage
    232                         if ( area == 0p ) abort( "calloc/realloc/free out of memory" );
    233221                        if ( area[0] != '\0' || area[s - 1] != '\0' ||
    234                                  area[malloc_usable_size( area ) - 1] != '\0' ||
     222                                 area[malloc_size( area ) - 1] != '\0' ||
    235223                                 ! malloc_zero_fill( area ) ) abort( "calloc/realloc/free corrupt storage2" );
    236224                } // for
     
    244232                size_t s = i + default_mmap_start();                    // cross over point
    245233                char * area = (char *)calloc( 1, s );
    246                 if ( area == 0p ) abort( "calloc/realloc/free out of memory" );
     234//              if ( area == 0p ) abort( "calloc/realloc/free out of memory" );
    247235                if ( area[0] != '\0' || area[s - 1] != '\0' ||
    248                          area[malloc_usable_size( area ) - 1] != '\0' ||
    249                          ! malloc_zero_fill( area ) ) abort( "calloc/realloc/free corrupt storage1" );
     236                         area[malloc_size( area ) - 1] != '\0' ||
     237                         ! malloc_zero_fill( area ) ) //abort( "calloc/realloc/free corrupt storage3" );
     238                        printf( "C %zd %d %d %d %d\n", s, area[0] != '\0', area[s - 1] != '\0', area[malloc_size( area ) - 1] != '\0', ! malloc_zero_fill( area ) );
    250239
    251240                // Do not start this loop index at 0 because realloc of 0 bytes frees the storage.
    252241                for ( r; i ~ 256 * 1024 ~ 26 ) {                                // start at initial memory request
    253242                        area = (char *)realloc( area, r );                      // attempt to reuse storage
    254                         if ( area == 0p ) abort( "calloc/realloc/free out of memory" );
     243//                      if ( area == 0p ) abort( "calloc/realloc/free out of memory" );
    255244                        if ( area[0] != '\0' || area[r - 1] != '\0' ||
    256                                  area[malloc_usable_size( area ) - 1] != '\0' ||
    257                                  ! malloc_zero_fill( area ) ) abort( "calloc/realloc/free corrupt storage2" );
     245                                 area[malloc_size( area ) - 1] != '\0' ||
     246                                 ! malloc_zero_fill( area ) ) abort( "calloc/realloc/free corrupt storage4" );
    258247                } // for
    259248                free( area );
     
    266255                // initial N byte allocation
    267256                char * area = (char *)memalign( a, amount );    // aligned N-byte allocation
    268                 if ( area == 0p ) abort( "memalign/realloc/free out of memory" ); // no storage ?
     257//              if ( area == 0p ) abort( "memalign/realloc/free out of memory" ); // no storage ?
    269258                //sout | alignments[a] | area;
    270259                if ( (size_t)area % a != 0 || malloc_alignment( area ) != a ) { // check for initial alignment
     
    277266                        if ( area[0] != '\345' || area[s - 2] != '\345' ) abort( "memalign/realloc/free corrupt storage" );
    278267                        area = (char *)realloc( area, s );                      // attempt to reuse storage
    279                         if ( area == 0p ) abort( "memalign/realloc/free out of memory" ); // no storage ?
    280268                        //sout | i | area;
    281269                        if ( (size_t)area % a != 0 ) {                          // check for initial alignment
     
    293281                for ( s; 1 ~ limit ) {                                                  // allocation of size 0 can return null
    294282                        char * area = (char *)cmemalign( a, 1, s );
    295                         if ( area == 0p ) abort( "cmemalign/free out of memory" );
    296283                        //sout | i | area;
    297284                        if ( (size_t)area % a != 0 || malloc_alignment( area ) != a ) { // check for initial alignment
     
    299286                        } // if
    300287                        if ( area[0] != '\0' || area[s - 1] != '\0' ||
    301                                  area[malloc_usable_size( area ) - 1] != '\0' ||
     288                                 area[malloc_size( area ) - 1] != '\0' ||
    302289                                 ! malloc_zero_fill( area ) ) abort( "cmemalign/free corrupt storage" );
    303290                        area[0] = '\345'; area[s - 1] = '\345';         // fill first/last byte
     
    312299                // initial N byte allocation
    313300                char * area = (char *)cmemalign( a, 1, amount ); // aligned N-byte allocation
    314                 if ( area == 0p ) abort( "cmemalign/realloc/free out of memory" ); // no storage ?
    315301                //sout | alignments[a] | area;
    316302                if ( (size_t)area % a != 0 || malloc_alignment( area ) != a ) { // check for initial alignment
     
    318304                } // if
    319305                if ( area[0] != '\0' || area[amount - 1] != '\0' ||
    320                          area[malloc_usable_size( area ) - 1] != '\0' ||
     306                         area[malloc_size( area ) - 1] != '\0' ||
    321307                         ! malloc_zero_fill( area ) ) abort( "cmemalign/realloc/free corrupt storage1" );
    322308                area[0] = '\345'; area[amount - 2] = '\345';    // fill first/penultimate byte
     
    326312                        if ( area[0] != '\345' || area[s - 2] != '\345' ) abort( "cmemalign/realloc/free corrupt storage2" );
    327313                        area = (char *)realloc( area, s );                      // attempt to reuse storage
    328                         if ( area == 0p ) abort( "cmemalign/realloc/free out of memory" ); // no storage ?
    329314                        //sout | i | area;
    330315                        if ( (size_t)area % a != 0 || malloc_alignment( area ) != a ) { // check for initial alignment
    331316                                abort( "cmemalign/realloc/free bad alignment %p", area );
    332317                        } // if
    333                         if ( area[s - 1] != '\0' || area[s - 1] != '\0' ||
    334                                  area[malloc_usable_size( area ) - 1] != '\0' ||
     318                        if ( area[0] != '\345' || area[s - 1] != '\0' ||
     319                                 area[malloc_size( area ) - 1] != '\0' ||
    335320                                 ! malloc_zero_fill( area ) ) abort( "cmemalign/realloc/free corrupt storage3" );
    336321                        area[s - 1] = '\345';                                           // fill last byte
     
    345330                // initial N byte allocation
    346331                char * area = (char *)memalign( a, amount );    // aligned N-byte allocation
    347                 if ( area == 0p ) abort( "memalign/realloc with align/free out of memory" ); // no storage ?
    348332                //sout | alignments[a] | area | endl;
    349333                if ( (size_t)area % a != 0 || malloc_alignment( area ) != a ) { // check for initial alignment
     
    356340                        if ( area[0] != '\345' || area[s - 2] != '\345' ) abort( "memalign/realloc/free corrupt storage" );
    357341                        area = (char *)realloc( area, a * 2, s );       // attempt to reuse storage
    358                         if ( area == 0p ) abort( "memalign/realloc with align/free out of memory" ); // no storage ?
    359342                        //sout | i | area | endl;
    360343                        if ( (size_t)area % a * 2 != 0 ) {                      // check for initial alignment
     
    371354        for ( size_t a = libAlign() + libAlign(); a <= limit; a += a ) { // generate powers of 2
    372355                // initial N byte allocation
    373                 char *area = (char *)cmemalign( a, 1, amount ); // aligned N-byte allocation
    374                 if ( area == 0p ) abort( "cmemalign/realloc with align/free out of memory" ); // no storage ?
     356                char * area = (char *)cmemalign( a, 1, amount ); // aligned N-byte allocation
    375357                //sout | alignments[a] | area | endl;
    376358                if ( (size_t)area % a != 0 || malloc_alignment( area ) != a ) { // check for initial alignment
     
    378360                } // if
    379361                if ( area[0] != '\0' || area[amount - 1] != '\0' ||
    380                          area[malloc_usable_size( area ) - 1] != '\0' ||
     362                         area[malloc_size( area ) - 1] != '\0' ||
    381363                         ! malloc_zero_fill( area ) ) abort( "cmemalign/realloc with align/free corrupt storage1" );
    382364                area[0] = '\345'; area[amount - 2] = '\345';    // fill first/penultimate byte
     
    386368                        if ( area[0] != '\345' || area[s - 2] != '\345' ) abort( "cmemalign/realloc with align/free corrupt storage2" );
    387369                        area = (char *)realloc( area, a * 2, s );       // attempt to reuse storage
    388                         if ( area == 0p ) abort( "cmemalign/realloc with align/free out of memory" ); // no storage ?
    389370                        //sout | i | area | endl;
    390371                        if ( (size_t)area % a * 2 != 0 || malloc_alignment( area ) != a * 2 ) { // check for initial alignment
    391                                 abort( "cmemalign/realloc with align/free bad alignment %p %jd %jd", area, malloc_alignment( area ), a * 2 );
     372                                abort( "cmemalign/realloc with align/free bad alignment %p %zd %zd", area, malloc_alignment( area ), a * 2 );
    392373                        } // if
    393374                        if ( area[s - 1] != '\0' || area[s - 1] != '\0' ||
    394                                  area[malloc_usable_size( area ) - 1] != '\0' ||
     375                                 area[malloc_size( area ) - 1] != '\0' ||
    395376                                 ! malloc_zero_fill( area ) ) abort( "cmemalign/realloc/free corrupt storage3" );
    396377                        area[s - 1] = '\345';                                           // fill last byte
  • tests/io2.cfa

    r3f850d7 r53ee27e  
    121121
    122122        [int, int, const char *, double] t3 = { 3, 4, "a", 7.2 };
    123         sout | [ 3, 4, "a", 7.2 ];
     123        sout | [ 3, 4, (const char*)"a", 7.2 ];             // workaround trac#207: the const cast should not be needed
    124124        sout | t3;
    125125        sepSetTuple( sout, " " );
  • tests/searchsort.cfa

    r3f850d7 r53ee27e  
    3838        } // for
    3939        sout | nl;
    40         for ( i; 0 ~ size ) {           // C version
     40        for ( i; 0 ~ size ) {           // C version, returns void*
    4141                int key = size - i;
    42                 int * v = bsearch( &key, iarr, size, sizeof( iarr[0] ), comp );
     42                int * v = ( int * ) bsearch( &key, iarr, size, sizeof( iarr[0] ), comp );
    4343                sout | key | ':' | *v | ", ";
    4444        } // for
Note: See TracChangeset for help on using the changeset viewer.