source: CIVL/examples/backend/printExpr.cvl@ 205d294

1.23 2.0 acw/focus-triggers main test-branch
Last change on this file since 205d294 was 205d294, checked in by Manchun Zheng <zmanchun@…>, 11 years ago

added more tests for the pretty printing of symbolic expressions.

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

  • Property mode set to 100644
File size: 972 bytes
Line 
1#include <civlc.cvh>
2
3typedef struct Point{
4 double x;
5 double y;
6} Point;
7
8typedef struct Line{
9 Point start;
10 Point end;
11} Line;
12
13$input int x;
14$input int y;
15$input $proc p;
16$assume(p != $self);
17$input $scope sc;
18$assume(sc != $root);
19$proc p1;
20$abstract int random(int t);
21
22void structs(){
23 Point p0={0,0}, p1={1,1}, p2;
24 Line l0={p0, p1}, l1={p1,p2}, l2={p2, p0};
25 Line lines[3];
26
27 $assume(y>=0 && y<3);
28 lines[y]=l1;
29
30 p2.x=2;
31 p2.y=2;
32 lines[0]=l0;
33 lines[1]=l1;
34 lines[2]=l2;
35}
36
37int call(int f(int), int arg){
38 return f(arg);
39}
40
41int sum(int n){
42 int result=0;
43
44 for(int i=1; i<=n; i++)
45 result+=i;
46 return result;
47}
48
49void main(){
50 int (*k)(int)=&sum;
51 int A[10];
52 int*p;
53 int n;
54 _Bool b;
55
56 A[1]=8;
57 A[2]=9;
58 A[3]=7;
59 n=A[2];
60 $assume(0<=x && x<10);
61 A[x]=9;
62 n=A[x];
63 n=x+y;
64 b = x && y;
65 n=random(n);
66 structs();
67 p=(int*)$malloc($root, sizeof(int)*10);
68 call(k, 2);
69 p1=$spawn sum(1);
70 p[5]=5;
71 $wait(p1);
72 $free(p);
73}
Note: See TracBrowser for help on using the repository browser.