- Timestamp:
- Dec 28, 2020, 4:08:27 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- bf1914e
- Parents:
- 9536761
- Location:
- tests/collections
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/collections/.expect/queue.txt
r9536761 r657c36f 16 16 0 0 2 2 4 4 6 6 8 8 10 10 12 12 14 14 16 16 18 18 17 17 18 18 18 -1 18 -1 18 -1 18 -2 19 -1 -1 18 18 1 1 3 3 5 5 7 7 9 9 11 11 13 13 15 15 17 17 19 19 -2 -2 19 20 18 18 1 1 3 3 5 5 7 7 9 9 11 11 13 13 15 15 17 17 21 18 18 1 1 3 3 5 5 7 7 22 empty 20 23 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 21 24 5 5 6 6 7 7 8 8 9 9 -
tests/collections/.expect/sequence.txt
r9536761 r657c36f 19 19 0 0 2 2 4 4 6 6 8 8 10 10 12 12 14 14 16 16 18 18 20 20 18 18 21 -1 18 -1 21 -1 18 -2 22 -1 -1 18 18 1 1 3 3 5 5 7 7 9 9 11 11 13 13 15 15 17 17 19 19 -2 -2 22 23 18 18 1 1 3 3 5 5 7 7 9 9 11 11 13 13 15 15 17 17 24 18 18 1 1 3 3 5 5 7 7 25 empty 23 26 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 24 27 5 5 6 6 7 7 8 8 9 9 -
tests/collections/multi_list.cfa
r9536761 r657c36f 73 73 74 74 sout | nlOff; 75 for ( over( sqiter, clustList ); sqiter >>dl; ) { // print lists75 for ( over( sqiter, clustList ); sqiter | dl; ) { // print lists 76 76 Task & tmp = task( dl ); sout | tmp.id; 77 77 // sout | task( dl ).id; 78 78 } 79 79 sout | nl; 80 for ( over( sqiter, readyList ); sqiter >>dl; ) {80 for ( over( sqiter, readyList ); sqiter | dl; ) { 81 81 Task & tmp = task( dl ); sout | tmp.id; 82 82 // sout | task( dl ).id; 83 83 } 84 84 sout | nl; 85 for ( QueueIter(TaskSL) qiter = { mutexList }; qiter >>sl; ) { // print lists85 for ( QueueIter(TaskSL) qiter = { mutexList }; qiter | sl; ) { // print lists 86 86 Task & tmp = task( sl ); sout | tmp.id; 87 87 // sout | task( sl ).id; … … 103 103 push( mutexStack, task.clusterRef ); // insert on lists in opposite directions 104 104 } 105 for ( StackIter(TaskDL) stiter = { mutexStack }; stiter >>dl; ) {105 for ( StackIter(TaskDL) stiter = { mutexStack }; stiter | dl; ) { 106 106 Task & tmp = task( dl ); sout | tmp.id; 107 107 // sout | task( dl ).id; -
tests/collections/queue.cfa
r9536761 r657c36f 19 19 20 20 Queue(Fred) fred; 21 QueueIter(Fred) fredIter = { fred };21 QueueIter(Fred) iter = { fred }; 22 22 Fred & f; 23 23 24 24 sout | nlOff; // turn off auto newline 25 25 26 for ( ; fredIter >>f; ) { // empty list26 for ( ; iter | f; ) { // empty list 27 27 sout | f.i | ' '; 28 28 } … … 35 35 sout | head( fred ).i | tail( fred ).i | nl; 36 36 37 for ( QueueIter(Fred) iter = { fred }; iter >>f; ) {37 for ( QueueIter(Fred) iter = { fred }; iter | f; ) { 38 38 sout | f.i | ' '; 39 39 } … … 44 44 } 45 45 46 for ( over( fredIter, fred ); fredIter >>f; ) {46 for ( over( iter, fred ); iter | f; ) { 47 47 sout | f.i | ' '; 48 48 } … … 58 58 59 59 sout | head( fred ).i | succ( fred, head )->i | tail( fred ).i | nl; 60 for ( over( fredIter, fred ); fredIter >> f; ) { 60 61 for ( over( iter, fred ); iter | f; ) { 61 62 sout | f.i | ' '; 62 63 } … … 68 69 delete( &dropTail( fred ) ); 69 70 70 for ( over( fredIter, fred ); fredIter >>f; ) {71 for ( over( iter, fred ); iter | f; ) { 71 72 sout | f.i | ' '; 72 73 } … … 76 77 delete( &dropTail( fred ) ); 77 78 } 78 for ( over( fredIter, fred ); fredIter >>f; ) {79 sout | f.i | ' '; 80 } 81 sout | nl; 82 83 for ( over( fredIter, fred ); fredIter >>f; ) {79 for ( over( iter, fred ); iter | f; ) { 80 sout | f.i | ' '; 81 } 82 sout | nl; 83 84 for ( over( iter, fred ); iter | f; ) { 84 85 delete( &remove( fred, f ) ); 85 86 } 86 for ( over( fredIter, fred ); fredIter >>f; ) {87 for ( over( iter, fred ); iter | f; ) { 87 88 sout | f.i | ' '; 88 89 } … … 96 97 } 97 98 } 98 for ( QueueIter(Fred) iter = { fred }; iter >>f; ) {99 for ( QueueIter(Fred) iter = { fred }; iter | f; ) { 99 100 sout | f.i | ' '; 100 101 } … … 105 106 split( fred2, fred, middle ); 106 107 107 for ( over( fredIter, fred ); fredIter >>f; ) {108 sout | f.i | ' '; 109 } 110 sout | nl; 111 112 for ( over( fredIter, fred2 ); fredIter >>f; ) {108 for ( over( iter, fred ); iter | f; ) { 109 sout | f.i | ' '; 110 } 111 sout | nl; 112 113 for ( over( iter, fred2 ); iter | f; ) { 113 114 sout | f.i | ' '; 114 115 } … … 117 118 transfer( fred, fred2 ); 118 119 119 for ( over( fredIter, fred ); fredIter >>f; ) {120 sout | f.i | ' '; 121 } 122 sout | nl; 123 124 for ( over( fredIter, fred ); fredIter >>f; ) {120 for ( over( iter, fred ); iter | f; ) { 121 sout | f.i | ' '; 122 } 123 sout | nl; 124 125 for ( over( iter, fred ); iter | f; ) { 125 126 delete( &f ); 126 127 } … … 142 143 143 144 Queue(Mary) mary; 144 QueueIter(Mary) maryIter = { mary };145 QueueIter(Mary) iter = { mary }; 145 146 Mary & m; 146 147 147 for ( ; maryIter >>m; ) { // empty list148 for ( ; iter | m; ) { // empty list 148 149 sout | m.i | m.j | ' '; 149 150 } … … 156 157 sout | head( mary ).i | tail( mary ).i | nl; 157 158 158 for ( QueueIter(Mary) iter = { mary }; iter >>m; ) {159 for ( QueueIter(Mary) iter = { mary }; iter | m; ) { 159 160 sout | m.i | m.j | ' '; 160 161 } … … 165 166 } 166 167 167 for ( over( maryIter, mary ); maryIter >>m; ) {168 for ( over( iter, mary ); iter | m; ) { 168 169 sout | m.i | m.j | ' '; 169 170 } … … 174 175 } 175 176 176 Mary * head = new( -1 ), tail = { - 1};177 Mary * head = new( -1 ), tail = { -2 }; 177 178 addHead( mary, *head ); 178 179 addTail( mary, tail ); 180 179 181 sout | head( mary ).i | succ( mary, head )->i | tail( mary ).i | nl; 182 183 for ( over( iter, mary ); iter | m; ) { 184 sout | m.i | m.j | ' '; 185 } 186 sout | nl; 187 180 188 remove( mary, *head ); 181 189 remove( mary, tail ); … … 183 191 delete( &dropTail( mary ) ); 184 192 185 for ( over( maryIter, mary ); maryIter >> m; ) { 186 sout | m.i | m.j | ' '; 187 } 188 sout | nl; 189 190 for ( over( maryIter, mary ); maryIter >> m; ) { 193 for ( over( iter, mary ); iter | m; ) { 194 sout | m.i | m.j | ' '; 195 } 196 sout | nl; 197 198 for ( i; 5 ) { 199 delete( &dropTail( mary ) ); 200 } 201 for ( over( iter, mary ); iter | m; ) { 202 sout | m.i | m.j | ' '; 203 } 204 sout | nl; 205 206 for ( over( iter, mary ); iter | m; ) { 191 207 delete( &remove( mary, m ) ); 192 208 } 209 for ( over( iter, mary ); iter | m; ) { 210 sout | m.i | m.j | ' '; 211 } 212 sout | "empty" | nl; 193 213 194 214 Mary & middle; … … 199 219 } 200 220 } 201 for ( QueueIter(Mary) iter = { mary }; iter >>m; ) {221 for ( QueueIter(Mary) iter = { mary }; iter | m; ) { 202 222 sout | m.i | m.j | ' '; 203 223 } … … 208 228 split( mary2, mary, middle ); 209 229 210 for ( over( maryIter, mary ); maryIter >>m; ) {211 sout | m.i | m.j | ' '; 212 } 213 sout | nl; 214 for ( over( maryIter, mary2 ); maryIter >>m; ) {230 for ( over( iter, mary ); iter | m; ) { 231 sout | m.i | m.j | ' '; 232 } 233 sout | nl; 234 for ( over( iter, mary2 ); iter | m; ) { 215 235 sout | m.i | m.j | ' '; 216 236 } … … 219 239 transfer( mary, mary2 ); 220 240 221 for ( over( maryIter, mary ); maryIter >> m; ) { 222 sout | m.i | m.j | ' '; 223 } 224 sout | nl; 225 for ( over( maryIter, mary ); maryIter >> m; ) { 241 for ( over( iter, mary ); iter | m; ) { 242 sout | m.i | m.j | ' '; 243 } 244 sout | nl; 245 246 for ( over( iter, mary ); iter | m; ) { 226 247 delete( &m ); 227 248 } -
tests/collections/sequence.cfa
r9536761 r657c36f 22 22 23 23 Sequence(Fred) fred; 24 SeqIter(Fred) fredIter = { fred };24 SeqIter(Fred) iter = { fred }; 25 25 Fred & f; 26 26 27 27 sout | nlOff; // turn off auto newline 28 28 29 for ( ; fredIter >>f; ) { // empty list29 for ( ; iter | f; ) { // empty list 30 30 sout | f.i | ' '; 31 31 } … … 38 38 sout | head( fred ).i | tail( fred ).i | nl; 39 39 40 for ( SeqIter(Fred) iter = { fred }; iter >>f; ) {40 for ( SeqIter(Fred) iter = { fred }; iter | f; ) { 41 41 sout | f.i | ' '; 42 42 } … … 47 47 } 48 48 49 for ( over( fredIter, fred ); fredIter >>f; ) {49 for ( over( iter, fred ); iter | f; ) { 50 50 sout | f.i | ' '; 51 51 } … … 61 61 62 62 sout | head( fred ).i | succ( fred, head )->i | tail( fred ).i | nl; 63 for ( over( fredIter, fred ); fredIter >> f; ) { 63 64 for ( over( iter, fred ); iter | f; ) { 64 65 sout | f.i | ' '; 65 66 } … … 71 72 delete( &dropTail( fred ) ); 72 73 73 for ( over( fredIter, fred ); fredIter >>f; ) {74 for ( over( iter, fred ); iter | f; ) { 74 75 sout | f.i | ' '; 75 76 } … … 79 80 delete( &dropTail( fred ) ); 80 81 } 81 for ( over( fredIter, fred ); fredIter >>f; ) {82 sout | f.i | ' '; 83 } 84 sout | nl; 85 86 for ( over( fredIter, fred ); fredIter >>f; ) {82 for ( over( iter, fred ); iter | f; ) { 83 sout | f.i | ' '; 84 } 85 sout | nl; 86 87 for ( over( iter, fred ); iter | f; ) { 87 88 delete( &remove( fred, f ) ); 88 89 } 89 for ( over( fredIter, fred ); fredIter >>f; ) {90 for ( over( iter, fred ); iter | f; ) { 90 91 sout | f.i | ' '; 91 92 } … … 94 95 Fred & middle; 95 96 for ( i; 10 ) { 96 addHead( fred, *new( i ) ); // reverse o der97 addHead( fred, *new( i ) ); // reverse order 97 98 if ( i == 5 ) { 98 99 &middle = &head( fred ); 99 100 } 100 101 } 101 for ( SeqIterRev(Fred) iter = { fred }; iter >>f; ) {102 for ( SeqIterRev(Fred) riter = { fred }; riter | f; ) { 102 103 sout | f.i | ' '; 103 104 } … … 109 110 110 111 sout | head( fred ).i | succ( fred, head )->i | tail( fred ).i | nl; 111 for ( over( fredIter, fred ); fredIter >>f; ) {112 for ( over( iter, fred ); iter | f; ) { 112 113 sout | f.i | ' '; 113 114 } … … 119 120 delete( &dropTail( fred ) ); 120 121 121 for ( over( fredIter, fred ); fredIter >>f; ) {122 for ( over( iter, fred ); iter | f; ) { 122 123 sout | f.i | ' '; 123 124 } … … 128 129 split( fred2, fred, middle ); 129 130 130 for ( over( fredIter, fred ); fredIter >>f; ) {131 sout | f.i | ' '; 132 } 133 sout | nl; 134 135 for ( over( fredIter, fred2 ); fredIter >>f; ) {131 for ( over( iter, fred ); iter | f; ) { 132 sout | f.i | ' '; 133 } 134 sout | nl; 135 136 for ( over( iter, fred2 ); iter | f; ) { 136 137 sout | f.i | ' '; 137 138 } … … 140 141 transfer( fred, fred2 ); 141 142 142 for ( over( fredIter, fred ); fredIter >>f; ) {143 sout | f.i | ' '; 144 } 145 sout | nl; 146 147 for ( over( fredIter, fred ); fredIter >>f; ) {143 for ( over( iter, fred ); iter | f; ) { 144 sout | f.i | ' '; 145 } 146 sout | nl; 147 148 for ( over( iter, fred ); iter | f; ) { 148 149 delete( &f ); 149 150 } … … 168 169 169 170 Sequence(Mary) mary; 170 SeqIter(Mary) maryIter = { mary };171 SeqIter(Mary) iter = { mary }; 171 172 Mary & m; 172 173 173 for ( ; maryIter >>m; ) { // empty list174 for ( ; iter | m; ) { // empty list 174 175 sout | m.i | m.j | ' '; 175 176 } … … 182 183 sout | head( mary ).i | tail( mary ).i | nl; 183 184 184 for ( SeqIter(Mary) iter = { mary }; iter >>m; ) {185 for ( SeqIter(Mary) iter = { mary }; iter | m; ) { 185 186 sout | m.i | m.j | ' '; 186 187 } … … 191 192 } 192 193 193 for ( over( maryIter, mary ); maryIter >>m; ) {194 for ( over( iter, mary ); iter | m; ) { 194 195 sout | m.i | m.j | ' '; 195 196 } … … 200 201 } 201 202 202 Mary * head = new( -1 ), tail = { - 1};203 Mary * head = new( -1 ), tail = { -2 }; 203 204 addHead( mary, *head ); 204 205 addTail( mary, tail ); 206 205 207 sout | head( mary ).i | succ( mary, head )->i | tail( mary ).i | nl; 208 209 for ( over( iter, mary ); iter | m; ) { 210 sout | m.i | m.j | ' '; 211 } 212 sout | nl; 213 206 214 remove( mary, *head ); 207 215 remove( mary, tail ); … … 209 217 delete( &dropTail( mary ) ); 210 218 211 for ( over( maryIter, mary ); maryIter >> m; ) { 212 sout | m.i | m.j | ' '; 213 } 214 sout | nl; 215 216 for ( over( maryIter, mary ); maryIter >> m; ) { 219 for ( over( iter, mary ); iter | m; ) { 220 sout | m.i | m.j | ' '; 221 } 222 sout | nl; 223 224 for ( i; 5 ) { 225 delete( &dropTail( mary ) ); 226 } 227 for ( over( iter, mary ); iter | m; ) { 228 sout | m.i | m.j | ' '; 229 } 230 sout | nl; 231 232 for ( over( iter, mary ); iter | m; ) { 217 233 delete( &remove( mary, m ) ); 218 234 } 235 for ( over( iter, mary ); iter | m; ) { 236 sout | m.i | m.j | ' '; 237 } 238 sout | "empty" | nl; 219 239 220 240 Mary & middle; … … 225 245 } 226 246 } 227 for ( SeqIter(Mary) iter = { mary }; iter >>m; ) {247 for ( SeqIter(Mary) iter = { mary }; iter | m; ) { 228 248 sout | m.i | m.j | ' '; 229 249 } … … 234 254 split( mary2, mary, middle ); 235 255 236 for ( over( maryIter, mary ); maryIter >>m; ) {237 sout | m.i | m.j | ' '; 238 } 239 sout | nl; 240 for ( over( maryIter, mary2 ); maryIter >>m; ) {256 for ( over( iter, mary ); iter | m; ) { 257 sout | m.i | m.j | ' '; 258 } 259 sout | nl; 260 for ( over( iter, mary2 ); iter | m; ) { 241 261 sout | m.i | m.j | ' '; 242 262 } … … 245 265 transfer( mary, mary2 ); 246 266 247 for ( over( maryIter, mary ); maryIter >> m; ) { 248 sout | m.i | m.j | ' '; 249 } 250 sout | nl; 251 for ( over( maryIter, mary ); maryIter >> m; ) { 267 for ( over( iter, mary ); iter | m; ) { 268 sout | m.i | m.j | ' '; 269 } 270 sout | nl; 271 272 for ( over( iter, mary ); iter | m; ) { 252 273 delete( &m ); 253 274 } -
tests/collections/stack.cfa
r9536761 r657c36f 19 19 20 20 Stack(Fred) fred; 21 StackIter(Fred) fredIter = { fred };21 StackIter(Fred) inter = { fred }; 22 22 Fred & f; 23 23 24 24 sout | nlOff; // turn off auto newline 25 25 26 for ( ; fredIter >>f; ) { // empty list26 for ( ; inter | f; ) { // empty list 27 27 sout | f.i | ' '; 28 28 } … … 33 33 } 34 34 35 for ( StackIter(Fred) iter = { fred }; iter >>f; ) {35 for ( StackIter(Fred) iter = { fred }; iter | f; ) { 36 36 sout | f.i | ' '; 37 37 } … … 44 44 } 45 45 46 for ( over( fredIter, fred ); fredIter >>f; ) {46 for ( over( inter, fred ); inter | f; ) { 47 47 sout | f.i | ' '; 48 48 } … … 52 52 push( fred, *new( 2 * i + 1 ) ); 53 53 } 54 for ( over( fredIter, fred ); fredIter >>f; ) {54 for ( over( inter, fred ); inter | f; ) { 55 55 sout | f.i | ' '; 56 56 } 57 57 sout | nl; 58 58 59 for ( over( fredIter, fred ); fredIter >>f; ) {59 for ( over( inter, fred ); inter | f; ) { 60 60 delete( &f ); 61 61 } … … 81 81 Mary & m; 82 82 83 for ( ; maryIter >>m; ) { // empty list83 for ( ; maryIter | m; ) { // empty list 84 84 sout | m.i | m.j | ' '; 85 85 } … … 90 90 } 91 91 92 for ( StackIter(Mary) iter = { mary }; iter >>m; ) {92 for ( StackIter(Mary) iter = { mary }; iter | m; ) { 93 93 sout | m.i | m.j | ' '; 94 94 } … … 99 99 } 100 100 101 for ( over( maryIter, mary ); maryIter >>m; ) {101 for ( over( maryIter, mary ); maryIter | m; ) { 102 102 sout | m.i | m.j | ' '; 103 103 } … … 107 107 push( mary, *new( 2 * i + 1 ) ); 108 108 } 109 for ( over( maryIter, mary ); maryIter >>m; ) {109 for ( over( maryIter, mary ); maryIter | m; ) { 110 110 sout | m.i | m.j | ' '; 111 111 } 112 112 sout | nl; 113 113 114 for ( over( maryIter, mary ); maryIter >>m; ) {114 for ( over( maryIter, mary ); maryIter | m; ) { 115 115 delete( &m ); 116 116 }
Note: See TracChangeset
for help on using the changeset viewer.