Skip to content

Commit 558ddd9

Browse files
committed
tests: Add test to confirm v106 game loads correctly.
1 parent c16ead4 commit 558ddd9

File tree

5 files changed

+37
-0
lines changed

5 files changed

+37
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
namespace Cpp2IL.Core.Tests;
2+
3+
public class DynamicWidthTests
4+
{
5+
[SetUp]
6+
public void Setup()
7+
{
8+
Cpp2IlApi.ResetInternalState();
9+
TestGameLoader.LoadSimpleV106Game();
10+
}
11+
12+
[Test]
13+
public void AssertTheGameLoadedProperly()
14+
{
15+
var context = Cpp2IlApi.CurrentAppContext!;
16+
17+
//Yes, this is really dumb and stupid as a test. But it does actually test that the dynamic-width impl is correct (or we'd throw in setup)
18+
//and we can't actually check the calculation easily from here, because the index widths are only configured while actively loading the metadata.
19+
Assert.That(context, Is.Not.Null);
20+
}
21+
}

Cpp2IL.Core.Tests/Paths.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,13 @@ public static class Simple2022Game
2323
public const string GameAssembly = RootDirectory + "GameAssembly.dll";
2424
public const string Metadata = DataDirectory + "il2cpp_data/Metadata/global-metadata.dat";
2525
}
26+
27+
public static class SimpleV106Game
28+
{
29+
public const string RootDirectory = TestFilesDirectory + "Simple_6000_5_0_a6/";
30+
public const string DataDirectory = RootDirectory + "Simple_6000_5_0_a6_Data/";
31+
// public const string ExecutableFile = RootDirectory + "Simple_6000_5_0_a6.exe"; //doesn't actually exist
32+
public const string GameAssembly = RootDirectory + "GameAssembly.dll";
33+
public const string Metadata = DataDirectory + "il2cpp_data/Metadata/global-metadata.dat";
34+
}
2635
}

Cpp2IL.Core.Tests/TestGameLoader.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,11 @@ public static ApplicationAnalysisContext LoadSimple2022Game()
2828
Cpp2IlApi.InitializeLibCpp2Il(Paths.Simple2022Game.GameAssembly, Paths.Simple2022Game.Metadata, new UnityVersion(2022, 3, 35, UnityVersionType.Final, 1));
2929
return Cpp2IlApi.CurrentAppContext!;
3030
}
31+
32+
public static ApplicationAnalysisContext LoadSimpleV106Game()
33+
{
34+
EnsureInit();
35+
Cpp2IlApi.InitializeLibCpp2Il(Paths.SimpleV106Game.GameAssembly, Paths.SimpleV106Game.Metadata, new UnityVersion(6000, 5, 0, UnityVersionType.Alpha, 6));
36+
return Cpp2IlApi.CurrentAppContext!;
37+
}
3138
}
40 MB
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)