| ... | ... | @@ -1416,4 +1416,34 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 1416 | 1416 | \\ } |
| 1417 | 1417 | \\} |
| 1418 | 1418 | ); |
| 1419 | |
| 1420 | // cases.add("empty array with initializer", |
| 1421 | // "int a[4] = {};" |
| 1422 | // , |
| 1423 | // "pub var a: [4]c_int = [1]c_int{0} ** 4;" |
| 1424 | // ); |
| 1425 | |
| 1426 | // cases.add("array with initialization", |
| 1427 | // "int a[4] = {1, 2, 3, 4};" |
| 1428 | // , |
| 1429 | // "pub var a: [4]c_int = [4]c_int{1, 2, 3, 4};" |
| 1430 | // ); |
| 1431 | |
| 1432 | // cases.add("array with incomplete initialization", |
| 1433 | // "int a[4] = {3, 4};" |
| 1434 | // , |
| 1435 | // "pub var a: [4]c_int = [2]c_int{3, 4} ++ ([1]c_int{0} ** 2);" |
| 1436 | // ); |
| 1437 | |
| 1438 | // cases.add("2D array with initialization", |
| 1439 | // "int a[3][3] = { {1, 2, 3}, {4, 5, 6}, {7, 8, 9} };" |
| 1440 | // , |
| 1441 | // "pub var a: [3][3]c_int = [3][3]c_int{[3]c_int{1, 2, 3}, [3]c_int{4, 5, 6}, [3]c_int{7, 8, 9}};" |
| 1442 | // ); |
| 1443 | |
| 1444 | // cases.add("2D array with incomplete initialization", |
| 1445 | // "int a[3][3] = { {1, 2}, {4, 5, 6} };" |
| 1446 | // , |
| 1447 | // "pub var a: [3][3]c_int = [2][3]c_int{[2]c_int{1, 2} ++ [1]c_int{0}, [3]c_int{4, 5, 6}} ++ [1][3]c_int{[1]c_int{0} ** 3};" |
| 1448 | // ); |
| 1419 | 1449 | } |