source: CIVL/examples/library/civlc/messageUnpackBad2.cvl@ 4e86cdd

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

updated examples since $assert/$assume has been changed to functions; fixed the model builder for the new side-effect remover.

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

  • Property mode set to 100644
File size: 428 bytes
Line 
1#include <civlc.cvh>
2#include <comm.cvh>
3
4void main(){
5 int x[2] = {1,2}, *y, *z;
6 $message m = $message_pack(0, 1, 2, x, sizeof(int)*2);
7
8 y = (int *)$malloc($root, sizeof(int)*2);
9 z = (int *)$malloc($root, sizeof(int));
10 $message_unpack(m, y, sizeof(int)*2);
11 $assert((x[0] == y[0] && x[1] == y[1]));
12 m = $message_pack(0, 1, 2, x, sizeof(int)*2);
13 $message_unpack(m, z, sizeof(int)); //needs better error report
14}
Note: See TracBrowser for help on using the repository browser.