source: CIVL/examples/analysis/abs.c@ 75982de

1.23 2.0 main test-branch
Last change on this file since 75982de was 9570bc1, checked in by Manchun Zheng <zmanchun@…>, 11 years ago

added Makefile for analysis examples; improved the coverage of abs call analyzer.

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

  • Property mode set to 100644
File size: 406 bytes
RevLine 
[b1b88d8]1#include <stdlib.h>
[9570bc1]2#include <civlc.cvh>
[b1b88d8]3
[9570bc1]4$input int i;
5$input int x;
6$input int y;
7$input int z;
8$assume(x<0);
9$assume(y>0);
[b1b88d8]10void main(){
11 int a = 9;
12
[9570bc1]13 a=abs(0); // 0
14 a=abs(x); // -
15 a=abs(y); // +
16 a=abs(z); // *
17 a=abs(x*y*z); // *
18
19 a=abs(x*y); // -
20 $assert(x*y<=0);
21
22 a=abs(x%y); //+
23 $assert(x%y>=0);
24
25 a=abs((-x)%y); // +
26 $assert((-x)%y>=0);
[b1b88d8]27}
Note: See TracBrowser for help on using the repository browser.