-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBugs.qll
More file actions
44 lines (37 loc) · 1.06 KB
/
Bugs.qll
File metadata and controls
44 lines (37 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
* Test data for LimitResultsTest.ql.
*
* Models a simple set of "bugs", each associated with a set of "fields".
*
* - BugA: 1 field (X) - fewer than maxResults
* - BugB: 3 fields (A, B, C) - exactly maxResults
* - BugC: 5 fields (A, B, C, D, E) - more than maxResults
*/
newtype TBug =
TBugA() or
TBugB() or
TBugC()
class Bug extends TBug {
string getName() {
this = TBugA() and result = "BugA"
or
this = TBugB() and result = "BugB"
or
this = TBugC() and result = "BugC"
}
string toString() { result = getName() }
}
newtype TBugField =
TBugFieldPair(string bugName, string fieldName) {
bugName = "BugA" and fieldName = "X"
or
bugName = "BugB" and fieldName = ["A", "B", "C"]
or
bugName = "BugC" and fieldName = ["A", "B", "C", "D", "E"]
}
class BugField extends TBugField {
string getBugName() { this = TBugFieldPair(result, _) }
string getFieldName() { this = TBugFieldPair(_, result) }
string toString() { result = getBugName() + "." + getFieldName() }
Bug getBug() { result.getName() = getBugName() }
}