main
|
Last change
on this file was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago |
|
Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.
git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5704 fb995dde-84ed-4084-dfe6-e5aef3e2452c
|
-
Property mode
set to
100644
|
|
File size:
547 bytes
|
| 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.