- Timestamp:
- Jun 23, 2021, 4:59:37 PM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 27434e9
- Parents:
- 6448f7d
- Location:
- tests/array-container
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/array-container/array-basic.cfa
r6448f7d r1d71208 105 105 printf("result Ws [][][][] lo = %f\n", result); 106 106 107 result = total1d_low( wxyz[ [all, slice_ix, slice_ix, slice_ix]] );107 result = total1d_low( wxyz[all, slice_ix, slice_ix, slice_ix] ); 108 108 printf("result Ws [,,,] lo = %f\n", result); 109 109 … … 111 111 printf("result Ws [][][][] hi = %f\n", result); 112 112 113 result = total1d_hi( wxyz[ [all, slice_ix, slice_ix, slice_ix]] );113 result = total1d_hi( wxyz[all, slice_ix, slice_ix, slice_ix] ); 114 114 printf("result Ws [,,,] hi = %f\n", result); 115 115 … … 124 124 printf("result Xs [][][][] lo = %f\n", result); 125 125 126 result = total1d_low( wxyz[ [slice_ix, all, slice_ix, slice_ix]] );126 result = total1d_low( wxyz[slice_ix, all, slice_ix, slice_ix] ); 127 127 printf("result Xs [,,,] lo = %f\n", result); 128 128 … … 130 130 printf("result Xs [][][][] hi = %f\n", result); 131 131 132 result = total1d_hi( wxyz[ [slice_ix, all, slice_ix, slice_ix]] );132 result = total1d_hi( wxyz[slice_ix, all, slice_ix, slice_ix] ); 133 133 printf("result Xs [,,,] hi = %f\n", result); 134 134 -
tests/array-container/array-md-sbscr-cases.cfa
r6448f7d r1d71208 53 53 // order wxyz, natural split (4-0 or 0-4, no intermediate to declare) 54 54 55 assert(( wxyz[ [iw, ix, iy, iz]] == valExpected ));55 assert(( wxyz[iw, ix, iy, iz] == valExpected )); 56 56 57 57 // order wxyz, unnatural split 1-3 (three ways declared) 58 58 59 59 typeof( wxyz[iw] ) xyz1 = wxyz[iw]; 60 assert(( xyz1[ [ix, iy, iz]] == valExpected ));60 assert(( xyz1[ix, iy, iz] == valExpected )); 61 61 62 62 typeof( wxyz[iw] ) xyz2; 63 63 &xyz2 = &wxyz[iw]; 64 assert(( xyz2[ [ix, iy, iz]] == valExpected ));65 66 assert(( wxyz[iw][ [ix, iy, iz]] == valExpected ));64 assert(( xyz2[ix, iy, iz] == valExpected )); 65 66 assert(( wxyz[iw][ix, iy, iz] == valExpected )); 67 67 68 68 // order wxyz, unnatural split 2-2 (three ways declared) 69 69 70 typeof( wxyz[ [iw, ix]] ) yz1 = wxyz[[iw,ix]];71 assert(( yz1[ [iy, iz]] == valExpected ));72 73 typeof( wxyz[ [iw, ix]] ) yz2;74 &yz2 = &wxyz[ [iw, ix]];75 assert(( yz2[ [iy, iz]] == valExpected ));76 77 assert(( wxyz[ [iw, ix]][[iy, iz]] == valExpected ));70 typeof( wxyz[iw, ix] ) yz1 = wxyz[iw,ix]; 71 assert(( yz1[iy, iz] == valExpected )); 72 73 typeof( wxyz[iw, ix] ) yz2; 74 &yz2 = &wxyz[iw, ix]; 75 assert(( yz2[iy, iz] == valExpected )); 76 77 assert(( wxyz[iw, ix][iy, iz] == valExpected )); 78 78 79 79 // order wxyz, unnatural split 3-1 (three ways declared) 80 80 81 typeof( wxyz[ [iw, ix, iy]] ) z1 = wxyz[[iw, ix, iy]];81 typeof( wxyz[iw, ix, iy] ) z1 = wxyz[iw, ix, iy]; 82 82 assert(( z1[iz] == valExpected )); 83 83 84 typeof( wxyz[ [iw, ix, iy]] ) z2;85 &z2 = &wxyz[ [iw, ix, iy]];84 typeof( wxyz[iw, ix, iy] ) z2; 85 &z2 = &wxyz[iw, ix, iy]; 86 86 assert(( z2[iz] == valExpected )); 87 87 88 assert(( wxyz[ [iw, ix, iy]][iz] == valExpected ));88 assert(( wxyz[iw, ix, iy][iz] == valExpected )); 89 89 } 90 90 … … 104 104 // order wxyz (no intermediates to declare) 105 105 106 assert(( wxyz[ [iw , ix , iy , iz ]] == valExpected ));107 assert(( wxyz[ [iw-1, ix , iy , iz ]] != valExpected ));106 assert(( wxyz[iw , ix , iy , iz ] == valExpected )); 107 assert(( wxyz[iw-1, ix , iy , iz ] != valExpected )); 108 108 109 109 // order xyzw: *xyz, w 110 110 111 assert(( wxyz[ [all , ix , iy , iz ]][iw ] == valExpected ));112 assert(( wxyz[ [all , ix-1, iy , iz ]][iw ] != valExpected ));113 assert(( wxyz[ [all , ix , iy , iz ]][iw-1] != valExpected ));111 assert(( wxyz[all , ix , iy , iz ][iw ] == valExpected )); 112 assert(( wxyz[all , ix-1, iy , iz ][iw ] != valExpected )); 113 assert(( wxyz[all , ix , iy , iz ][iw-1] != valExpected )); 114 114 115 115 // order wyzx: w*yz, x 116 116 117 assert(( wxyz[ [iw , all , iy , iz ]][ix ] == valExpected ));118 assert(( wxyz[ [iw , all , iy-1, iz ]][ix ] != valExpected ));119 assert(( wxyz[ [iw , all , iy , iz ]][ix-1] != valExpected ));117 assert(( wxyz[iw , all , iy , iz ][ix ] == valExpected )); 118 assert(( wxyz[iw , all , iy-1, iz ][ix ] != valExpected )); 119 assert(( wxyz[iw , all , iy , iz ][ix-1] != valExpected )); 120 120 121 121 // order wxzy: wx*z, y 122 122 #if 0 123 123 // not working on 32-bit 124 assert(( wxyz[ [iw , ix , all , iz ]][iy ] == valExpected ));125 assert(( wxyz[ [iw , ix , all , iz-1]][iy ] != valExpected ));126 assert(( wxyz[ [iw , ix , all , iz ]][iy-1] != valExpected ));124 assert(( wxyz[iw , ix , all , iz ][iy ] == valExpected )); 125 assert(( wxyz[iw , ix , all , iz-1][iy ] != valExpected )); 126 assert(( wxyz[iw , ix , all , iz ][iy-1] != valExpected )); 127 127 #endif 128 128 } … … 131 131 // The comments specify a covering set of orders, each in its most natural split. 132 132 // Covering means that each edge on the lattice of dimesnions-provided is used. 133 // Natural split means the arity of every -[ [-,...]] tuple equals the dimensionality of its "this" operand, then that the fewest "all" subscripts are given.133 // Natural split means the arity of every -[-,...] tuple equals the dimensionality of its "this" operand, then that the fewest "all" subscripts are given. 134 134 // The commented-out test code shows cases that don't work. We wish all the comment-coverd cases worked. 135 135 forall( [Nw], [Nx], [Ny], [Nz] ) … … 147 147 // order wxyz (no intermediates to declare) 148 148 149 assert(( wxyz[ [iw, ix, iy, iz]] == valExpected ));149 assert(( wxyz[iw, ix, iy, iz] == valExpected )); 150 150 151 151 { … … 153 153 assert( wxyz[iw][all][iy][all] [ix][iz] == valExpected ); 154 154 155 typeof( wxyz[ [iw, all, iy, all]] ) xz1 = wxyz[[iw, all, iy, all]];156 assert(( xz1[ [ix, iz]] == valExpected ));157 158 typeof( wxyz[ [iw, all, iy, all]] ) xz2;159 &xz2 = &wxyz[ [iw, all, iy, all]];160 assert(( xz2[ [ix, iz]] == valExpected ));161 162 assert(( wxyz[ [iw , all, iy , all]][[ix , iz ]] == valExpected ));163 assert(( wxyz[ [iw-1, all, iy , all]][[ix , iz ]] != valExpected ));164 assert(( wxyz[ [iw , all, iy-1, all]][[ix , iz ]] != valExpected ));165 assert(( wxyz[ [iw , all, iy , all]][[ix-1, iz ]] != valExpected ));166 assert(( wxyz[ [iw , all, iy , all]][[ix , iz-1]] != valExpected ));155 typeof( wxyz[iw, all, iy, all] ) xz1 = wxyz[iw, all, iy, all]; 156 assert(( xz1[ix, iz] == valExpected )); 157 158 typeof( wxyz[iw, all, iy, all] ) xz2; 159 &xz2 = &wxyz[iw, all, iy, all]; 160 assert(( xz2[ix, iz] == valExpected )); 161 162 assert(( wxyz[iw , all, iy , all][ix , iz ] == valExpected )); 163 assert(( wxyz[iw-1, all, iy , all][ix , iz ] != valExpected )); 164 assert(( wxyz[iw , all, iy-1, all][ix , iz ] != valExpected )); 165 assert(( wxyz[iw , all, iy , all][ix-1, iz ] != valExpected )); 166 assert(( wxyz[iw , all, iy , all][ix , iz-1] != valExpected )); 167 167 } 168 168 { … … 170 170 assert( wxyz[iw][all][all][iz] [ix][iy] == valExpected ); 171 171 172 // typeof( wxyz[ [iw, all, all, iz]] ) xy1 = wxyz[[iw, all, all, iz]];173 // assert(( xy1[ [ix, iy]] == valExpected ));174 175 // typeof( wxyz[ [iw, all, all, iz]] ) xy2;176 // &xy2 = &wxyz[ [iw, all, all, iz]];177 // assert(( xy2[ [ix, iy]] == valExpected ));178 179 // assert(( wxyz[ [iw , all, all, iz ]][[ix , iy ]] == valExpected ));180 // assert(( wxyz[ [iw-1, all, all, iz ]][[ix , iy ]] != valExpected ));181 // assert(( wxyz[ [iw , all, all, iz-1]][[ix , iy ]] != valExpected ));182 // assert(( wxyz[ [iw , all, all, iz ]][[ix-1, iy ]] != valExpected ));183 // assert(( wxyz[ [iw , all, all, iz ]][[ix , iy-1]] != valExpected ));172 // typeof( wxyz[iw, all, all, iz] ) xy1 = wxyz[iw, all, all, iz]; 173 // assert(( xy1[ix, iy] == valExpected )); 174 175 // typeof( wxyz[iw, all, all, iz] ) xy2; 176 // &xy2 = &wxyz[iw, all, all, iz]; 177 // assert(( xy2[ix, iy] == valExpected )); 178 179 // assert(( wxyz[iw , all, all, iz ][ix , iy ] == valExpected )); 180 // assert(( wxyz[iw-1, all, all, iz ][ix , iy ] != valExpected )); 181 // assert(( wxyz[iw , all, all, iz-1][ix , iy ] != valExpected )); 182 // assert(( wxyz[iw , all, all, iz ][ix-1, iy ] != valExpected )); 183 // assert(( wxyz[iw , all, all, iz ][ix , iy-1] != valExpected )); 184 184 } 185 185 { … … 187 187 assert( wxyz[all][ix][iy][all] [iw][iz] == valExpected ); 188 188 189 typeof( wxyz[ [all, ix, iy, all]] ) wz1 = wxyz[[all, ix, iy, all]];190 assert(( wz1[ [iw, iz]] == valExpected ));191 192 assert(( wxyz[ [all , ix, iy , all]][[iw , iz ]] == valExpected ));189 typeof( wxyz[all, ix, iy, all] ) wz1 = wxyz[all, ix, iy, all]; 190 assert(( wz1[iw, iz] == valExpected )); 191 192 assert(( wxyz[all , ix, iy , all][iw , iz ] == valExpected )); 193 193 } 194 194 { … … 196 196 assert( wxyz[all][ix][all][iz] [iw][iy] == valExpected ); 197 197 198 // assert(( wxyz[ [all , ix , all , iz ]][[iw , iy ]] == valExpected ));198 // assert(( wxyz[all , ix , all , iz ][iw , iy ] == valExpected )); 199 199 } 200 200 { … … 202 202 assert( wxyz[all][all][iy][iz] [iw][ix] == valExpected ); 203 203 204 // assert(( wxyz[ [all , all , iy , iz ]][[iw , ix ]] == valExpected ));204 // assert(( wxyz[all , all , iy , iz ][iw , ix ] == valExpected )); 205 205 } 206 206 { … … 208 208 assert( wxyz[all][ix][all][all] [iw][all][iz] [iy] == valExpected ); 209 209 210 typeof( wxyz[all][ix][all][all] ) wyz_workaround = wxyz[ [all , ix , all , all ]];211 typeof( wyz_workaround[iw][all][iz] ) y_workaround = wyz_workaround[ [iw , all , iz ]];210 typeof( wxyz[all][ix][all][all] ) wyz_workaround = wxyz[all , ix , all , all ]; 211 typeof( wyz_workaround[iw][all][iz] ) y_workaround = wyz_workaround[iw , all , iz ]; 212 212 assert( y_workaround[iy] == valExpected ); 213 213 214 // assert(( wxyz[ [all , ix , all , all ]][[iw , all , iz ]][iy ] == valExpected ));214 // assert(( wxyz[all , ix , all , all ][iw , all , iz ][iy ] == valExpected )); 215 215 } 216 216 { … … 239 239 valExpected = getMagicNumber(2, 3, 4, 5); 240 240 assert(( wxyz [2] [3] [4] [5] == valExpected )); 241 assert(( wxyz[ [2, 3]][4] [5] == valExpected ));242 assert(( wxyz [2][ [3, 4]][5] == valExpected ));243 assert(( wxyz [2] [3][ [4, 5]] == valExpected ));244 assert(( wxyz[ [2, 3, 4]][5] == valExpected ));245 assert(( wxyz [2][ [3, 4, 5]] == valExpected ));246 assert(( wxyz[ [2, 3, 4, 5]] == valExpected ));241 assert(( wxyz[2, 3][4] [5] == valExpected )); 242 assert(( wxyz [2][3, 4][5] == valExpected )); 243 assert(( wxyz [2] [3][4, 5] == valExpected )); 244 assert(( wxyz[2, 3, 4][5] == valExpected )); 245 assert(( wxyz [2][3, 4, 5] == valExpected )); 246 assert(( wxyz[2, 3, 4, 5] == valExpected )); 247 247 248 248 for ( i; Nw ) { 249 assert(( wxyz[ [ i, 3, 4, 5 ]] == getMagicNumber(i, 3, 4, 5) ));249 assert(( wxyz[ i, 3, 4, 5 ] == getMagicNumber(i, 3, 4, 5) )); 250 250 } 251 251 252 252 for ( i; Nx ) { 253 assert(( wxyz[ [ 2, i, 4, 5 ]] == getMagicNumber(2, i, 4, 5) ));253 assert(( wxyz[ 2, i, 4, 5 ] == getMagicNumber(2, i, 4, 5) )); 254 254 } 255 255 256 256 for ( i; Ny ) { 257 assert(( wxyz[ [ 2, 3, i, 5 ]] == getMagicNumber(2, 3, i, 5) ));257 assert(( wxyz[ 2, 3, i, 5 ] == getMagicNumber(2, 3, i, 5) )); 258 258 } 259 259 260 260 for ( i; Nz ) { 261 assert(( wxyz[ [ 2, 3, 4, i ]] == getMagicNumber(2, 3, 4, i) ));261 assert(( wxyz[ 2, 3, 4, i ] == getMagicNumber(2, 3, 4, i) )); 262 262 } 263 263 264 264 for ( i; Nw ) { 265 assert(( wxyz[ [ i, all, 4, 5 ]][3] == getMagicNumber(i, 3, 4, 5) ));265 assert(( wxyz[ i, all, 4, 5 ][3] == getMagicNumber(i, 3, 4, 5) )); 266 266 } 267 267 268 268 for ( i; Nw ) { 269 assert(( wxyz[ [ all, 3, 4, 5 ]][i] == getMagicNumber(i, 3, 4, 5) ));269 assert(( wxyz[ all, 3, 4, 5 ][i] == getMagicNumber(i, 3, 4, 5) )); 270 270 } 271 271 }
Note: See TracChangeset
for help on using the changeset viewer.