Changeset a465d751
- Timestamp:
- Jan 30, 2025, 10:50:41 AM (3 months ago)
- Branches:
- master
- Children:
- 372d33c
- Parents:
- 161b98e
- Location:
- tests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified tests/.expect/designations.txt ¶
r161b98e ra465d751 42 42 =====C===== 43 43 44 ====ARR==== 45 [0, 3] 46 3 47 ====ARR==== 48 44 49 =====E===== 45 50 (A){ 2 3 (nil) } … … 52 57 =====E===== 53 58 59 ==STRINGS== 60 hello 61 hello 62 abc 63 [a, b, c] 64 [a, b] 65 [c, d] 66 [c, d] 67 a 68 ==STRINGS== 69 70 ===EXTRA=== 71 (point){ 7 5 } 72 (foo){ 4.000000 } 73 [0, 1, 2, 0, 4, 0] 74 [0 ... 1 ...] 75 [{ 36 0 }, { 0 0 }, { 35 34 } ...] 76 ===EXTRA=== 77 -
TabularUnified tests/designations.cfa ¶
r161b98e ra465d751 16 16 // Note: this test case has been crafted so that it compiles with both cfa and with gcc without any modifications. 17 17 #include <stdio.h> 18 18 19 #ifdef __cforall 19 20 #define AT @ … … 24 25 #pragma GCC diagnostic ignored "-Wmissing-braces" 25 26 #pragma GCC diagnostic ignored "-Woverride-init" 26 #pragma GCC diagnostic ignored "-Wunused-variable"27 27 #pragma GCC diagnostic ignored "-Wmissing-field-initializers" 28 28 … … 161 161 // no initializer - legal C, but garbage values - don't print this one 162 162 struct B z4; 163 // Mark this as unused since it can't be printed. 164 (void)z4; 163 165 164 166 // no curly braces - initialize with object of same type … … 220 222 int i1 = { 3 }; 221 223 224 printf( "====ARR====\n" ); 225 printf( "[%d, %d]\n", i[0], i[1] ); 226 printf( "%d\n", i1 ); 227 printf( "====ARR====\n\n" ); 228 222 229 // doesn't work yet. 223 230 // designate unnamed object's members … … 259 266 const char c2[] = "abc"; 260 267 const char c3[] = { 'a', 'b', 'c' }; 261 const char c4[][2] = { { 'a', 'b' }, { 'c', 'd' }, { 'c', 'd'} };268 const char c4[][2] = { { 'a', 'b' }, { 'c', 'd' }, { 'c', 'd' } }; 262 269 const char ch = c4[0][0]; 270 271 printf( "==STRINGS==\n" ); 272 printf( "%s\n", str0 ); 273 printf( "%s\n", str1 ); 274 printf( "%s\n", c2 ); 275 printf( "[%c, %c, %c]\n", c3[0], c3[1], c3[2] ); 276 for ( unsigned index = 0 ; index < 3 ; ++index ) { 277 printf( "[%c, %c]\n", c4[index][0], c4[index][1] ); 278 } 279 printf( "%c\n", ch ); 280 printf( "==STRINGS==\n\n" ); 263 281 264 282 // more cases … … 270 288 union foo { int i; double d; }; 271 289 union foo f = { .d = 4 }; 272 int v1 = 0, v2 = 0, v4 = 0;290 int v1 = 1, v2 = 2, v4 = 4; 273 291 int w[6] = { [1] = v1, v2, [4] = v4 }; 274 292 int whitespace[256] = { [' '] = 1, ['\t'] = 1, ['\v'] = 1, ['\f'] = 1, ['\n'] = 1, ['\r'] = 1 }; 275 293 struct point ptarray[10] = { [2].y = 34, [2].x = 35, [0].x = 36 }; 294 295 printf( "===EXTRA===\n" ); 296 printf( "(point){ %d %d }\n", p.x, p.y ); 297 printf( "(foo){ %f }\n", f.d ); 298 printf( "[%d, %d, %d, %d, %d, %d]\n", w[0], w[1], w[2], w[3], w[4], w[5] ); 299 printf( "[%d ... %d ...]\n", whitespace[0], whitespace[32] ); 300 printf( "[{ %d %d }, { %d %d }, { %d %d } ...]\n", ptarray[0].x, ptarray[0].y, ptarray[1].x, ptarray[1].y, ptarray[2].x, ptarray[2].y ); 301 printf( "===EXTRA===\n\n" ); 276 302 } 277 303
Note: See TracChangeset
for help on using the changeset viewer.