Skip to content

Commit d06a877

Browse files
committed
C#: Introduce test cases and expected result for unsigned right shift.
1 parent 9eb7933 commit d06a877

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
public class MyClass
3+
{
4+
public void M1()
5+
{
6+
var x1 = 1;
7+
var x2 = x1 >>> 2;
8+
9+
var y1 = -2;
10+
var y2 = y1 >>> 3;
11+
12+
var z = -4;
13+
z >>>= 5;
14+
}
15+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
binarybitwise
2+
| Operators.cs:7:18:7:25 | ... >>> ... | Operators.cs:7:18:7:19 | access to local variable x1 | Operators.cs:7:25:7:25 | 2 | >>> | UnsignedRightShiftExpr |
3+
| Operators.cs:10:18:10:25 | ... >>> ... | Operators.cs:10:18:10:19 | access to local variable y1 | Operators.cs:10:25:10:25 | 3 | >>> | UnsignedRightShiftExpr |
4+
| 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 |
5+
assignbitwise
6+
| 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 |
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import csharp
2+
3+
query predicate binarybitwise(
4+
BinaryBitwiseOperation op, Expr left, Expr right, string name, string qlclass
5+
) {
6+
op.getFile().getStem() = "Operators" and
7+
left = op.getLeftOperand() and
8+
right = op.getRightOperand() and
9+
name = op.getOperator() and
10+
qlclass = op.getAPrimaryQlClass()
11+
}
12+
13+
query predicate assignbitwise(
14+
AssignBitwiseOperation op, Expr left, Expr right, string name, string qlclass
15+
) {
16+
op.getFile().getStem() = "Operators" and
17+
left = op.getLValue() and
18+
right = op.getRValue() and
19+
name = op.getOperator() and
20+
qlclass = op.getAPrimaryQlClass()
21+
}

0 commit comments

Comments
 (0)