diff options
author | Jerome Laban <jerome.laban@nventive.com> | 2019-10-18 04:05:35 +0300 |
---|---|---|
committer | Jerome Laban <jerome.laban@nventive.com> | 2019-10-18 04:16:09 +0300 |
commit | aeda49954b805f80dfafa5d5b971d5bfb3e73043 (patch) | |
tree | bf813de9889fd59a1f2fd27f723e8f3829891130 /Test | |
parent | 06da31930ff100cef48aef677c4ceeee858e6c04 (diff) |
Fix invalid ComputeHash from ByteByffer array computation
Diffstat (limited to 'Test')
-rw-r--r-- | Test/Mono.Cecil.Tests/PortablePdbTests.cs | 37 | ||||
-rw-r--r-- | Test/Resources/assemblies/foo.dll | bin | 0 -> 3072 bytes | |||
-rw-r--r-- | Test/Resources/assemblies/hello2.exe | bin | 0 -> 3584 bytes |
3 files changed, 37 insertions, 0 deletions
diff --git a/Test/Mono.Cecil.Tests/PortablePdbTests.cs b/Test/Mono.Cecil.Tests/PortablePdbTests.cs index 6e1efbc..e741865 100644 --- a/Test/Mono.Cecil.Tests/PortablePdbTests.cs +++ b/Test/Mono.Cecil.Tests/PortablePdbTests.cs @@ -683,5 +683,42 @@ class Program using (var module = ModuleDefinition.ReadModule (destination, new ReaderParameters { SymbolReaderProvider = new PortablePdbReaderProvider () })) { } } + + [Test] + public void DoubleWriteAndReadAgainModuleWithDeterministicMvid () + { + Guid mvid1_in, mvid1_out, mvid2_in, mvid2_out; + + { + const string resource = "foo.dll"; + string destination = Path.GetTempFileName (); + + using (var module = GetResourceModule (resource, new ReaderParameters { })) { + mvid1_in = module.Mvid; + module.Write (destination, new WriterParameters { DeterministicMvid = true }); + } + + using (var module = ModuleDefinition.ReadModule (destination, new ReaderParameters { })) { + mvid1_out = module.Mvid; + } + } + + { + const string resource = "hello2.exe"; + string destination = Path.GetTempFileName (); + + using (var module = GetResourceModule (resource, new ReaderParameters { })) { + mvid2_in = module.Mvid; + module.Write (destination, new WriterParameters { DeterministicMvid = true }); + } + + using (var module = ModuleDefinition.ReadModule (destination, new ReaderParameters { })) { + mvid2_out = module.Mvid; + } + } + + Assert.AreNotEqual (mvid1_in, mvid2_in); + Assert.AreNotEqual (mvid1_out, mvid2_out); + } } } diff --git a/Test/Resources/assemblies/foo.dll b/Test/Resources/assemblies/foo.dll Binary files differnew file mode 100644 index 0000000..56b17e0 --- /dev/null +++ b/Test/Resources/assemblies/foo.dll diff --git a/Test/Resources/assemblies/hello2.exe b/Test/Resources/assemblies/hello2.exe Binary files differnew file mode 100644 index 0000000..6cc52a9 --- /dev/null +++ b/Test/Resources/assemblies/hello2.exe |