Ignore:
Timestamp:
Jan 2, 2018, 10:39:57 AM (6 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
8aa474a
Parents:
f64d9bc (diff), 93cdd5c (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:/u/cforall/software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tests/searchsort.c

    rf64d9bc rf3458a8  
    1010// Created On       : Thu Feb  4 18:17:50 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Dec  7 09:14:06 2017
    13 // Update Count     : 77
     12// Last Modified On : Tue Jan  2 08:01:17 2018
     13// Update Count     : 100
    1414//
    1515
     
    3838        for ( unsigned int i = 0; i < size; i += 1 ) {          // C version
    3939                int key = size - i;
    40                 int *v = bsearch( &key, iarr, size, sizeof( iarr[0] ), comp );
    41                 sout | *v | ", ";
     40                int * v = bsearch( &key, iarr, size, sizeof( iarr[0] ), comp );
     41                sout | key | ':' | *v | ", ";
    4242        } // for
    4343        sout | endl;
     44
    4445        for ( unsigned int i = 0; i < size; i += 1 ) {
    45                 int *v = bsearch( size - i, iarr, size );
    46                 sout | *v | ", ";
     46                int * v = bsearch( size - i, iarr, size );
     47                sout | size - i | ':' | *v | ", ";
    4748        } // for
    4849        sout | endl;
    4950        for ( unsigned int i = 0; i < size; i += 1 ) {
    5051                unsigned int posn = bsearch( size - i, iarr, size );
    51                 sout | iarr[posn] | ", ";
     52                sout | size - i | ':' | iarr[posn] | ", ";
    5253        } // for
    5354        sout | endl | endl;
     
    6768                sout | endl;
    6869                for ( unsigned int i = 0; i < size; i += 1 ) {
    69                         int *v = bsearch( size - i, iarr, size );
    70                         sout | *v | ", ";
     70                        int * v = bsearch( size - i, iarr, size );
     71                        sout | size - i | ':' | *v | ", ";
    7172                } // for
    7273                sout | endl;
    7374                for ( unsigned int i = 0; i < size; i += 1 ) {
    7475                        unsigned int posn = bsearch( size - i, iarr, size );
    75                         sout | iarr[posn] | ", ";
     76                        sout | size - i | ':' | iarr[posn] | ", ";
    7677                } // for
    7778        }
     
    9091        sout | endl;
    9192        for ( unsigned int i = 0; i < size; i += 1 ) {
    92                 double *v = bsearch( size - i + 0.5, darr, size );
    93                 sout | *v | ", ";
     93                double * v = bsearch( size - i + 0.5, darr, size );
     94                sout | size - i + 0.5 | ':' | *v | ", ";
    9495        } // for
    9596        sout | endl;
    9697        for ( unsigned int i = 0; i < size; i += 1 ) {
    9798                unsigned int posn = bsearch( size - i + 0.5, darr, size );
    98                 sout | darr[posn] | ", ";
     99                sout | size - i + 0.5 | ':' | darr[posn] | ", ";
    99100        } // for
    100101        sout | endl | endl;
     
    116117        for ( unsigned int i = 0; i < size; i += 1 ) {
    117118                S temp = { size - i, size - i + 1 };
    118                 S *v = bsearch( temp, sarr, size );
    119                 sout | *v | ", ";
     119                S * v = bsearch( temp, sarr, size );
     120                sout | temp | ':' | *v | ", ";
    120121        } // for
    121122        sout | endl;
     
    123124                S temp = { size - i, size - i + 1 };
    124125                unsigned int posn = bsearch( temp, sarr, size );
    125                 sout | sarr[posn] | ", ";
     126                sout | temp | ':' | sarr[posn] | ", ";
    126127        } // for
    127128        sout | endl | endl;
     129        {
     130                unsigned int getKey( const S & s ) { return s.j; }
     131                for ( unsigned int i = 0; i < size; i += 1 ) {
     132                        sout | sarr[i] | ", ";
     133                } // for
     134                sout | endl;
     135                for ( unsigned int i = 0; i < size; i += 1 ) {
     136                        S * v = bsearch( size - i + 1, sarr, size );
     137                        sout | size - i + 1 | ':' | *v | ", ";
     138                } // for
     139                sout | endl;
     140                for ( unsigned int i = 0; i < size; i += 1 ) {
     141                        unsigned int posn = bsearch( size - i + 1, sarr, size );
     142                        sout | size - i + 1 | ':' | sarr[posn] | ", ";
     143                } // for
     144                sout | endl | endl;
     145        }
    128146} // main
    129147
Note: See TracChangeset for help on using the changeset viewer.