Skip to content

Commit 49a87e1

Browse files
committed
C#: Add unsigned right shift operator test case.
1 parent 3073810 commit 49a87e1

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

csharp/ql/test/library-tests/csharp11/Operators.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,9 @@ public void M1()
1212
var z = -4;
1313
z >>>= 5;
1414
}
15+
}
16+
17+
public class MyOperatorClass
18+
{
19+
public static MyOperatorClass operator >>>(MyOperatorClass a, MyOperatorClass b) { return null; }
1520
}

csharp/ql/test/library-tests/csharp11/operators.expected

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ binarybitwise
44
| Operators.cs:13:9:13:16 | ... >>> ... | Operators.cs:13:9:13:9 | access to local variable z | Operators.cs:13:16:13:16 | 5 | >>> | UnsignedRightShiftExpr |
55
assignbitwise
66
| Operators.cs:13:9:13:16 | ... >>>= ... | Operators.cs:13:9:13:9 | access to local variable z | Operators.cs:13:16:13:16 | 5 | >>>= | AssignUnsighedRightShiftExpr |
7+
userdefined
8+
| Operators.cs:19:44:19:46 | >>> | op_UnsignedRightShift | UnsignedRightShiftOperator |

csharp/ql/test/library-tests/csharp11/operators.ql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,9 @@ query predicate assignbitwise(
1919
name = op.getOperator() and
2020
qlclass = op.getAPrimaryQlClass()
2121
}
22+
23+
query predicate userdefined(Operator op, string fname, string qlclass) {
24+
op.getFile().getStem() = "Operators" and
25+
fname = op.getFunctionName() and
26+
qlclass = op.getAPrimaryQlClass()
27+
}

0 commit comments

Comments
 (0)