source: CIVL/examples/library/civlc/contains.cvl@ d87ec9c

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

added system function translate_ptr() and a test method accordingly.

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

  • Property mode set to 100644
File size: 496 bytes
Line 
1#include <civlc.h>
2
3typedef struct point{
4int x;
5int y;
6} point;
7
8void main(){
9 int a[5] = {[3]=4};
10 _Bool result;
11 point set[3];
12
13 result = $contains(&a, &a[2]);
14 $assert(result);
15 result = $contains(&a[2], &a[3]);
16 $assert(!result);
17 result = $contains(&a[2], &a[2]);
18 $assert(result);
19 for(int i = 0; i < 3; i++){
20 set[i].x = i;
21 set[i].y = i;
22 }
23 result = $contains(&set, &set[1].y);
24 $assert(result);
25 result = $contains(&set[1].x, &set[1].y);
26 $assert(!result);
27}
Note: See TracBrowser for help on using the repository browser.