Skip to content

Commit cb16184

Browse files
committed
Fixing tests and polishing code
1 parent 5a7f3c5 commit cb16184

File tree

10 files changed

+682
-696
lines changed

10 files changed

+682
-696
lines changed

lisa/lisa-analyses/imp-testcases/numeric/numeric.imp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
11
class tutorial {
22

3-
constants(d) {
4-
def c = 0;
5-
def b = 1;
6-
if (d > 10)
7-
c = -2;
8-
else
9-
c = 2;
10-
b = b + c;
11-
return b;
12-
}
13-
14-
/*
153
constants() {
164
def c = 1;
175
def b = 0;
@@ -121,6 +109,4 @@ class tutorial {
121109
}
122110
return x;
123111
}
124-
*/
125-
126112
}

lisa/lisa-analyses/imp-testcases/stability/rectangleScale.imp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,8 @@ class Rectangle{
1010
this.botLeftX = 1;
1111
this.botLeftY = 1;
1212
}
13-
}
14-
15-
class scaleBis{
16-
17-
scale(){
13+
14+
main(){
1815
def r = new Rectangle();
1916
def scaleX = 2;
2017
def scaleY = -1;
@@ -31,6 +28,5 @@ class scaleBis{
3128
r.width = botRightX - r.botLeftX;
3229
r.height = topLeftY - r.botLeftY;
3330

34-
}
35-
31+
}
3632
}

lisa/lisa-analyses/imp-testcases/stability/saneScale.imp

Lines changed: 0 additions & 26 deletions
This file was deleted.
Lines changed: 20 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,24 @@
1-
2-
// assume only positive values (negative values are for reflection)
3-
class scale{
4-
5-
main(b) {
6-
def x = 10;
7-
def y = 30;
8-
def width = 3;
9-
def height = 7;
10-
11-
while(b) {
12-
x = x + 1;
13-
y = y + 1;
14-
width = width + 1;
15-
height = height + 1;
16-
}
17-
while(b) {
18-
x = x - 1;
19-
y = y - 1;
20-
width = width - 1;
21-
height = height - 1;
22-
}
23-
24-
this.scale(x, y, width, height);
25-
}
26-
27-
//x, upperRightPointX and width should be covariant
28-
//y, lowerLeftPointY and height should be covariant
29-
//the two groups should be contravariant
1+
class stability {
302
scale(x, y, width, height){
3+
//if (x >= 0 && y >= 0 && width > 0 && height > 0){
314
if (x >= 0)
32-
if (y >= 0)
33-
if(width >= 0)
34-
if (height >= 0){
35-
//if (x >= 0 && y >= 0 && width > 0 && height > 0){
36-
def scale1 = 2;
37-
def scale2 = 3;
38-
39-
def upperRightPointX = x + width;
40-
41-
def lowerLeftPointY = y - height;
42-
43-
x = x * scale1;
44-
y = y * scale2;
45-
upperRightPointX = upperRightPointX * scale1;
46-
lowerLeftPointY = lowerLeftPointY * scale2;
47-
48-
width = x - upperRightPointX;
49-
height = y - lowerLeftPointY;
50-
}
51-
}
52-
/*
53-
// all variables should be covariant
54-
uniformScale(x, y, width, height, scale){
55-
def upperRightPointX = x + width;
56-
57-
def lowerLeftPointY = y - height;
58-
59-
x = x * scale;
60-
y = y * scale;
61-
upperRightPointX = upperRightPointX * scale;
62-
lowerLeftPointY = lowerLeftPointY * scale;
63-
64-
width = x - upperRightPointX;
65-
height = y - lowerLeftPointY;
5+
if (y >= 0)
6+
if(width >= 0)
7+
if (height >= 0) {
8+
def scale1 = 2;
9+
def scale2 = 3;
10+
11+
def upperRightPointX = x + width;
12+
13+
def lowerLeftPointY = y - height;
14+
15+
x = x * scale1;
16+
y = y * scale2;
17+
upperRightPointX = upperRightPointX * scale1;
18+
lowerLeftPointY = lowerLeftPointY * scale2;
19+
20+
width = x - upperRightPointX;
21+
height = y - lowerLeftPointY;
22+
}
6623
}
67-
*/
68-
6924
}

0 commit comments

Comments
 (0)