mirror of
https://github.com/github/codeql.git
synced 2026-04-24 16:25:15 +02:00
C#: Add tuple member tests
This commit is contained in:
21
csharp/ql/test/library-tests/tuples/tuple.cs
Normal file
21
csharp/ql/test/library-tests/tuples/tuple.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
|
||||
public class Program
|
||||
{
|
||||
public static void Main()
|
||||
{
|
||||
var x = (1, 2);
|
||||
Console.WriteLine(x.GetType());
|
||||
x = new ValueTuple<int, int>(1, 2);
|
||||
Console.WriteLine(x.GetType());
|
||||
|
||||
var y = (1, 2, 3, 4, 5, 6, 7);
|
||||
Console.WriteLine(y.GetType());
|
||||
|
||||
var z = (1, 2, 3, 4, 5, 6, 7, 8);
|
||||
Console.WriteLine(z.GetType());
|
||||
|
||||
var w = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
|
||||
Console.WriteLine(w.GetType());
|
||||
}
|
||||
}
|
||||
87
csharp/ql/test/library-tests/tuples/tuples.expected
Normal file
87
csharp/ql/test/library-tests/tuples/tuples.expected
Normal file
@@ -0,0 +1,87 @@
|
||||
members1
|
||||
| tuple.cs:7:17:7:22 | (Int32,Int32) | CompareTo((int, int)) |
|
||||
| tuple.cs:7:17:7:22 | (Int32,Int32) | CompareTo(object) |
|
||||
| tuple.cs:7:17:7:22 | (Int32,Int32) | CompareTo(object, IComparer) |
|
||||
| tuple.cs:7:17:7:22 | (Int32,Int32) | Equals((int, int)) |
|
||||
| tuple.cs:7:17:7:22 | (Int32,Int32) | Equals(object) |
|
||||
| tuple.cs:7:17:7:22 | (Int32,Int32) | Equals(object, IEqualityComparer) |
|
||||
| tuple.cs:7:17:7:22 | (Int32,Int32) | GetHashCode() |
|
||||
| tuple.cs:7:17:7:22 | (Int32,Int32) | GetHashCode(IEqualityComparer) |
|
||||
| tuple.cs:7:17:7:22 | (Int32,Int32) | Item1 |
|
||||
| tuple.cs:7:17:7:22 | (Int32,Int32) | Item2 |
|
||||
| tuple.cs:7:17:7:22 | (Int32,Int32) | Item[int] |
|
||||
| tuple.cs:7:17:7:22 | (Int32,Int32) | Length |
|
||||
| tuple.cs:7:17:7:22 | (Int32,Int32) | ToString() |
|
||||
| tuple.cs:7:17:7:22 | (Int32,Int32) | ToStringEnd() |
|
||||
| tuple.cs:7:17:7:22 | (Int32,Int32) | ValueTuple() |
|
||||
| tuple.cs:7:17:7:22 | (Int32,Int32) | ValueTuple(int, int) |
|
||||
| tuple.cs:12:17:12:37 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32) | CompareTo((int, int, int, int, int, int, int)) |
|
||||
| tuple.cs:12:17:12:37 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32) | CompareTo(object) |
|
||||
| tuple.cs:12:17:12:37 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32) | CompareTo(object, IComparer) |
|
||||
| tuple.cs:12:17:12:37 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32) | Equals((int, int, int, int, int, int, int)) |
|
||||
| tuple.cs:12:17:12:37 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32) | Equals(object) |
|
||||
| tuple.cs:12:17:12:37 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32) | Equals(object, IEqualityComparer) |
|
||||
| tuple.cs:12:17:12:37 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32) | GetHashCode() |
|
||||
| tuple.cs:12:17:12:37 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32) | GetHashCode(IEqualityComparer) |
|
||||
| tuple.cs:12:17:12:37 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32) | Item1 |
|
||||
| tuple.cs:12:17:12:37 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32) | Item2 |
|
||||
| tuple.cs:12:17:12:37 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32) | Item3 |
|
||||
| tuple.cs:12:17:12:37 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32) | Item4 |
|
||||
| tuple.cs:12:17:12:37 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32) | Item5 |
|
||||
| tuple.cs:12:17:12:37 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32) | Item6 |
|
||||
| tuple.cs:12:17:12:37 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32) | Item7 |
|
||||
| tuple.cs:12:17:12:37 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32) | Item[int] |
|
||||
| tuple.cs:12:17:12:37 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32) | Length |
|
||||
| tuple.cs:12:17:12:37 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32) | ToString() |
|
||||
| tuple.cs:12:17:12:37 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32) | ToStringEnd() |
|
||||
| tuple.cs:12:17:12:37 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32) | ValueTuple() |
|
||||
| tuple.cs:12:17:12:37 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32) | ValueTuple(int, int, int, int, int, int, int) |
|
||||
| tuple.cs:15:17:15:40 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | CompareTo((int, int, int, int, int, int, int, int)) |
|
||||
| tuple.cs:15:17:15:40 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | CompareTo(object) |
|
||||
| tuple.cs:15:17:15:40 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | CompareTo(object, IComparer) |
|
||||
| tuple.cs:15:17:15:40 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | Equals((int, int, int, int, int, int, int, int)) |
|
||||
| tuple.cs:15:17:15:40 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | Equals(object) |
|
||||
| tuple.cs:15:17:15:40 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | Equals(object, IEqualityComparer) |
|
||||
| tuple.cs:15:17:15:40 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | GetHashCode() |
|
||||
| tuple.cs:15:17:15:40 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | GetHashCode(IEqualityComparer) |
|
||||
| tuple.cs:15:17:15:40 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | Item1 |
|
||||
| tuple.cs:15:17:15:40 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | Item2 |
|
||||
| tuple.cs:15:17:15:40 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | Item3 |
|
||||
| tuple.cs:15:17:15:40 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | Item4 |
|
||||
| tuple.cs:15:17:15:40 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | Item5 |
|
||||
| tuple.cs:15:17:15:40 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | Item6 |
|
||||
| tuple.cs:15:17:15:40 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | Item7 |
|
||||
| tuple.cs:15:17:15:40 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | Item8 |
|
||||
| tuple.cs:15:17:15:40 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | Item[int] |
|
||||
| tuple.cs:15:17:15:40 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | Length |
|
||||
| tuple.cs:15:17:15:40 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | Rest |
|
||||
| tuple.cs:15:17:15:40 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | ToString() |
|
||||
| tuple.cs:15:17:15:40 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | ToStringEnd() |
|
||||
| tuple.cs:15:17:15:40 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | ValueTuple() |
|
||||
| tuple.cs:15:17:15:40 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | ValueTuple(int, int, int, int, int, int, int, (int)) |
|
||||
| tuple.cs:18:17:18:47 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | CompareTo((int, int, int, int, int, int, int, int, int, int)) |
|
||||
| tuple.cs:18:17:18:47 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | CompareTo(object) |
|
||||
| tuple.cs:18:17:18:47 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | CompareTo(object, IComparer) |
|
||||
| tuple.cs:18:17:18:47 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | Equals((int, int, int, int, int, int, int, int, int, int)) |
|
||||
| tuple.cs:18:17:18:47 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | Equals(object) |
|
||||
| tuple.cs:18:17:18:47 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | Equals(object, IEqualityComparer) |
|
||||
| tuple.cs:18:17:18:47 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | GetHashCode() |
|
||||
| tuple.cs:18:17:18:47 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | GetHashCode(IEqualityComparer) |
|
||||
| tuple.cs:18:17:18:47 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | Item1 |
|
||||
| tuple.cs:18:17:18:47 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | Item2 |
|
||||
| tuple.cs:18:17:18:47 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | Item3 |
|
||||
| tuple.cs:18:17:18:47 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | Item4 |
|
||||
| tuple.cs:18:17:18:47 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | Item5 |
|
||||
| tuple.cs:18:17:18:47 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | Item6 |
|
||||
| tuple.cs:18:17:18:47 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | Item7 |
|
||||
| tuple.cs:18:17:18:47 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | Item8 |
|
||||
| tuple.cs:18:17:18:47 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | Item9 |
|
||||
| tuple.cs:18:17:18:47 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | Item10 |
|
||||
| tuple.cs:18:17:18:47 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | Item[int] |
|
||||
| tuple.cs:18:17:18:47 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | Length |
|
||||
| tuple.cs:18:17:18:47 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | Rest |
|
||||
| tuple.cs:18:17:18:47 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | ToString() |
|
||||
| tuple.cs:18:17:18:47 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | ToStringEnd() |
|
||||
| tuple.cs:18:17:18:47 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | ValueTuple() |
|
||||
| tuple.cs:18:17:18:47 | (Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32) | ValueTuple(int, int, int, int, int, int, int, (int, int, int)) |
|
||||
members2
|
||||
12
csharp/ql/test/library-tests/tuples/tuples.ql
Normal file
12
csharp/ql/test/library-tests/tuples/tuples.ql
Normal file
@@ -0,0 +1,12 @@
|
||||
import csharp
|
||||
|
||||
query predicate members1(TupleType t, string m) {
|
||||
t.fromSource() and
|
||||
m = t.getAMember().toStringWithTypes()
|
||||
}
|
||||
|
||||
query predicate members2(TupleType t, string s, string m) {
|
||||
t.fromSource() and
|
||||
s = t.getUnderlyingType().toStringWithTypes() and
|
||||
m = t.getUnderlyingType().getAMember().toStringWithTypes()
|
||||
}
|
||||
Reference in New Issue
Block a user