source: CIVL/examples/mem/mem_tests/mem_contains_complex2.cvl

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: 840 bytes
Line 
1#include<mem.cvh>
2#include<stdlib.h>
3
4union U {
5 int x[10][10];
6 int y[10][10];
7};
8
9struct U2 {
10 int x[10][10];
11};
12
13struct T {
14 union U u[10][10];
15 struct U2 u2[10][10];
16} a[100];
17
18int main() {
19 $assert($mem_contains(&a, &a[(0 .. 90) + (0 .. 9)]));
20 $assert($mem_contains(&a[0 .. 99], &a));
21 $assert($mem_contains(&a[(9 .. 99) + (-9 .. 0)], &a));
22 $assert(!$mem_contains(&a[0 .. 98], &a));
23
24 $assert($mem_contains(&a[0 .. 99].u[0 .. 9][0 .. 9], &a[0 .. 99].u[0 .. 9][0 .. 9].x[0 .. 9][0 .. 9]));
25 $assert($mem_contains(&a[0 .. 99].u[0 .. 9][0 .. 9], &a[0 .. 99].u[0 .. 9][0 .. 9].y[0 .. 9][0 .. 9]));
26 $assert($mem_contains(&a[0 .. 99].u2[0 .. 9][0 .. 9], &a[0 .. 99].u2[0 .. 9][0 .. 9].x[0 .. 9][0 .. 9]));
27 $assert($mem_contains(&a[0 .. 99].u2[0 .. 9][0 .. 9].x[0 .. 9][0 .. 9], &a[0 .. 99].u2[0 .. 9][0 .. 9]));
28}
Note: See TracBrowser for help on using the repository browser.