source: CIVL/examples/languageFeatures/quantifiedComp.cvl@ 4f3a349

1.23 2.0 main test-branch
Last change on this file since 4f3a349 was ca6241a, checked in by Manchun Zheng <zmanchun@…>, 10 years ago

fixed the bug when evaluating a quantified expression whose restriction is invalid; added test accordingly: LanguageFeaturesTest.quantifiedComp().

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

  • Property mode set to 100644
File size: 392 bytes
Line 
1#include <civlc.cvh>
2#include <assert.h>
3
4$input int n=3;
5$input int x;
6$input int y;
7$input int X1[n];
8
9$assume (x < n && y < n && x >=0 && y>=0);
10
11int lcp(int *arr, int n, int x, int y){
12 int l=0;
13 while (x+l<n && y+l<n && arr[x+l]==arr[y+l]) {
14 l++;
15 }
16 return l;
17}
18
19void main(){
20 int result = lcp(X1, n, x, y);
21 assert($forall {int i | i>=0 && i<result} X1[x+i] == X1[y+i]);
22}
Note: See TracBrowser for help on using the repository browser.