# Iter 2 System Testcases
## todo:
- [x] pair 1
- [x] pair 2
- [x] pair 3
- [x] pair 4
- [ ] pair M1
- [x] pair M2
- [x] pair M3
- [x] pair M4
- [x] pair M5
- [x] pair M6
- [ ] Next*
- [ ] Affects
- [ ] Affects*
- [ ] With clause
- [ ] Create Complex source prog and port over all the previous queries. Make sure they have positive test cases
- Prog must have:
- If in while
- If in if
- While in While
- While in if
- at least 3 prog with calls
- at least 3 levels of nesting at least once
- at least multiple level of conditional Ref in while and if conditions.
- [ ] pair 5 (to replace test 2) (correctness of Source parser)
- [ ] pair 6 (to replace test 3)
- [ ] pair 7 (to replace test 4)
- [ ] pair M4
- [ ] Create isolated source programs (super duper simple and short ones)
- [ ] stress test - > check the queries and limits of the parser.
- [x] autogenerator
- [ ] create long queries
- [ ] Check the bottlenecks
-------
## Source-Query pair 1
### Testing target:
- Enforce single clause queries from iter 1 still work
### SOURCE: iter1-test1.txt
```javascript=
procedure Bumblebee {
read x;
print x;
y = 2 * z;
z = p - y;
if (q != 1) then {
z = x + 24;
}
else
{
while (z > 0) {
y = x * q - 5;
z = z - 1;
}
if (q != z) then {
x = 1 ;
} else {
print x;
}
y = x + y * z + p * q;
}
i = x + j + z;
}
```
### QUERIES: iter1-test1.txt
```javascript
1 - Double synonym
stmt s1, s2; assign a1; print p1; read r1; while w1; if if1; procedure pr1;
Select a1 such that Follows(s1, a1)
3, 4, 9, 13, 14
5000
2 - Double synonym
stmt s1, s2; assign a1; print p1; read r1; while w1; if if1; procedure pr1;
Select a1 such that Parent(r1, p1)
none
5000
3 - Double synonym
stmt s1, s2; assign a1; print p1; read r1; while w1; if if1; procedure pr1;
Select w1 such that Follows(w1, if1)
7
5000
4 - Double synonym
stmt s1, s2; assign a1; print p1; read r1; while w1; if if1; procedure pr1;
Select a1 such that Follows(r1, p1)
3, 4, 6, 8, 9, 11, 13, 14
5000
5 - Double synonym
stmt s1, s2; assign a1; print p1; read r1; while w1; if if1; procedure pr1;
Select a1 such that Parent(if1, a1)
6, 11, 13
5000
6 - Wildcard and single synonym
stmt s1, s2; assign a1; print p1; read r1; while w1; if if1; procedure pr1;
Select s1 such that Follows(_, s1)
2, 3, 4, 5, 9, 10, 13, 14
5000
7 - Single synonym and wildcard
stmt s1, s2; assign a1; print p1; read r1; while w1; if if1; procedure pr1;
Select a1 such that Parent(s1, _)
3, 4, 6, 8, 9, 11, 13, 14
5000
8 - Value and single synonym
stmt s1, s2; assign a1; print p1; read r1; while w1; if if1; procedure pr1;
Select s1 such that Follows(1, s1)
2
5000
9 - Single synonym and value
stmt s1, s2; assign a1; print p1; read r1; while w1; if if1; procedure pr1;
Select s1 such that Parent(s1, 1)
none
5000
10 - Double synonym
stmt s1, s2; assign a1; print p1; read r1; while w1; if if1; procedure pr1;
Select a1 such that Follows* (s1, a1)
3, 4, 9, 13, 14
5000
11 - Double synonym
stmt s1, s2; assign a1; print p1; read r1; while w1; if if1; procedure pr1;
Select a1 such that Parent* ( r1 , p1 )
none
5000
12 - Double synonym
stmt s1, s2; assign a1; print p1; read r1; while w1; if if1; procedure pr1;
Select a1 such that Parent*(if1,a1)
6, 8, 9, 11, 13
5000
13 - Double synonym
stmt s1, s2; assign a1; print p1; read r1; while w1; if if1; procedure pr1;
Select p1 such that Follows*(r1, a1)
2, 12
5000
14 - Double synonym
stmt s1, s2; assign a1; print p1; read r1; while w1; if if1; procedure pr1;
Select a1 such that Follows*(w1, a1)
13
5000
15 - Wildcard and single synonym
stmt s1, s2; assign a1; print p1; read r1; while w1; if if1; procedure pr1;
Select s1 such that Parent*(_, s1)
6, 7, 8, 9, 10, 11, 12, 13
5000
16 - Single synonym and wildcard
stmt s1, s2; assign a1; print p1; read r1; while w1; if if1; procedure pr1;
Select s1 such that Follows*(s1, _)
1, 2, 3, 4, 5, 7, 8, 10
5000
17 - Value and single synonym
stmt s1, s2; assign a1; print p1; read r1; while w1; if if1; procedure pr1;
Select s1 such that Follows*(1, s1)
2, 3, 4, 5, 14
5000
18 - Single synonym and value
stmt s1, s2; assign a1; print p1; read r1; while w1; if if1; procedure pr1;
Select s1 such that Parent*(s1, 1)
none
5000
19 - Double synonym (valid)
stmt s1; variable v1;
Select s1 such that Uses(s1, v1)
2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13, 14
5000
20 - Double synonym (valid)
stmt s1; variable v1;
Select s1 such that Modifies(s1, v1)
1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14
5000
21 - One synonym, one wildcard (valid)
assign a1;
Select a1 such that Uses(a1, _)
3, 4, 6, 8, 9, 13, 14
5000
22 - One synonym, one wildcard (valid)
assign a1;
Select a1 such that Modifies(a1, _)
3, 4, 6, 8, 9, 11, 13, 14
5000
23 - One synonym, one exact match (valid)
print p1;
Select p1 such that Uses(p1, "x")
2, 12
5000
24 - One synonym, one exact match (valid)
print p1;
Select p1 such that Modifies(p1, "x")
none
5000
25 - Double synonym (valid)
read r1; variable v1;
Select r1 such that Uses(r1, v1)
none
5000
26 - Double synonym (valid)
read r1; variable v1;
Select r1 such that Modifies(r1, v1)
1
5000
27 - Double synonym (valid)
while w1; variable v1;
Select w1 such that Uses(w1, v1)
7
5000
28 - Double synonym (valid)
while w1; variable v1;
Select w1 such that Modifies(w1, v1)
7
5000
29 - Double synonym (valid)
if if1; variable v1;
Select if1 such that Uses(if1, v1)
5, 10
5000
30 - Double synonym (valid)
if if1; variable v1;
Select if1 such that Modifies(if1, v1)
5, 10
5000
31 - Zero (valid)
variable v1;
Select v1 such that Uses(0, v1)
none
5000
32 - Zero (valid)
variable v1;
Select v1 such that Modifies(0, v1)
none
5000
33 - Pattern with wildcard on rhs within nested containers
assign a; while w;
Select a pattern a ("x", _)
11
5000
34 - Pattern with wildcard within nested containers
assign a; while w;
Select a pattern a (_, _"x"_)
6, 8, 13, 14
5000
35 - Pattern with exact match (lhs) and partial match (rhs)
assign a; while w;
Select a pattern a ("y", _"z"_)
3, 13
5000
36 - Pattern with exact match (lhs) and partial match (rhs)
assign a; while w;
Select a pattern a ("y", _"z"_)
3, 13
5000
37 - Pattern as a boolean
assign a; while w;
Select w pattern a ("y", _"z"_)
7
5000
38 - Pattern as a boolean (two wildcards)
assign a; while w;
Select w pattern a (_, _)
7
5000
39 - Pattern as a boolean (rhs wildcard)
assign a; while w;
Select w pattern a ("x", _)
7
5000
40 - Pattern as a boolean (lhs wildcards)
assign a; if ifs;
Select ifs pattern a (_, _"p"_)
5, 10
5000
51 - Invalid second argument (invalid)
stmt s1; procedure pr1;
Select s1 such that Uses(s1, pr1)
none
5000
52 - Invalid second argument (invalid)
stmt s1; procedure pr1;
Select s1 such that Modifies(s1, pr1)
none
5000
53 - Invalid second argument (integer string) (invalid)
stmt s1;
Select s1 such that Uses(s1, "9")
none
5000
54 - Invalid second argument (integer string) (invalid)
stmt s1;
Select s1 such that Modifies(s1, "9")
none
5000
55 - Invalid second argument (empty string) (invalid)
stmt s1;
Select s1 such that Uses(s1, "")
none
5000
56 - Invalid second argument (empty string) (invalid)
stmt s1;
Select s1 such that Modifies(s1, "")
none
5000
57 - Invalid second argument (unknown variable) (invalid)
stmt s1;
Select s1 such that Uses(s1, "invalid")
none
5000
58 - Invalid second argument (unknown variable) (invalid)
stmt s1;
Select s1 such that Modifies(s1, "invalid")
none
5000
59 - Incorrect query (invalid value)
stmt s1, s2; assign a1; print p1; read r1; while w1; if if1; procedure pr1;
Select a1 such that Follows*(_, test)
none
5000
60 - Incorrect query (invalid synonym used)
stmt s1, s2; assign a1; print p1; read r1; while w1; if if1; procedure pr1;
Select a1 such that Follows*(pr1, _)
none
5000
61 - Incorrect query (invalid value)
stmt s1, s2; assign a1; print p1; read r1; while w1; if if1; procedure pr1;
Select a1 such that Follows*(0, _)
none
5000
62 - Incorrect query (invalid value)
stmt s1, s2; assign a1; print p1; read r1; while w1; if if1; procedure pr1;
Select a1 such that Parent*(-1, _)
none
5000
63 - Incorrect query (invalid synonym used)
stmt s1, s2; assign a1; variable v;
Select a1 such that Follows*(1, v)
none
5000
64 - Negative number (invalid)
variable v1;
Select v1 such that Uses(-1, v1)
none
5000
65 - Negative number (invalid)
variable v1;
Select v1 such that Modifies(-1, v1)
none
5000
66 - ParentT with double wildcards (valid)
while w;
Select w such that Parent*(_, _)
7
5000
67 - FollowsT with double wildcards (valid)
while w;
Select w such that Follows*(_, _)
7
5000
```
-------
## Source-Query pair 2
### Testing target:
- Enforce that single clause queries from iter 1 works with multiple procedures
### SOURCE: iter2-test1.txt
```javascript=
procedure First {
read x;
read z;
call Second;
}
procedure Second {
x = 0;
i = 5;
while (i != 0) {
x = x + 2 * y;
call Third;
i = i - 1;
}
if (x == 1) then {
x = x + 1;
} else {
z = 1;
}
z = z + x + i;
y = z + 2;
x = x * y + z;
}
procedure Third {
z = 5;
v = z;
print v;
}
```
```
procedure First {
1. read x;
2. read z;
3. call Second;
}
procedure Second {
4. x = 0;
5. i = 5;
6. while (i != 0) {
7. x = x + 2 * y;
8. call Third;
9. i = i - 1;
}
10. if (x == 1) then {
11. x = x+1;
} else {
12. z = 1;
}
13. z = z + x + i;
14. y = z + 2;
15. x = x * y + z;
}
procedure Third {
16. z = 5;
17. v = z;
18. print v;
}
```
### QUERIES: iter2-test1.txt
note: outputs need to be updated.
```javascript=
1 - Double synonym (valid)
stmt s1; variable v1;
Select s1 such that Uses(s1, v1)
3, 6, 7, 8, 9, 10, 11, 13, 14, 15, 17, 18
5000
2 - Double synonym (valid)
stmt s1; variable v1;
Select s1 such that Modifies(s1, v1)
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17
5000
3 - One synonym, one wildcard (valid)
assign a1;
Select a1 such that Uses(a1, _)
7, 9, 11, 13, 14, 15, 17
5000
4 - One synonym, one wildcard (valid)
assign a1;
Select a1 such that Modifies(a1, _)
4, 5, 7, 9, 11, 12, 13, 14, 15, 16, 17
5000
5 - One synonym, one exact match (valid)
print p1;
Select p1 such that Uses(p1, "x")
none
5000
6 - One synonym, one exact match (valid)
print p1;
Select p1 such that Modifies(p1, "x")
none
5000
7 - Double synonym (valid)
read r1; variable v1;
Select r1 such that Uses(r1, v1)
none
5000
8 - Double synonym (valid)
read r1; variable v1;
Select r1 such that Modifies(r1, v1)
1, 2
5000
9 - Double synonym (valid)
while w1; variable v1;
Select w1 such that Uses(w1, v1)
6
5000
10 - Double synonym (valid)
while w1; variable v1;
Select w1 such that Modifies(w1, v1)
6
5000
11 - Double synonym (valid)
if if1; variable v1;
Select if1 such that Uses(if1, v1)
10
5000
12 - Double synonym (valid)
if if1; variable v1;
Select if1 such that Modifies(if1, v1)
10
5000
13 - Zero (valid)
variable v1;
Select v1 such that Uses(0, v1)
none
5000
14 - Zero (valid)
variable v1;
Select v1 such that Modifies(0, v1)
none
5000
15 - Invalid second argument (invalid)
stmt s1; procedure pr1;
Select s1 such that Uses(s1, pr1)
none
5000
16 - Invalid second argument (invalid)
stmt s1; procedure pr1;
Select s1 such that Modifies(s1, pr1)
none
5000
17 - Invalid second argument (integer string) (invalid)
stmt s1;
Select s1 such that Uses(s1, "9")
none
5000
18 - Invalid second argument (integer string) (invalid)
stmt s1;
Select s1 such that Modifies(s1, "9")
none
5000
19 - Invalid second argument (empty string) (invalid)
stmt s1;
Select s1 such that Uses(s1, "")
none
5000
20 - Invalid second argument (empty string) (invalid)
stmt s1;
Select s1 such that Modifies(s1, "")
none
5000
21 - Invalid second argument (unknown variable) (invalid)
stmt s1;
Select s1 such that Uses(s1, "invalid")
none
5000
22 - Invalid second argument (unknown variable) (invalid)
stmt s1;
Select s1 such that Modifies(s1, "invalid")
none
5000
23 - Negative number (invalid)
variable v1;
Select v1 such that Uses(-1, v1)
none
5000
24 - Negative number (invalid)
variable v1;
Select v1 such that Modifies(-1, v1)
none
5000
```
-------
## Source-Query pair 3
### Testing target:
- Enforce new additions of such that and pattern single clause queries
### SOURCE: iter2-test2.txt
```javascript=
procedure First {
read x;
read z;
call Second;
}
procedure Second {
x = 0;
i = 5;
while (i != 0) {
x = x + 2 * y;
call Third;
i = i - 1;
}
if (x == 1) then {
x = x+1;
} else {
z = 1;
}
z = z + x + i;
y = z + 2;
x = x * y + z;
}
procedure Third {
z = 5;
v = z;
print v;
}
```
```
procedure First {
1. read x;
2. read z;
3. call Second;
}
procedure Second {
4. x = 0;
5. i = 5;
6. while (i != 0) {
7. x = x + 2 * y;
8. call Third;
9. i = i - 1;
}
10. if (x == 1) then {
11. x = x+1;
} else {
12. z = 1;
}
13. z = z + x + i;
14. y = z + 2;
15. x = x * y + z;
}
procedure Third {
16. z = 5;
17. v = z;
18. print v;
}
```

### QUERIES: iter2-test2.txt
```javascript=
1 - Self call syntax error
stmt s1; assign a1; call c1; procedure pr1, pr2; prog_line pl;
Select pr1 such that Calls(pr1, pr1)
none
5000
2 - Normal Call with first var returned
stmt s1; assign a1; call c1; procedure pr1, pr2;
Select pr1 such that Calls(pr1, pr2)
First, Second
5000
3 - Invalid call with assign in first var
stmt s1; assign a1; call c1; procedure pr1, pr2;
Select pr1 such that Calls(a1, pr1)
none
5000
4 - Invalid call with call stmt in first var
stmt s1; assign a1; call c1; procedure pr1, pr2;
Select pr1 such that Calls(c1, pr1)
none
5000
5 - Invalid call with pl not defined
stmt s1; assign a1; call c1; procedure pr1, pr2;
Select pr1 such that Calls(pr1, pl)
none
5000
6 - Double wildcard Call
stmt s1; assign a1; call c1; procedure pr1, pr2;
Select pr1 such that Calls(_, _)
First, Second, Third
5000
7 - Left wildcard, right syn call
stmt s1; assign a1; call c1; procedure pr1, pr2;
Select pr1 such that Calls(_, pr1)
Second, Third
5000
8 - Left syn, right wildcard call
stmt s1; assign a1; call c1; procedure pr1, pr2;
Select pr1 such that Calls(pr1, _)
First, Second
5000
9 - Left syn, right IDENT call
stmt s1; assign a1; call c1; procedure pr1, pr2;
Select pr1 such that Calls(pr1, "Third")
Second
5000
10 - Left IDENT, right syn call
stmt s1; assign a1; call c1; procedure pr1, pr2;
Select pr1 such that Calls("Second", pr2)
First, Second, Third
5000
11 - Left, Right IDENT call
stmt s1; assign a1; call c1; procedure pr1, pr2;
Select pr1 such that Calls("First", "Second")
First, Second, Third
5000
12 - Left syn, right IDENT non matching proc call
stmt s1; assign a1; call c1; procedure pr1, pr2;
Select pr1 such that Calls(pr1, "9")
none
5000
13 - Left syn, right invalid IDENT
stmt s1; assign a1; call c1; procedure pr1, pr2;
Select pr1 such that Calls(pr1, "")
none
5000
14 - Left syn, right IDENT, BOOLEAN call
stmt s1; assign a1; call c1; procedure pr1, pr2;
Select pr1 such that Calls(pr2, "NotAProg")
none
5000
15 - Left IDENT, right wildcard call
stmt s1; assign a1; call c1; procedure pr1, pr2;
Select pr1 such that Calls("Second", _)
First, Second, Third
5000
16 - Left wildcard, Right IDENT call for no incoming proc
stmt s1; assign a1; call c1; procedure pr1, pr2;
Select pr1 such that Calls(_, "First")
none
5000
17 - Self call syntax error
stmt s1; assign a1; call c1; procedure pr1, pr2; prog_line pl;
Select pr1 such that Calls*(pr1, pr1)
none
5000
18 - Left, Right syn callT
stmt s1; assign a1; call c1; procedure pr1, pr2;
Select pr1 such that Calls*(pr1, pr2)
First, Second
5000
19 - Left invalid arg callT
stmt s1; assign a1; call c1; procedure pr1, pr2;
Select pr1 such that Calls*(a1, pr1)
none
5000
20 - Left invalid arg callT
stmt s1; assign a1; call c1; procedure pr1, pr2;
Select pr2 such that Calls*(c1, pr1)
none
5000
21 - Right non declared var
stmt s1; assign a1; call c1; procedure pr1, pr2;
Select pr1 such that Calls*(pr1, pl)
none
5000
22 - Double wildcard callT, BOOLEAN,
stmt s1; assign a1; call c1; procedure pr1, pr2;
Select pr1 such that Calls*(_, _)
First, Second, Third
5000
23 - Left wildcard, Right syn, callT
stmt s1; assign a1; call c1; procedure pr1, pr2;
Select pr1 such that Calls*(_, pr1)
Second, Third
5000
24 - Left syn, Right wildcard, callT
stmt s1; assign a1; call c1; procedure pr1, pr2;
Select pr1 such that Calls*(pr1, _)
First, Second
5000
25 - Left syn, Right IDENT, callT
stmt s1; assign a1; call c1; procedure pr1, pr2;
Select pr1 such that Calls*(pr1, "Third")
First, Second
5000
26 - Left IDENT, right syn, callT, BOOLEAN
stmt s1; assign a1; call c1; procedure pr1, pr2;
Select pr1 such that Calls*("Second", pr2)
First, Second, Third
5000
27 - Left, Right IDENT callT, BOOLEAN
stmt s1; assign a1; call c1; procedure pr1, pr2;
Select pr1 such that Calls*("First", "Third")
First, Second, Third
5000
28 - Left syn, Right IDENT no proc callT
stmt s1; assign a1; call c1; procedure pr1, pr2;
Select pr1 such that Calls*(pr1, "9")
none
5000
29 - Left syn, Right IDENT empty INVALID
stmt s1; assign a1; call c1; procedure pr1, pr2;
Select pr1 such that Calls*(pr1, "")
none
5000
30 - Left syn, Right IDENT no proc callT
stmt s1; assign a1; call c1; procedure pr1, pr2;
Select pr2 such that Calls*(pr1, "NotAProg")
none
5000
31 - Left IDENT, right wildcard, callT, BOOLEAN
stmt s1; assign a1; call c1; procedure pr1, pr2;
Select pr1 such that Calls*("First", _)
First, Second, Third
5000
32 - Left wildcard, Right IDENT, callT, BOOLEAN
stmt s1; assign a1; call c1; procedure pr1, pr2;
Select pr1 such that Calls*(_, "Third")
First, Second, Third
5000
33 - Self CFG Next not possible
stmt s1,s2; assign a1,a2; read r1,r2; print p1,p2; procedure proc1,proc2; call c1,c2; while w1,w2; if if1,if2; prog_line n1, n2;
Select s1 such that Next(s1, s1)
none
5000
34 - CFG Next from stmt syn to assign syn
stmt s1,s2; assign a1,a2; read r1,r2; print p1,p2; procedure proc1,proc2; call c1,c2; while w1,w2; if if1,if2; prog_line n1, n2;
Select s1 such that Next(s1, a1)
4,6,8,10,11,12,13,14,16
5000
35 - CFG Next from assign syn to stmt syn
stmt s1,s2; assign a1,a2; read r1,r2; print p1,p2; procedure proc1,proc2; call c1,c2; while w1,w2; if if1,if2; prog_line n1, n2;
Select s1 such that Next(a1, s1)
5,6,8,13,14,15,17,18
5000
36 - CFG Next from assign syn to assign syn (self), BOOLEAN
stmt s1,s2; assign a1,a2; read r1,r2; print p1,p2; procedure proc1,proc2; call c1,c2; while w1,w2; if if1,if2; prog_line n1, n2;
Select s1 such that Next(a1, a1)
none
5000
37 - CFG Next from assign syn to assign syn (other), BOOLEAN
stmt s1,s2; assign a1,a2; read r1,r2; print p1,p2; procedure proc1,proc2; call c1,c2; while w1,w2; if if1,if2; prog_line n1, n2;
Select s1 such that Next(a1, a2)
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18
5000
38 - CFG Next stmt syn to read syn
stmt s1,s2; assign a1,a2; read r1,r2; print p1,p2; procedure proc1,proc2; call c1,c2; while w1,w2; if if1,if2; prog_line n1, n2;
Select s1 such that Next(s1, r1)
1
5000
39 - CFG Next stmt syn to print syn
stmt s1,s2; assign a1,a2; read r1,r2; print p1,p2; procedure proc1,proc2; call c1,c2; while w1,w2; if if1,if2; prog_line n1, n2;
Select s1 such that Next(s1, p1)
17
5000
40 - CFG Next stmt syn to proc syn
stmt s1,s2; assign a1,a2; read r1,r2; print p1,p2; procedure proc1,proc2; call c1,c2; while w1,w2; if if1,if2; prog_line n1, n2;
Select s1 such that Next(s1, proc1)
none
5000
41 - CFG Next stmt syn to call syn
stmt s1,s2; assign a1,a2; read r1,r2; print p1,p2; procedure proc1,proc2; call c1,c2; while w1,w2; if if1,if2; prog_line n1, n2;
Select s1 such that Next(s1, c1)
2,7
5000
42 - CFG Next stmt syn to while syn
stmt s1,s2; assign a1,a2; read r1,r2; print p1,p2; procedure proc1,proc2; call c1,c2; while w1,w2; if if1,if2; prog_line n1, n2;
Select s1 such that Next(s1, w1)
5,9
5000
43 - CFG Next stmt syn to if syn
stmt s1,s2; assign a1,a2; read r1,r2; print p1,p2; procedure proc1,proc2; call c1,c2; while w1,w2; if if1,if2; prog_line n1, n2;
Select s1 such that Next(s1, if1)
6
5000
44 - CFG Next stmt syn to prog_line syn
stmt s1,s2; assign a1,a2; read r1,r2; print p1,p2; procedure proc1,proc2; call c1,c2; while w1,w2; if if1,if2; prog_line n1, n2;
Select s1 such that Next(s1, n1)
1,2,4,5,6,7,8,9,10,11,12,13,14,16,17
5000
45 - CFG Next proc syn not valid to stmt syn
stmt s1,s2; assign a1,a2; read r1,r2; print p1,p2; procedure proc1,proc2; call c1,c2; while w1,w2; if if1,if2; prog_line n1, n2;
Select s1 such that Next(proc1, s1)
none
5000
46 - CFG Next assign syn to read syn
stmt s1,s2; assign a1,a2; read r1,r2; print p1,p2; procedure proc1,proc2; call c1,c2; while w1,w2; if if1,if2; prog_line n1, n2;
Select s1 such that Next(a1, r1)
none
5000
47 - CFG Next read syn to proc syn invalid
stmt s1,s2; assign a1,a2; read r1,r2; print p1,p2; procedure proc1,proc2; call c1,c2; while w1,w2; if if1,if2; prog_line n1, n2;
Select s1 such that Next(r1, proc1)
none
5000
48 - CFG Next left wildcard to stmt syn
stmt s1,s2; assign a1,a2; read r1,r2; print p1,p2; procedure proc1,proc2; call c1,c2; while w1,w2; if if1,if2; prog_line n1, n2;
Select s1 such that Next(_, s1)
2,3,5,6,7,8,9,10,11,12,13,14,15,17,18
5000
49 - CFG Next Double wildcard, BOOLEAN
stmt s1,s2; assign a1,a2; read r1,r2; print p1,p2; procedure proc1,proc2; call c1,c2; while w1,w2; if if1,if2; prog_line n1, n2;
Select s1 such that Next(_, _)
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18
5000
50 - CFG Next Left stmt syn to Right wildcard
stmt s1,s2; assign a1,a2; read r1,r2; print p1,p2; procedure proc1,proc2; call c1,c2; while w1,w2; if if1,if2; prog_line n1, n2;
Select s1 such that Next(s1, _)
1,2,4,5,6,7,8,9,10,11,12,13,14,16,17
5000
51 - CFG Next Left stmt syn to right INVALID IDENT
stmt s1,s2; assign a1,a2; read r1,r2; print p1,p2; procedure proc1,proc2; call c1,c2; while w1,w2; if if1,if2; prog_line n1, n2;
Select s1 such that Next(s1, -1)
none
5000
52 - CFG Next Left stmt syn to right INVALID IDENT
stmt s1,s2; assign a1,a2; read r1,r2; print p1,p2; procedure proc1,proc2; call c1,c2; while w1,w2; if if1,if2; prog_line n1, n2;
Select s1 such that Next(s1, 0)
none
5000
53 - CFG Next Left IDENT to right stmt syn, no output
stmt s1,s2; assign a1,a2; read r1,r2; print p1,p2; procedure proc1,proc2; call c1,c2; while w1,w2; if if1,if2; prog_line n1, n2;
Select s1 such that Next(3, s1)
none
5000
54 - CFG Next Left IDENT to right stmt syn, have output
stmt s1,s2; assign a1,a2; read r1,r2; print p1,p2; procedure proc1,proc2; call c1,c2; while w1,w2; if if1,if2; prog_line n1, n2;
Select s1 such that Next(1, s1)
2
5000
55 - CFG Next Left IDENT to right IDENT, no output
stmt s1,s2; assign a1,a2; read r1,r2; print p1,p2; procedure proc1,proc2; call c1,c2; while w1,w2; if if1,if2; prog_line n1, n2;
Select s1 such that Next(3, 7)
none
5000
56 - CFG Next Left IDENT to right IDENT, while output
stmt s1,s2; assign a1,a2; read r1,r2; print p1,p2; procedure proc1,proc2; call c1,c2; while w1,w2; if if1,if2; prog_line n1, n2;
Select s1 such that Next(9,6)
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18
5000
57 - Next clause as BOOLEAN (true)
stmt s1,s2; assign a1,a2; read r1,r2; print p1,p2; procedure proc1,proc2; call c1,c2; while w1,w2; if if1,if2; prog_line n1, n2;
Select s1 such that Next(n1, n2)
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18
5000
58 - Valid Next clause progline after statement returns all statments except last statements for each procedure
stmt s1,s2; assign a1,a2; read r1,r2; print p1,p2; procedure proc1,proc2; call c1,c2; while w1,w2; if if1,if2; prog_line n1, n2;
Select s1 such that Next(s1, n1)
1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16, 17
5000
59 - Next as BOOLEAN (false), Wildcard for next of last statement in a procedure
stmt s1,s2; assign a1,a2; read r1,r2; print p1,p2; procedure proc1,proc2; call c1,c2; while w1,w2; if if1,if2; prog_line n1, n2;
Select s1 such that Next(3, _)
none
5000
60 - Valid Next as BOOLEAN (false), wildcard before first statement in a procedure
stmt s1,s2; assign a1,a2; read r1,r2; print p1,p2; procedure proc1,proc2; call c1,c2; while w1,w2; if if1,if2; prog_line n1, n2;
Select s1 such that Next(_, 4)
none
5000
61 - While statement with variable passed as control variable, valid input
stmt s1; while w1; variable v1; procedure pr1; prog_line pl;
Select pr1 pattern w1(v1, _)
First,Second,Third
5000
62 - While pattern with statement passed as control variable returns none
stmt s1; while w1; variable v1; procedure pr1; prog_line pl;
Select pr1 pattern w1(s1, _)
none
5000
63 - Select while statement with proc name being passed as a variable name returns none
stmt s1; while w1; variable v1; procedure pr1; prog_line pl;
Select pr1 pattern w1(pr1, _)
none
5000
64 - Select while statement with control const being a valid prog_line
stmt s1; while w1; variable v1; procedure pr1; prog_line pl;
Select pr1 pattern w1(pl, _)
none
5000
65 - While pattern wildcard, return BOOLEAN procedure
stmt s1; while w1; variable v1; procedure pr1; prog_line pl;
Select pr1 pattern w1(_, _)
First,Second,Third
5000
66 - While pattern empty entRef returns none
stmt s1; while w1; variable v1; procedure pr1; prog_line pl;
Select pr1 pattern w1("", _)
none
5000
67 - While pattern non existing control constant returns none
stmt s1; while w1; variable v1; procedure pr1; prog_line pl;
Select pr1 pattern w1("9", _)
none
5000
68 - While pattern non existing control variable returns none
stmt s1; while w1; variable v1; procedure pr1; prog_line pl;
Select pr1 pattern w1("x", _)
none
5000
69 - While pattern, non-existing control variable input returns none
stmt s1; while w1; variable v1; procedure pr1; prog_line pl;
Select pr1 pattern w1("NoSuchVar", _)
none
5000
70 - If pattern, existing variable as control variable
stmt s1; if if1; variable v1; procedure pr1; prog_line pl;
Select if1 pattern if1(v1, _, _)
10
5000
71 - If pattern, statement as input to entRef returns none
stmt s1; if if1; variable v1; procedure pr1; prog_line pl;
Select if1 pattern if1(s1, _, _)
none
5000
72 - If pattern procedure as control variable returns none
stmt s1; if if1; variable v1; procedure pr1; prog_line pl;
Select if1 pattern if1(pr1, _, _)
none
5000
73 - If pattern, prog line as the control const, INVALID first arg
stmt s1; if if1; variable v1; procedure pr1; prog_line pl;
Select if1 pattern if1(pl, _, _)
none
5000
74 - If pattern wildcard control variable returns all valid
stmt s1; if if1; variable v1; procedure pr1; prog_line pl;
Select if1 pattern if1(_, _, _)
10
5000
75 - If Pattern empty IDENT returns none
stmt s1; if if1; variable v1; procedure pr1; prog_line pl;
Select if1 pattern if1("", _, _)
none
5000
76 - If pattern searching for non-existing IDENT returns none
stmt s1; if if1; variable v1; procedure pr1; prog_line pl;
Select if1 pattern if1("9", _, _)
none
5000
77 - If pattern check existing pattern variable
stmt s1; if if1; variable v1; procedure pr1; prog_line pl;
Select if1 pattern if1("x", _, _)
10
5000
78 - If pattern checking for non-existent control variable
stmt s1; if if1; variable v1; procedure pr1; prog_line pl;
Select if1 pattern if1("NoSuchVar", _, _)
none
5000
```
-------
## Source-Query pair 4
### Testing target:
- Enforce the tuple and boolean queries (with single clause and without attributes)
### SOURCE: iter2-test3.txt
```javascript=
procedure First {
read x;
read z;
call Second;
}
procedure Second {
x = 0;
i = 5;
while (i != 0) {
x = x + 2 * y;
call Third;
i = i - 1;
}
if (x == 1) then {
x = x+1;
} else {
z = 1;
}
z = z + x + i;
y = z + 2;
x = x * y + z;
}
procedure Third {
z = 5;
v = z;
print v;
}
```
### QUERIES: iter2-test3.txt
```javascript=
1 - Select BOOLEAN with pattern checking for nonexistent while
stmt s1; while w1; variable v1; procedure pr1; prog_line pl;
Select BOOLEAN pattern w1("NoSuchVar", _)
FALSE
5000
2 - Select BOOLEAN with nonexistent wildcard
stmt s1; while w1; variable v1; procedure pr1; prog_line pl;
Select BOOLEAN such that Follows(_, 1)
FALSE
5000
3 - Select BOOLEAN with true wildcard clause
stmt s1; while w1; variable v1; procedure pr1; prog_line pl;
Select BOOLEAN such that Follows(_, _)
TRUE
5000
4 - Select BOOLEAN with true clause
stmt s1; while w1; variable v1; procedure pr1; prog_line pl;
Select BOOLEAN such that Follows*(s1, w1)
TRUE
5000
5 - Select tuple with boolean clause
stmt s1; while w1; variable v1; procedure pr1; prog_line pl;
Select <w1> such that Follows(_, _)
6
5000
6 - Incorrect tuple since theres no a1 declared
stmt s1; while w1; variable v1; procedure pr1; prog_line pl;
Select <s1, a1> such that Follows(_, 1)
none
5000
7 - Select tuple with false boolean clause
stmt s1; while w1; variable v1; procedure pr1; prog_line pl;
Select <s1, w1> such that Follows(_, 1)
none
5000
8 - Select tuple with false boolean clause
stmt s1; while w1; variable v1; procedure pr1; prog_line pl;
Select <w1, pr1> such that Follows(w1, 1)
none
5000
9 - Select tuple (1) with target synonym in clause
stmt s1; while w1; variable v1; procedure pr1; prog_line pl;
Select <w1, s1> such that Follows(s1, 2)
6 1
5000
10 - Select tuple (1) with target synonym in clause
stmt s1; while w1; variable v1; procedure pr1; prog_line pl;
Select <s1, w1> such that Follows(s1, 2)
1 6
5000
11 - Select tuple (multiple) with target synonym in clause
stmt s1; while w1; variable v1; procedure pr1; prog_line pl;
Select <s1, v1> such that Follows(s1, 2)
1 x, 1 z, 1 i, 1 y, 1 v
5000
12 - Select tuple with repeated synonym with target synonym not in clause
stmt s1; while w1; variable v1; procedure pr1; prog_line pl;
Select <w1, w1> such that Follows(s1, 2)
6 6
5000
```
-------
# MULTIPLE CLAUSE TEST FROM HERE ONWARDS
-------
## Source-Query pair M1
### Testing target:
- Multi cl of same type: Such that + and, Pattern + and (no tuples, or BOOLEAN target synonym)
- Independent, All dependent vs mix of common synonyms in multi-cl queries
### SOURCE: iter2-test4.txt
```javascript=
procedure First {
read x;
read z;
call Second;
}
procedure Second {
x = 0;
i = 5;
while (i != 0) {
x = x + 2 * y;
call Third;
i = i - 1;
}
if (x == 1) then {
x = x+1;
} else {
z = 1;
}
z = z + x + i;
y = z + 2;
x = x * y + z;
}
procedure Third {
z = 5;
v = z;
print v;
}
```
### QUERIES: iter2-test4.txt
```javascript=
Queries containing any number of:
Follows + Follows (no common synonym)
Follows + Follows (has 1 or more common synonym)
.
.
.
Follows + Follows*
Parent + Parent
Parent + Parent*
Uses + Uses
Modifies + Modifies
Calls + Calls
Calls + Calls*
Next + Next
Follows + Parent
Follows + Uses
Follows + Modifies
Follows + Calls
Follows + Next
Parent + Uses
Parent + Modifies
Parent + Calls
Parent + Next
Uses + Modifies
Uses + Calls
Uses + Next
Modifies + Calls
Modifies + Next
Calls + Next
ass-pattern + ass-pattern
ass-pattern + if-pattern
ass-pattern + while-pattern
if-pattern + if-pattern
if-pattern + while-pattern
while-pattern + while-pattern
```
## Source-Query pair M2
### Testing target:
- Query with at least 2 double syn clause AND both syn are the same.
- E.g Select a1 such that Uses(a1, v1) pattern a1(v1, _"x"_) ... can add more if you want
- [x] such that only
- [x] pattern only
- [x] such that and pattern
- [x] add some extra stuff
### SOURCE: iter2-test5.txt
```javascript=
procedure First {
read x;
read z;
call Second;
}
procedure Second {
x = 0;
i = 5;
while (i != 0) {
x = x + 2 * y;
call Third;
i = i - 1;
}
if (x == 1) then {
x = x+1;
} else {
z = 1;
}
z = z + x + i;
y = z + 2;
x = x * y + z;
}
procedure Third {
z = 5;
v = z;
print v;
}
```
```javascript=
procedure First {
1. read x;
2. read z;
3. call Second;
}
procedure Second {
4. x = 0;
5. i = 5;
6. while (i != 0) {
7. x = x + 2 * y;
8. call Third;
9. i = i - 1;
}
10. if (x == 1) then {
11. x = x+1;
} else {
12. z = 1;
}
13. z = z + x + i;
14. y = z + 2;
15. x = x * y + z;
}
procedure Third {
16. z = 5;
17. v = z;
18. print v;
}
```

### QUERIES: iter2-test5.txt
```javascript=
1 - Only such that clause, valid result
stmt s1; assign a1; variable v1; procedure pr1; prog_line pl;
Select s1 such that Follows(s1, a1) and Follows*(s1, a1) and Follows(s1, a1)
4,8,10, 13, 14, 16
5000
2 - Only such that clause, invalid result
stmt s1; assign a1; variable v1; procedure pr1; prog_line pl;
Select a1 such that Follows(s1, a1) and Follows*(a1, s1) and Follows(s1, a1)
none
5000
3 - Only such that clause, variable appears to the left and right of assignment operator
stmt s1; while w1; variable v1; procedure pr1; prog_line pl;
Select s1 such that Uses(s1, v1) and Modifies(s1, v1)
3, 6, 7, 8, 9,10, 11, 13, 15
5000
4 - Only such that clause, variable appears to the left and right of assignment operator
stmt s1; while w1; variable v1; procedure pr1; prog_line pl;
Select v1 such that Modifies(s1, v1) and Uses(s1, v1)
x, i, z, v, y
5000
5 - Only Pattern clause, valid
stmt s1; assign a1; variable v1; procedure pr1; prog_line pl;
Select a1 pattern a1(v1, _) and a1(v1, _"i"_)
9, 13
5000
6 - Only Pattern clause, invalid because multiple exact matches
stmt s1; assign a1; variable v1; procedure pr1; prog_line pl;
Select a1 pattern a1(v1, "x") and a1(v1, "i")
none
5000
7 - Only Pattern clause, valid because multiple partial matches
stmt s1; assign a1; variable v1; procedure pr1; prog_line pl;
Select a1 pattern a1(v1, "x") and a1(v1, "i")
none
5000
8 - select while cluase, duplicated select
stmt s1; while w1; variable v1; procedure pr1; prog_line pl;
Select w1 pattern w1(v1, _) and w1(v1, _)
6
5000
9 - select if clause, same control variable duplicated
stmt s1; if if1; variable v1; procedure pr1; prog_line pl;
Select if1 pattern if1(v1, _, _) pattern if1(v1, _, _)
10
5000
10 - Mix uses and ass pattern
stmt s1; assign a1; if if1; variable v1; procedure pr1; prog_line pl;
Select a1 such that Uses(a1, v1) pattern a1(v1, _"i"_)
9, 13
5000
11 - Mix: pattern and modifies
stmt s1; assign a1; if if1; variable v1; procedure pr1;
Select a1 pattern a1(v1, _"i"_) such that Modifies(a1, v1) pattern a1(v1, _"i"_)
9, 13
5000
12 - Mix while and uses as boolean, returns all assignments
stmt s1; assign a1; while w1; if if1; variable v1; procedure pr1; prog_line pl;
Select a1 pattern w1(v1, _) such that Uses(w1, v1)
4,5,7,9,11,12,13,14,15,16,17
5000
13 - Mix with non double present
stmt s1; assign a1, if if1; variable v1; procedure pr1; prog_line pl;
Select a1 such that Uses(a1, v1) pattern a1(v1, _"i"_) and pattern if1(v1, _, _)
none
5000
```
## Source-Query pair M3
### Testing target:
- Query with at least 3 chained clause
- E.g Select a1 such that Uses(a1, v1) pattern a2(v1, _"x"_) Follows(p1, a2)
- Query with at least 2 chained (clause with 2 syn) and at least 1 chained (clause with 1 syn)
- E.g Select a1 such that Uses(a1, v1) and Follows(a1, s1) pattern a1("var", _"x"_)
### SOURCE: iter2-test6.txt

```javascript=
procedure First {
read x; //1
read z; //2
call Second; //3
}
procedure Second {
print x; //4
if (x == 1) then { //5
x = x+1; //6
} else {
if (i != 0) then { //7
x = x + z * y; //8
} else {
z = 8; //9
}
} //reason: Next(6,10),(8,10),(9,10),(13,10) holds
while (i != 0) { //10
x = x + 2 * y; //11
i = i - 1; //12
call Third; //13 - ensure call links to while
}
read y; //14
x = x * y + z; //15
}
procedure Third {
z = 5; //16
v = z; //17
print v; //18
}
```
### QUERIES: iter2-test6.txt
```javascript=
1 - Only such that clause, invalid result
stmt s1; assign a1, a2; variable v1; procedure pr1; prog_line pl; while w1;
Select s2 such that Next(s1, w1) such that Modifies(a2, s1) such that Uses(s2, a2)
none
5000
1 - Only such that clause, valid result
stmt s1; assign a1, a2; variable v1; procedure pr1; prog_line pl;
Select s1 such that Modifies(s1, v1) such that Parent*(s1, a2) such that Uses(a2, v1)
5, 7, 10
5000
1 - Only such that clause, valid result
stmt s1; assign a1, a2; variable v1; procedure pr1; prog_line pl;
Select s1 such that Modifies(s1, v1) such that Parent*(s1, a2) such that Uses(a2, v1) pattern a2(v1, _"i"_)
10
5000
1 - Only such that clause, valid result, with circular relation
stmt s1; assign a1, a2; variable v1; procedure pr1; prog_line pl;
Select s1 such that Uses(s1, v1) and Parent*(s1, a2) and Modifies(a2, v1)
5, 7, 10
5000
1 - Only such that clause, valid result, with circular relation
stmt s1, s2; assign a1, a2; variable v1; procedure pr1; prog_line pl;
Select s1 such that Uses(s1, v1) and Parent*(s1, s2) and Modifies(a2, v1) and Follows(s2, a2)
10
5000
1 - Only pattern clause, valid result
stmt s1; assign a1, a2; variable v1; procedure pr1; while w1; if if1;
Select a2 pattern a2(v1, _) and a1(v1, _"i"_) pattern if1(v1, _, _)
12
5000
1 - Only pattern clause, invalid result
stmt s1; assign a1, a2; variable v1; procedure pr1; while w1; if if1;
Select s1 pattern a1(v1, _"z"_) pattern if1(v1, _, _) pattern w1(v1, _)
none
5000
1 - Mix, valid result, with circular relation
stmt s1; assign a1, a2; variable v1; procedure pr1; prog_line pl;
Select s1 pattern a1(v1, _"i"_) and a2(v1, _) such that Follows*(a1, a2)
none
5000
1 - Mix, valid result, with circular relation
assign a1, a2; variable v1, v2;
Select a1 pattern a1(v1, _) and a2(v2, _) such that Follows*(a1, a2)
11, 16
5000
1 - Mix, valid result, with circular relation
assign a1, a2; variable v1, v2;
Select a2 pattern a1(v1, _) and a2(v2, _) such that Follows*(a1, a2)
12, 17
5000
1 - Mix, valid result, with circular relation
assign a1, a2; variable v1, v2;
Select v1 pattern a1(v1, _) and a2(v2, _) such that Follows*(a1, a2)
x, z
5000
1 - Mix, valid result, with circular relation
assign a1, a2; variable v1, v2;
Select v2 pattern a1(v1, _) and a2(v2, _) such that Follows*(a1, a2)
i, v
5000
1 - Mix, valid result, with circular relation
stmt s1, s2; assign a1, a2; variable v1; procedure pr1; prog_line pl;
Select s2 such that Uses(s1, v1) such that Parent(s1, s2) such that Follows*(a1, s2) pattern a2(v1, _)
12, 13
5000
1 - Mix, valid result, with single synonym clause
stmt s1, s2; assign a1, a2; variable v1; procedure pr1; prog_line pl; while w1; if if1; call c1;
Select c1 such that Follows(if1, w1) pattern w1("i", _) such that Parent(w1, c1)
13
5000
1 - Mix, valid result, with single synonym clause
stmt s1, s2; assign a1, a2; variable v1; procedure pr1; prog_line pl;
Select s1 such that Follows(a1, s1) pattern a1(v1, _"y"_) pattern a1("x", _)
12
5000
1 - Mix, valid result, with single synonym clause
stmt s1, s2; assign a1, a2; variable v1; procedure pr1; prog_line pl;
Select s1 pattern a1(v1, _"y"_) such that Follows(a1, s1) pattern a1("x", _)
12
5000
1 - Mix, valid result, with single synonym clause
stmt s1, s2; assign a1, a2; variable v1; procedure pr1; prog_line pl;
Select s1 such that Follows(a1, s1) pattern a1(v1, _"y"_) and a1("x", _)
12
5000
1 - Mix, valid result, with single synonym clause
stmt s1, s2; assign a1, a2; variable v1; procedure pr1; prog_line pl;
Select s1 pattern a1(v1, _"y"_) and a1("x", _) such that Follows(a1, s1)
12
5000
1 - Mix, valid result, with single synonym clause
stmt s1, s2; assign a1, a2; variable v1; procedure pr1; prog_line pl;
Select s1 such that Parent(s1, s2) and Parent*(s1, 8) pattern a1(v1, _) pattern a1("x", _"x"_)
5, 7
5000
```
-------
## Source-Query pair M4
### Testing target:
- Query with chain with Pattern to be evaluated first, then such that [Note: this is a short case]
- Query with chain with such that evaluated first, then pattern [Note: this is a short case too]
- Query with alternate such that/pattern ^.
### SOURCE: iter2-test7.txt
```javascript=
procedure First {
read x;
read z;
call Second;
}
procedure Second {
x = 0;
i = 5;
while (i != 0) {
x = x + 2 * y;
call Third;
i = i - 1;
}
if (x == 1) then {
x = x+1;
} else {
z = 1;
}
z = z + x + i;
y = z + 2;
x = x * y + z;
}
procedure Third {
z = 5;
v = z;
print v;
}
```
### QUERIES: iter2-test7.txt
```javascript=
1 - Multiple chained such that + pattern clauses
stmt s1; assign a1; if if1; variable v1; procedure pr1, pr2; prog_line pl;
Select a1 such that Uses(a1, v1) and Calls(pr1, pr2) and Next (2, 3) and Modifies(pr1, v1) pattern a1(v1, _"2*y"_) pattern if1(v1, _, _) and a1(_, _) and a1("x", _"x"_) and if1(_,_,_)
7
5000
2 - Multiple chained pattern + such that clauses
stmt s1; assign a1; if if1; variable v1; procedure pr1, pr2; prog_line pl;
Select a1 pattern a1(v1, _"x * y"_) pattern if1(v1, _, _) and a1(_, _) and a1("x", _"z"_) and if1(_,_,_) such that Uses(a1, v1) and Calls(pr1, pr2) and Next (2, 3) and Modifies(pr1, v1)
15
5000
3 - Multiple chained interleaving such that + pattern clauses
stmt s1; assign a1; if if1; variable v1; procedure pr1, pr2; prog_line pl;
Select a1 such that Modifies(pr1, v1) pattern if1(v1, _, _) such that Uses(a1, v1) pattern a1(_, _) such that Calls(pr1, pr2) pattern if1(_,_,_) such that Next (2, 3) pattern a1("z", _"z"_)
13
5000
4 - Multiple chained interleaving pattern + such that clauses
stmt s1; assign a1; if if1; variable v1; procedure pr1, pr2; prog_line pl;
Select a1 pattern a1("z", _"z"_) such that Modifies(pr1, v1) pattern if1(v1, _, _) such that Uses(a1, v1)
13
5000
```
-------
## Source-Query pair M5
### Testing target:
- Random mix, but with tuple and BOOLEAN tests only.
### SOURCE: iter2-test8.txt
```javascript=
procedure First {
read x; //1
read z; //2
call Second; //3
}
procedure Second {
print x; //4
if (x == 1) then { //5
x = x+1; //6
} else {
if (i != 0) then { //7
x = x + z * y; //8
} else {
z = 8; //9
}
} //reason: Next(6,10),(8,10),(9,10),(13,10) holds
while (i != 0) { //10
x = x + 2 * y; //11
i = i - 1; //12
call Third; //13 - ensure call links to while
}
read y; //14
x = x * y + z; //15
}
procedure Third {
z = 5; //16
v = z; //17
print v; //18
}
```
### QUERIES: iter2-test8.txt
```javascript=
1 - Multiple chained such that + pattern clauses BOOLEAN target
stmt s1; assign a1; if if1; variable v1; procedure pr1, pr2; prog_line pl;
Select BOOLEAN such that Uses(a1, v1) and Calls(pr1, pr2) and Next (2, 3) and Modifies(pr1, v1) pattern a1(v1, _"i"_) pattern if1(v1, _, _) and a1(_, _) and if1(_,_,_)
TRUE
5000
2 - Multiple chained pattern + such that clauses BOOLEAN target
stmt s1; assign a1; if if1; variable v1; procedure pr1, pr2; prog_line pl;
Select BOOLEAN pattern a1(v1, _"i"_) pattern if1(v1, _, _) and a1(_, _) and if1(_,_,_) such that Uses(a1, v1) and Calls(pr1, pr2) and Next (2, 3) and Modifies(pr1, v1)
TRUE
5000
3 - Multiple chained interleaving such that + pattern clauses BOOLEAN target
stmt s1; assign a1; if if1; variable v1; procedure pr1, pr2; prog_line pl;
Select BOOLEAN such that Modifies(pr1, v1) pattern if1(v1, _, _) such that Uses(a1, v1) pattern a1(_, _) such that Calls(pr1, pr2) pattern if1(_,_,_) such that Next (2, 3)
TRUE
5000
4 - Multiple chained interleaving pattern + such that clauses BOOLEAN target
stmt s1; assign a1; if if1; variable v1; procedure pr1, pr2; prog_line pl;
Select BOOLEAN such that Modifies(pr1, v1) pattern if1(v1, _, _) such that Uses(a1, v1)
TRUE
5000
5 - Multiple chained such that + pattern clauses multiple common syn target
stmt s1; assign a1; if if1; variable v1; procedure pr1, pr2; prog_line pl;
Select <pr1> such that Uses(a1, v1) and Calls(pr1, pr2) and Next (2, 3) and Modifies(pr1, v1) pattern a1(v1, _"i"_) pattern if1(v1, _, _) and a1(_, _) and if1(_,_,_)
First, Second
5000
6 - Multiple chained such that + pattern clauses multiple common syn target
stmt s1; assign a1; if if1; variable v1; procedure pr1, pr2; prog_line pl;
Select <pr2> such that Uses(a1, v1) and Calls(pr1, pr2) and Next (2, 3) and Modifies(pr1, v1) pattern a1(v1, _"i"_) pattern if1(v1, _, _) and a1(_, _) and if1(_,_,_)
Second, Third
5000
7 - Multiple chained such that + pattern clauses multiple common syns target
stmt s1; assign a1; if if1; variable v1; procedure pr1, pr2; prog_line pl;
Select <pr1, pr2> such that Uses(a1, v1) and Calls(pr1, pr2) and Next (2, 3) and Modifies(pr1, v1) pattern a1(v1, _"i"_) pattern if1(v1, _, _) and a1(_, _) and if1(_,_,_)
First Second, First Third, Second Second, Second Third
5000
8 - Multiple chained such that + pattern clauses multiple common syns target
stmt s1; assign a1; if if1; variable v1; procedure pr1, pr2; prog_line pl;
Select <pr1, v1, pr2> such that Uses(a1, v1) and Calls(pr1, pr2) and Next (2, 3) and Modifies(pr1, v1) pattern a1(v1, _"i"_) pattern if1(v1, _, _) and a1(_, _) and if1(_,_,_)
First i Second, First i Third, Second i Second, Second i Third
5000
9 - Multiple chained pattern + such that clauses multiple common syns target
stmt s1; assign a1; if if1; variable v1; procedure pr1, pr2; prog_line pl;
Select <a1, v1, pr1> pattern a1(v1, _"i"_) pattern if1(v1, _, _) and a1(_, _) and if1(_,_,_) such that Uses(a1, v1) and Calls(pr1, pr2) and Next (2, 3) and Modifies(pr1, v1)
12 i Second, 12 i Third
5000
10 - Multiple chained pattern + such that clauses multiple common & uncommon syns target
stmt s1; assign a1; if if1; variable v1; procedure pr1, pr2; prog_line pl;
Select <a1, v1, pl> pattern a1(v1, _"i"_) pattern if1(v1, _, _) and a1(_, _) and if1(_,_,_) such that Uses(a1, v1) and Calls(pr1, pr2) and Next (2, 3) and Modifies(pr1, v1)
12 i 1, 12 i 2, 12 i 3, 12 i 4, 12 i 5, 12 i 6, 12 i 7, 12 i 8, 12 i 9, 12 i 10, 12 i 11, 12 i 12, 12 i 13, 12 i 14, 12 i 15, 12 i 16, 12 i 17, 12 i 18
5000
11 - Multiple chained interleaving such that + pattern clauses some duplicate syns target
stmt s1; assign a1; if if1; variable v1; procedure pr1, pr2; prog_line pl;
Select <a1, v1, v1> pattern a1(v1, _"i"_) pattern if1(v1, _, _) and a1(_, _) and if1(_,_,_) such that Uses(a1, v1) and Calls(pr1, pr2) and Next (2, 3) and Modifies(pr1, v1)
12 i i
5000
12 - Multiple chained interleaving such that + pattern clauses some repeating duplicate syns target
stmt s1; assign a1; if if1; variable v1; procedure pr1, pr2; prog_line pl;
Select <pr1, v1, pr1, v1> such that Uses(a1, v1) and Calls(pr1, pr2) and Next (2, 3) and Modifies(pr1, v1) pattern a1(v1, _"i"_) pattern if1(v1, _, _) and a1(_, _) and if1(_,_,_)
First i First i, Second i Second i
5000
13 - Multiple chained interleaving such that + pattern clauses one common syn target
stmt s1; assign a1; if if1; variable v1; procedure pr1, pr2; prog_line pl;
Select <v1> such that Uses(a1, v1) and Calls(pr1, pr2) and Next (2, 3) and Modifies(pr1, v1) pattern a1(v1, _"i"_) pattern if1(v1, _, _) and a1(_, _) and if1(_,_,_)
i
5000
14 - Multiple chained interleaving such that + pattern clauses one uncommon syn target
stmt s1; assign a1; if if1; variable v1; procedure pr1, pr2; prog_line pl;
Select <pr1> such that Uses(a1, v1) and Calls(pr1, pr2) and Next (2, 3) and Modifies(pr1, v1) pattern a1(v1, _"i"_) pattern if1(v1, _, _) and a1(_, _) and if1(_,_,_)
First Second
5000
15 - Multiple chained interleaving such that + pattern clauses one uncommon syn target
stmt s1; assign a1; if if1; variable v1; procedure pr1, pr2; prog_line pl;
Select <pl> such that Uses(a1, v1) and Calls(pr1, pr2) and Next (2, 3) and Modifies(pr1, v1) pattern a1(v1, _"i"_) pattern if1(v1, _, _) and a1(_, _) and if1(_,_,_)
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18
5000
```
Something weird i think of:
``` javascript=
procedure nestedIF {
if (x == 2) then { //1
if (y == 1) then { //2
if (.) then { //3
x = 1; //4
} else {
x = 2; //5
}
} else {
if (y == 2) then { //6
x = 2; //7
} else {
x = 1; //8
}
}
} else {
if (x == 1) then { //9
if (y == 1) then { //10
x = 2; //11
} else {
x = 1; //12
}
} else {
if (y == 2) then { //13
x = 2; //14
} else {
x = 1; //15
}
}
}
print LayersOf3Ifs; //16
}
```
1 - Multiple Next into print
print p; stmt s;
Select s such that Next(s, p);
4,5,7,8,11,12,14,15
5000