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

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

added more test scenarios for the pretty printing of symbolic expressions.

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

  • Property mode set to 100644
File size: 1.2 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
14$input int x;
15$input int y;
16$input int _A[];
17$input $proc p;
18$input Point pt;
19$assume(p != $self);
20$input $scope sc;
21$assume(sc != $root);
22$proc p1;
23$abstract int random(int t);
24
25void structs(){
26 Point p0={0,0}, p1={1,1}, p2;
27 Line l0={p0, p1}, l1={p1,p2}, l2={p2, p0};
28 Line lines[3];
29
30 //$assume(y>=0 && y<3);
31 //lines[y]=l1;
32 p2.x=2;
33 p2.y=2;
34 lines[0]=l0;
35 lines[1]=l1;
36 lines[2]=l2;
37}
38
39int call(int f(int), int arg){
40 return f(arg);
41}
42
43int sum(int n){
44 int result=0;
45
46 for(int i=1; i<=n; i++)
47 result+=i;
48 return result;
49}
50
51void main(){
52 int (*k)(int)=&sum;
53 int A[10];
54 int*p;
55 int n;
56 _Bool b;
57 int null;
58
59 A[1]=8;
60 A[2]=9;
61 A[3]=7;
62 n=A[2];
63 $assume(0<=x && x<10);
64 A[x]=9;
65 n=A[x];
66 n=x+y;
67 n=$seq_length(&_A);
68 b = x && y;
69 b=x<y;
70 b=x<=y;
71 b=(_Bool)x;
72 $assume(x!=0);
73 n=y/x;
74 n=y%x;
75 n=x*y;
76 n=-y;
77 n=x!=y;
78 b=!b;
79 b= x||y;
80 n=x-y;
81 b=x==y;
82 n=pt.x;
83 n=random(n);
84 structs();
85 p=(int*)$malloc($root, sizeof(int)*10);
86 call(k, 2);
87 p1=$spawn sum(1);
88 p[5]=5;
89 $wait(p1);
90 $free(p);
91}
Note: See TracBrowser for help on using the repository browser.