main
test-branch
| Line | |
|---|
| 1 | #include<assert.h>
|
|---|
| 2 |
|
|---|
| 3 | int n = 10;
|
|---|
| 4 |
|
|---|
| 5 | struct T2 {
|
|---|
| 6 | double a[n];
|
|---|
| 7 | };
|
|---|
| 8 |
|
|---|
| 9 | struct T {
|
|---|
| 10 | int a;
|
|---|
| 11 | int b;
|
|---|
| 12 | struct {
|
|---|
| 13 | int c;
|
|---|
| 14 | };
|
|---|
| 15 | struct T2 d[10];
|
|---|
| 16 | $domain(1) e[2];
|
|---|
| 17 | union T3 {
|
|---|
| 18 | int f;
|
|---|
| 19 | int g;
|
|---|
| 20 | char * h;
|
|---|
| 21 | } u;
|
|---|
| 22 | };
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 | int main() {
|
|---|
| 26 | $range r = 0 .. 2;
|
|---|
| 27 | struct T t = {1, 2, .e={($domain){r}, ($domain){r}}, {.h="abc"}};
|
|---|
| 28 |
|
|---|
| 29 | assert(t.a == 1);
|
|---|
| 30 | assert(t.b == 2);
|
|---|
| 31 | assert($forall (int i : 0 .. 9)
|
|---|
| 32 | $forall (int j : 0 .. n-1)
|
|---|
| 33 | t.d[i].a[j] == 0);
|
|---|
| 34 | assert(t.u.h[0] == 'a' && t.u.h[1] == 'b' && t.u.h[2] == 'c' &&
|
|---|
| 35 | t.u.h[3] == 0);
|
|---|
| 36 | return 0;
|
|---|
| 37 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.