Update unit tests
This commit is contained in:
@@ -27,13 +27,15 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="TestExpectedResults\GameAssembly-Generics-x64.cs" />
|
||||
<Content Include="TestExpectedResults\GameAssembly-Generics-x86.cs" />
|
||||
<Compile Remove="TestSources\GenericTypes.cs" />
|
||||
<Compile Remove="TestSources\Methods.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="TestExpectedResults\GameAssembly-Methods-x64.cs" />
|
||||
<Content Include="TestExpectedResults\GameAssembly-Methods-x86.cs" />
|
||||
<Content Include="TestExpectedResults\Generics.cs" />
|
||||
<Content Include="TestExpectedResults\Methods.cs" />
|
||||
<Content Include="TestSources\Generics.cs" />
|
||||
<Content Include="TestSources\GenericTypes.cs" />
|
||||
<Content Include="TestSources\Methods.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
// Image 0: mscorlib.dll - 0
|
||||
// Image 1: GenericTypes.dll - 1810
|
||||
|
||||
// Namespace: Il2CppTests.TestSources
|
||||
public class Base<T, U> // TypeDefIndex: 1811
|
||||
{
|
||||
// Constructors
|
||||
public Base();
|
||||
|
||||
}
|
||||
|
||||
// Namespace: Il2CppTests.TestSources
|
||||
public class Derived<V> : Base<string, V> // TypeDefIndex: 1812
|
||||
{
|
||||
// Fields
|
||||
public G<Derived<V>> F; // 0x00
|
||||
|
||||
// Nested types
|
||||
public class Nested<V> // TypeDefIndex: 1813
|
||||
{
|
||||
// Constructors
|
||||
public Nested();
|
||||
|
||||
}
|
||||
|
||||
// Constructors
|
||||
public Derived();
|
||||
|
||||
}
|
||||
|
||||
// Namespace: Il2CppTests.TestSources
|
||||
public class G<T> // TypeDefIndex: 1814
|
||||
{
|
||||
// Constructors
|
||||
public G();
|
||||
|
||||
}
|
||||
|
||||
// Namespace: Il2CppTests.TestSources
|
||||
internal class Test // TypeDefIndex: 1815
|
||||
{
|
||||
// Constructors
|
||||
public Test(); // 0x00000001800E2000
|
||||
|
||||
// Methods
|
||||
public void GenericTypesTest(); // 0x00000001803E0E50
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
// Image 0: mscorlib.dll - 0
|
||||
// Image 1: GenericTypes.dll - 1810
|
||||
|
||||
// Namespace: Il2CppTests.TestSources
|
||||
public class Base<T, U> // TypeDefIndex: 1811
|
||||
{
|
||||
// Constructors
|
||||
public Base();
|
||||
|
||||
}
|
||||
|
||||
// Namespace: Il2CppTests.TestSources
|
||||
public class Derived<V> : Base<string, V> // TypeDefIndex: 1812
|
||||
{
|
||||
// Fields
|
||||
public G<Derived<V>> F; // 0x00
|
||||
|
||||
// Nested types
|
||||
public class Nested<V> // TypeDefIndex: 1813
|
||||
{
|
||||
// Constructors
|
||||
public Nested();
|
||||
|
||||
}
|
||||
|
||||
// Constructors
|
||||
public Derived();
|
||||
|
||||
}
|
||||
|
||||
// Namespace: Il2CppTests.TestSources
|
||||
public class G<T> // TypeDefIndex: 1814
|
||||
{
|
||||
// Constructors
|
||||
public G();
|
||||
|
||||
}
|
||||
|
||||
// Namespace: Il2CppTests.TestSources
|
||||
internal class Test // TypeDefIndex: 1815
|
||||
{
|
||||
// Constructors
|
||||
public Test(); // 0x100BF000
|
||||
|
||||
// Methods
|
||||
public void GenericTypesTest(); // 0x1034DA60
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
48
Il2CppTests/TestExpectedResults/GenericTypes.cs
Normal file
48
Il2CppTests/TestExpectedResults/GenericTypes.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
// Image 0: mscorlib.dll - 0
|
||||
// Image 1: GenericTypes.dll - 1810
|
||||
|
||||
// Namespace: Il2CppTests.TestSources
|
||||
public class Base<T, U> // TypeDefIndex: 1811
|
||||
{
|
||||
// Constructors
|
||||
public Base();
|
||||
|
||||
}
|
||||
|
||||
// Namespace: Il2CppTests.TestSources
|
||||
public class Derived<V> : Base<string, V> // TypeDefIndex: 1812
|
||||
{
|
||||
// Fields
|
||||
public G<Derived<V>> F; // 0x00
|
||||
|
||||
// Nested types
|
||||
public class Nested<V> // TypeDefIndex: 1813
|
||||
{
|
||||
// Constructors
|
||||
public Nested();
|
||||
|
||||
}
|
||||
|
||||
// Constructors
|
||||
public Derived();
|
||||
|
||||
}
|
||||
|
||||
// Namespace: Il2CppTests.TestSources
|
||||
public class G<T> // TypeDefIndex: 1814
|
||||
{
|
||||
// Constructors
|
||||
public G();
|
||||
|
||||
}
|
||||
|
||||
// Namespace: Il2CppTests.TestSources
|
||||
internal class Test // TypeDefIndex: 1815
|
||||
{
|
||||
// Constructors
|
||||
public Test(); // 0x00561704
|
||||
|
||||
// Methods
|
||||
public void GenericTypesTest(); // 0x00561548
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
48
Il2CppTests/TestSources/GenericTypes.cs
Normal file
48
Il2CppTests/TestSources/GenericTypes.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
Copyright 2017-2019 Katy Coe - http://www.hearthcode.org - http://www.djkaty.com
|
||||
|
||||
All rights reserved.
|
||||
*/
|
||||
|
||||
using System;
|
||||
|
||||
namespace Il2CppTests.TestSources
|
||||
{
|
||||
public class Base<T, U> { }
|
||||
|
||||
public class Derived<V> : Base<string, V>
|
||||
{
|
||||
public G<Derived<V>> F;
|
||||
|
||||
public class Nested { }
|
||||
}
|
||||
|
||||
public class G<T> { }
|
||||
|
||||
internal class Test
|
||||
{
|
||||
public void GenericTypesTest() {
|
||||
// Get the generic type definition for Derived, and the base
|
||||
// type for Derived.
|
||||
//
|
||||
|
||||
Type tDerived = typeof(Derived<>);
|
||||
Type tDerivedBase = tDerived.BaseType;
|
||||
|
||||
// Declare an array of Derived<int>, and get its type.
|
||||
//
|
||||
Derived<int>[] d = new Derived<int>[0];
|
||||
Type tDerivedArray = d.GetType();
|
||||
|
||||
// Get a generic type parameter, the type of a field, and a
|
||||
// type that is nested in Derived. Notice that in order to
|
||||
// get the nested type it is necessary to either (1) specify
|
||||
// the generic type definition Derived<>, as shown here,
|
||||
// or (2) specify a type parameter for Derived.
|
||||
//
|
||||
Type tT = typeof(Base<,>).GetGenericArguments()[0];
|
||||
Type tF = tDerived.GetField("F").FieldType;
|
||||
Type tNested = typeof(Derived<>.Nested);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
/*
|
||||
Copyright 2017-2019 Katy Coe - http://www.hearthcode.org - http://www.djkaty.com
|
||||
|
||||
All rights reserved.
|
||||
*/
|
||||
|
||||
namespace Il2CppTests.TestSources
|
||||
{
|
||||
// Generic class
|
||||
internal class GenericClass<T>
|
||||
{
|
||||
// Generic method using generic type parameter of class
|
||||
public void GenericMethodWithClassGenericTypeParameter(T v) { }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user