Changeset 9c47a47 for src/tests/searchsort.c
 Timestamp:
 Dec 28, 2017, 9:56:28 PM (7 years ago)
 Branches:
 ADT, aaronthesis, armeh, astexperimental, cleanupdtors, deferred_resn, demangler, enum, forallpointerdecay, jacob/cs343translation, jenkinssandbox, master, newast, newastuniqueexpr, newenv, no_list, persistentindexer, pthreademulation, qualifiedEnum, resolvnew, with_gc
 Children:
 853451b
 Parents:
 e672372
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

src/tests/searchsort.c
re672372 r9c47a47 10 10 // Created On : Thu Feb 4 18:17:50 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Dec 7 09:14:06201713 // Update Count : 7712 // Last Modified On : Thu Dec 28 18:48:10 2017 13 // Update Count : 99 14 14 // 15 15 … … 38 38 for ( unsigned int i = 0; i < size; i += 1 ) { // C version 39 39 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  ", "; 42 42 } // for 43 43 sout  endl; 44 44 45 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  ", "; 47 48 } // for 48 49 sout  endl; 49 50 for ( unsigned int i = 0; i < size; i += 1 ) { 50 51 unsigned int posn = bsearch( size  i, iarr, size ); 51 sout  iarr[posn]  ", ";52 sout  size  i  ':'  iarr[posn]  ", "; 52 53 } // for 53 54 sout  endl  endl; … … 67 68 sout  endl; 68 69 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  ", "; 71 72 } // for 72 73 sout  endl; 73 74 for ( unsigned int i = 0; i < size; i += 1 ) { 74 75 unsigned int posn = bsearch( size  i, iarr, size ); 75 sout  iarr[posn]  ", ";76 sout  size  i  ':'  iarr[posn]  ", "; 76 77 } // for 77 78 } … … 90 91 sout  endl; 91 92 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  ", "; 94 95 } // for 95 96 sout  endl; 96 97 for ( unsigned int i = 0; i < size; i += 1 ) { 97 98 unsigned int posn = bsearch( size  i + 0.5, darr, size ); 98 sout  darr[posn]  ", ";99 sout  size  i + 0.5  ':'  darr[posn]  ", "; 99 100 } // for 100 101 sout  endl  endl; … … 116 117 for ( unsigned int i = 0; i < size; i += 1 ) { 117 118 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  ", "; 120 121 } // for 121 122 sout  endl; … … 123 124 S temp = { size  i, size  i + 1 }; 124 125 unsigned int posn = bsearch( temp, sarr, size ); 125 sout  sarr[posn]  ", ";126 sout  temp  ':'  sarr[posn]  ", "; 126 127 } // for 127 128 sout  endl  endl; 129 { 130 unsigned int getKey( 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 } 128 146 } // main 129 147
Note: See TracChangeset
for help on using the changeset viewer.