From 5bee7665e9ee3d6e8c7e71ef0fa49ac8c6e06a16 Mon Sep 17 00:00:00 2001 From: Katy Coe Date: Sat, 9 Nov 2019 23:59:41 +0100 Subject: [PATCH] Tests: Update Properties tests to include indexers --- .../GameAssembly-Properties-x64.cs | 9 +++++++-- .../GameAssembly-Properties-x86.cs | 7 ++++++- Il2CppTests/TestExpectedResults/Properties.cs | 15 ++++++++++----- Il2CppTests/TestSources/Properties.cs | 13 +++++++++++++ 4 files changed, 36 insertions(+), 8 deletions(-) diff --git a/Il2CppTests/TestExpectedResults/GameAssembly-Properties-x64.cs b/Il2CppTests/TestExpectedResults/GameAssembly-Properties-x64.cs index 17d6927..5b84b7d 100644 --- a/Il2CppTests/TestExpectedResults/GameAssembly-Properties-x64.cs +++ b/Il2CppTests/TestExpectedResults/GameAssembly-Properties-x64.cs @@ -8,9 +8,14 @@ internal class Test // TypeDefIndex: 1811 // Properties private int prop1 { get; set; } // 0x00000001800ECD10 0x0000000180143AD0 - protected int prop2 { get; private set; } // 0x0000000180156360 0x00000001803E0E90 + protected int prop2 { get; private set; } // 0x0000000180156360 0x00000001803E0F20 protected int prop3 { private get; set; } // 0x00000001800ED060 0x000000018019DD90 - public static int prop4 { private get; set; } // 0x00000001803E0E50 0x00000001803E0EA0 + public static int prop4 { private get; set; } // 0x00000001803E0EE0 0x00000001803E0F30 + public string this[int i] { get; } // 0x00000001803E0E80 + public string this[double d] { get; } // 0x00000001803E0E50 + public string this[long l] { set; } // 0x00000001800EA7B0 + public string this[] { get; set; } // 0x00000001803E0EB0 0x00000001800EA7B0 + public bool this[int i, int j] { get; } // 0x000000018010E420 // Constructors public Test(); // 0x00000001800E2000 diff --git a/Il2CppTests/TestExpectedResults/GameAssembly-Properties-x86.cs b/Il2CppTests/TestExpectedResults/GameAssembly-Properties-x86.cs index 827c236..1cef894 100644 --- a/Il2CppTests/TestExpectedResults/GameAssembly-Properties-x86.cs +++ b/Il2CppTests/TestExpectedResults/GameAssembly-Properties-x86.cs @@ -10,7 +10,12 @@ internal class Test // TypeDefIndex: 1811 private int prop1 { get; set; } // 0x100BF0C0 0x100EB270 protected int prop2 { get; private set; } // 0x100C5B30 0x100C5B50 protected int prop3 { private get; set; } // 0x100BFC20 0x100C5B40 - public static int prop4 { private get; set; } // 0x1034DA60 0x1034DA90 + public static int prop4 { private get; set; } // 0x1034DAF0 0x1034DB20 + public string this[int i] { get; } // 0x1034DA90 + public string this[double d] { get; } // 0x1034DA60 + public string this[long l] { set; } // 0x100C5530 + public string this[] { get; set; } // 0x1034DAC0 0x100C5530 + public bool this[int i, int j] { get; } // 0x100E5880 // Constructors public Test(); // 0x100BF000 diff --git a/Il2CppTests/TestExpectedResults/Properties.cs b/Il2CppTests/TestExpectedResults/Properties.cs index 7b5dfa3..58f2e5c 100644 --- a/Il2CppTests/TestExpectedResults/Properties.cs +++ b/Il2CppTests/TestExpectedResults/Properties.cs @@ -7,13 +7,18 @@ internal class Test // TypeDefIndex: 1811 // Fields // Properties - private int prop1 { get; set; } // 0x00561178 0x00561180 - protected int prop2 { get; private set; } // 0x00561188 0x00561190 - protected int prop3 { private get; set; } // 0x00561198 0x005611A0 - public static int prop4 { private get; set; } // 0x005611A8 0x0056120C + private int prop1 { get; set; } // 0x00561230 0x00561238 + protected int prop2 { get; private set; } // 0x00561240 0x00561248 + protected int prop3 { private get; set; } // 0x00561250 0x00561258 + public static int prop4 { private get; set; } // 0x00561260 0x005612C4 + public string this[int i] { get; } // 0x00561328 + public string this[double d] { get; } // 0x00561384 + public string this[long l] { set; } // 0x005613DC + public string this[] { get; set; } // 0x005613E0 0x0056143C + public bool this[int i, int j] { get; } // 0x00561440 // Constructors - public Test(); // 0x00561270 + public Test(); // 0x00561448 } diff --git a/Il2CppTests/TestSources/Properties.cs b/Il2CppTests/TestSources/Properties.cs index 3ff644c..0305810 100644 --- a/Il2CppTests/TestSources/Properties.cs +++ b/Il2CppTests/TestSources/Properties.cs @@ -12,5 +12,18 @@ namespace Il2CppTests.TestSources protected int prop2 { get; private set; } protected int prop3 { private get; set; } public static int prop4 { private get; set; } + + // Read-only ndexers + public string this[int i] => "foo"; + public string this[double d] => "bar"; + + // Write-only indexer + public string this[long l] { set {} } + + // Read/write indexer + public string this[float f] { get => "baz"; set {} } + + // Multi-dimensional indexer + public bool this[int i, int j] => true; } }