source: CIVL/examples/library/civlc/messageUnpackBad1.cvl@ ecfe5bf

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

Added separated libraries for civl (including civl implementation and library enabler/evaluator/executor); modified the examples in example/library/civlc accordingly;

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

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