source: CIVL/examples/backend/printExpr.cvl@ d6f5e4c

1.23 2.0 main test-branch
Last change on this file since d6f5e4c was 0d2a850, checked in by Manchun Zheng <zmanchun@…>, 11 years ago

added more tests for printing symbolic expressions.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@2413 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 1.5 KB
Line 
1#include <civlc.cvh>
2#include <seq.cvh>
3
4typedef struct Point{
5 double x;
6 double y;
7} Point;
8
9typedef struct Line{
10 Point start;
11 Point end;
12} Line;
13
14typedef union MyUnion{
15 int a;
16 double b;
17} MyUnion;
18
19$input int x;
20$input int y;
21$input MyUnion MU;
22$input double dx;
23$input double dy;
24$input int _A[];
25$input _Bool B;
26$input $proc p;
27$input Point pt;
28$assume(p != $self);
29$input $scope sc;
30$assume(sc != $root);
31$assume(dx!=0);
32$proc p1;
33$abstract int random(int t);
34
35void structs(){
36 Point p0={0,0}, p1={1,1}, p2;
37 Line l0={p0, p1}, l1={p1,p2}, l2={p2, p0};
38 Line lines[3];
39
40 //$assume(y>=0 && y<3);
41 //lines[y]=l1;
42 p2.x=2;
43 p2.y=2;
44 lines[0]=l0;
45 lines[1]=l1;
46 lines[2]=l2;
47}
48
49int call(int f(int), int arg){
50 return f(arg);
51}
52
53int sum(int n){
54 int result=0;
55
56 for(int i=1; i<=n; i++)
57 result+=i;
58 return result;
59}
60
61void main(){
62 int (*k)(int)=&sum;
63 int A[10];
64 int*p;
65 int n, n1, n2, n3, n4, n5, n6, n7, n8, n9;
66 _Bool b, b1, b2, b3;
67 double d1,d2;
68 int null;
69 MyUnion mu;
70
71 A[1]=8;
72 A[2]=9;
73 A[3]=7;
74 n=A[2];
75 $assume(0<=x && x<10);
76 A[x]=9;
77 n=A[x];
78 n=x+y;
79 n=$seq_length(&_A);
80 b = x && y;
81 b=x<y;
82 b=x<=y;
83 b=(_Bool)x;
84 $assume(x!=0);
85 n1=y/x;
86 d1=dy/dx;
87 n2=y%x;
88 n3=x*y;
89 n4=-y;
90 b1=x!=y;
91 b2=!B;
92 b3= B || b1;
93 n5=x-y;
94 b=x==y;
95 n6=pt.x;
96 n7=random(n);
97 n8=x*x*x*x*x;
98 n9=MU.a;
99 d2=MU.b;
100 mu.a=n6;
101 structs();
102 p=(int*)$malloc($root, sizeof(int)*10);
103 call(k, 2);
104 p1=$spawn sum(1);
105 p[5]=5;
106 $wait(p1);
107 $free(p);
108}
Note: See TracBrowser for help on using the repository browser.