Skip to content

Commit 202f7f0

Browse files
committed
C#: Update modulus analysis tests
1 parent f43d911 commit 202f7f0

File tree

2 files changed

+130
-137
lines changed

2 files changed

+130
-137
lines changed

csharp/ql/test/library-tests/dataflow/modulusanalysis/ModulusAnalysis.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class ModulusAnalysis
66
const int c1 = 42;
77
const int c2 = 43;
88

9-
void M(int i, bool cond, int x, int y, int[] arr, int otherSeven)
9+
void M(int i, bool cond1, bool cond2, bool cond3, int x, int y, int[] arr, int otherSeven)
1010
{
1111
var eq = i + 3;
1212

@@ -26,7 +26,7 @@ void M(int i, bool cond, int x, int y, int[] arr, int otherSeven)
2626
}
2727
}
2828

29-
var j = cond
29+
var j = cond1
3030
? i * 4 + 3
3131
: i * 8 + 7;
3232
System.Console.WriteLine(j); // congruent 3 mod 4
@@ -47,7 +47,7 @@ void M(int i, bool cond, int x, int y, int[] arr, int otherSeven)
4747
l = GetArray().Length * 4 - 11;
4848
System.Console.WriteLine(l); // congruent 1 mod 4
4949

50-
if (cond)
50+
if (cond2)
5151
{
5252
j = i * 4 + 3;
5353
}
@@ -57,7 +57,7 @@ void M(int i, bool cond, int x, int y, int[] arr, int otherSeven)
5757
}
5858
System.Console.WriteLine(j); // congruent 3 mod 4 (cond = true) or 7 mod 8 (cond = false)
5959

60-
if (cond)
60+
if (cond2)
6161
{
6262
System.Console.WriteLine(j); // congruent 3 mod 4
6363
}
@@ -76,6 +76,12 @@ void M(int i, bool cond, int x, int y, int[] arr, int otherSeven)
7676
{
7777
System.Console.WriteLine(x); // congruent 3 mod 16
7878
}
79+
80+
j = cond3
81+
? i * 4 + 3
82+
: i * 8 + 7;
83+
if (!cond3)
84+
System.Console.WriteLine(j); // congruent 3 mod 4
7985
}
8086

8187
void For(int cap)

0 commit comments

Comments
 (0)