Browse Source

Reorganize TestRunner-Tests

pull/734/head
Siegfried Pammer 9 years ago
parent
commit
6c57304684
  1. 19
      ICSharpCode.Decompiler/Tests/CorrectnessTestRunner.cs
  2. 39
      ICSharpCode.Decompiler/Tests/ICSharpCode.Decompiler.Tests.csproj
  3. 44
      ICSharpCode.Decompiler/Tests/TestCases/ConvTest.il
  4. 0
      ICSharpCode.Decompiler/Tests/TestCases/Correctness/BitNot.il
  5. 0
      ICSharpCode.Decompiler/Tests/TestCases/Correctness/Comparisons.cs
  6. 0
      ICSharpCode.Decompiler/Tests/TestCases/Correctness/CompoundAssignment.cs
  7. 0
      ICSharpCode.Decompiler/Tests/TestCases/Correctness/ControlFlow.cs
  8. 2
      ICSharpCode.Decompiler/Tests/TestCases/Correctness/Conversions.cs
  9. 0
      ICSharpCode.Decompiler/Tests/TestCases/Correctness/DecimalFields.cs
  10. 0
      ICSharpCode.Decompiler/Tests/TestCases/Correctness/Generics.cs
  11. 0
      ICSharpCode.Decompiler/Tests/TestCases/Correctness/HelloWorld.cs
  12. 0
      ICSharpCode.Decompiler/Tests/TestCases/Correctness/InitializerTests.cs
  13. 0
      ICSharpCode.Decompiler/Tests/TestCases/Correctness/MemberLookup.cs
  14. 0
      ICSharpCode.Decompiler/Tests/TestCases/Correctness/PropertiesAndEvents.cs
  15. 2
      ICSharpCode.Decompiler/Tests/TestCases/Correctness/Readme.txt
  16. 0
      ICSharpCode.Decompiler/Tests/TestCases/Correctness/Switch.cs
  17. 0
      ICSharpCode.Decompiler/Tests/TestCases/Correctness/UndocumentedExpressions.cs
  18. 0
      ICSharpCode.Decompiler/Tests/TestCases/Correctness/UnsafeCode.cs
  19. 0
      ICSharpCode.Decompiler/Tests/TestCases/Correctness/ValueTypeCall.cs
  20. 29
      ICSharpCode.Decompiler/Tests/TestCases/ILTest.il
  21. 14
      ICSharpCode.Decompiler/Tests/TestCases/Pretty/Readme.txt

19
ICSharpCode.Decompiler/Tests/TestRunner.cs → ICSharpCode.Decompiler/Tests/CorrectnessTestRunner.cs

@ -11,14 +11,14 @@ using NUnit.Framework; @@ -11,14 +11,14 @@ using NUnit.Framework;
namespace ICSharpCode.Decompiler.Tests
{
[TestFixture]
public class TestRunner
public class CorrectnessTestRunner
{
const string TestCasePath = @"../../Tests/TestCases";
const string TestCasePath = @"../../Tests/TestCases/Correctness";
[Test]
public void AllFilesHaveTests()
{
var testNames = typeof(TestRunner).GetMethods()
var testNames = typeof(CorrectnessTestRunner).GetMethods()
.Where(m => m.GetCustomAttributes(typeof(TestAttribute), false).Any())
.Select(m => m.Name)
.ToArray();
@ -107,19 +107,6 @@ namespace ICSharpCode.Decompiler.Tests @@ -107,19 +107,6 @@ namespace ICSharpCode.Decompiler.Tests
{
TestCompileDecompileCompileOutputAll("MemberLookup.cs");
}
[Test]
public void ILTest()
{
TestAssembleDecompileCompileOutput("ILTest.il");
}
[Test]
public void ConvTest()
{
TestAssembleDecompileCompileOutput("ConvTest.il");
TestAssembleDecompileCompileOutput("ConvTest.il", CompilerOptions.UseDebug | CompilerOptions.Force32Bit, AssemblerOptions.Force32Bit);
}
[Test]
public void BitNot()

39
ICSharpCode.Decompiler/Tests/ICSharpCode.Decompiler.Tests.csproj

@ -89,9 +89,8 @@ @@ -89,9 +89,8 @@
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="TestCases\BitNot.il" />
<None Include="TestCases\ILTest.il" />
<None Include="TestCases\Readme.txt" />
<None Include="TestCases\Correctness\BitNot.il" />
<None Include="TestCases\Correctness\Readme.txt" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\cecil\Mono.Cecil.csproj">
@ -118,21 +117,21 @@ @@ -118,21 +117,21 @@
<Compile Include="Helpers\TypeSystemHelper.cs" />
<Compile Include="Loops.cs" />
<Compile Include="RoundtripAssembly.cs" />
<Compile Include="TestCases\CompoundAssignment.cs" />
<Compile Include="TestCases\ControlFlow.cs" />
<Compile Include="TestCases\Conversions.cs" />
<Compile Include="TestCases\DecimalFields.cs" />
<Compile Include="TestCases\Comparisons.cs" />
<Compile Include="TestCases\Generics.cs" />
<Compile Include="TestCases\HelloWorld.cs" />
<Compile Include="TestCases\InitializerTests.cs" />
<Compile Include="TestCases\MemberLookup.cs" />
<Compile Include="TestCases\PropertiesAndEvents.cs" />
<Compile Include="TestCases\Switch.cs" />
<Compile Include="TestCases\UndocumentedExpressions.cs" />
<Compile Include="TestCases\UnsafeCode.cs" />
<Compile Include="TestCases\ValueTypeCall.cs" />
<Compile Include="TestRunner.cs" />
<Compile Include="TestCases\Correctness\CompoundAssignment.cs" />
<Compile Include="TestCases\Correctness\ControlFlow.cs" />
<Compile Include="TestCases\Correctness\Conversions.cs" />
<Compile Include="TestCases\Correctness\DecimalFields.cs" />
<Compile Include="TestCases\Correctness\Comparisons.cs" />
<Compile Include="TestCases\Correctness\Generics.cs" />
<Compile Include="TestCases\Correctness\HelloWorld.cs" />
<Compile Include="TestCases\Correctness\InitializerTests.cs" />
<Compile Include="TestCases\Correctness\MemberLookup.cs" />
<Compile Include="TestCases\Correctness\PropertiesAndEvents.cs" />
<Compile Include="TestCases\Correctness\Switch.cs" />
<Compile Include="TestCases\Correctness\UndocumentedExpressions.cs" />
<Compile Include="TestCases\Correctness\UnsafeCode.cs" />
<Compile Include="TestCases\Correctness\ValueTypeCall.cs" />
<Compile Include="CorrectnessTestRunner.cs" />
<Compile Include="Util\IntervalTests.cs" />
<Compile Include="Util\LongSetTests.cs" />
<Compile Include="CustomAttributes\CustomAttributeTests.cs" />
@ -145,6 +144,8 @@ @@ -145,6 +144,8 @@
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<None Include="TestCases\Pretty\Readme.txt" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>

44
ICSharpCode.Decompiler/Tests/TestCases/ConvTest.il

@ -1,44 +0,0 @@ @@ -1,44 +0,0 @@
.assembly extern mscorlib
{
.publickeytoken = (
b7 7a 5c 56 19 34 e0 89
)
.ver 4:0:0:0
}
.assembly 'ConvTest'
{
.ver 0:0:0:0
}
.module ConvTest.exe
// MVID: {987E1A15-519A-400C-B879-759CFB7F990B}
.corflags 0x00000001 // ILOnly
.class private auto ansi abstract sealed beforefieldinit Program
extends [mscorlib]System.Object
{
.method public hidebysig static void Print (native int) cil managed {
ldarg.0
box [mscorlib]System.IntPtr
call void [mscorlib]System.Console::WriteLine(object)
ret
}
.method public hidebysig static void Main (string[] args) cil managed {
.entrypoint
.try {
ldc.i4.0
call void Program::Print(native int)
ldc.i8 7595444518666557374
conv.i
call void Program::Print(native int)
leave.s eof
} catch [mscorlib]System.Exception {
callvirt instance string [mscorlib]System.Object::ToString()
call void [mscorlib]System.Console::WriteLine(object)
leave.s eof
}
eof: ret
}
}

0
ICSharpCode.Decompiler/Tests/TestCases/BitNot.il → ICSharpCode.Decompiler/Tests/TestCases/Correctness/BitNot.il

0
ICSharpCode.Decompiler/Tests/TestCases/Comparisons.cs → ICSharpCode.Decompiler/Tests/TestCases/Correctness/Comparisons.cs

0
ICSharpCode.Decompiler/Tests/TestCases/CompoundAssignment.cs → ICSharpCode.Decompiler/Tests/TestCases/Correctness/CompoundAssignment.cs

0
ICSharpCode.Decompiler/Tests/TestCases/ControlFlow.cs → ICSharpCode.Decompiler/Tests/TestCases/Correctness/ControlFlow.cs

2
ICSharpCode.Decompiler/Tests/TestCases/Conversions.cs → ICSharpCode.Decompiler/Tests/TestCases/Correctness/Conversions.cs

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// #include "../../../NRefactory/ICSharpCode.NRefactory/Utils/CSharpPrimitiveCast.cs"
// #include "../../../../NRefactory/ICSharpCode.NRefactory/Utils/CSharpPrimitiveCast.cs"
using System;
using ICSharpCode.NRefactory.Utils;

0
ICSharpCode.Decompiler/Tests/TestCases/DecimalFields.cs → ICSharpCode.Decompiler/Tests/TestCases/Correctness/DecimalFields.cs

0
ICSharpCode.Decompiler/Tests/TestCases/Generics.cs → ICSharpCode.Decompiler/Tests/TestCases/Correctness/Generics.cs

0
ICSharpCode.Decompiler/Tests/TestCases/HelloWorld.cs → ICSharpCode.Decompiler/Tests/TestCases/Correctness/HelloWorld.cs

0
ICSharpCode.Decompiler/Tests/TestCases/InitializerTests.cs → ICSharpCode.Decompiler/Tests/TestCases/Correctness/InitializerTests.cs

0
ICSharpCode.Decompiler/Tests/TestCases/MemberLookup.cs → ICSharpCode.Decompiler/Tests/TestCases/Correctness/MemberLookup.cs

0
ICSharpCode.Decompiler/Tests/TestCases/PropertiesAndEvents.cs → ICSharpCode.Decompiler/Tests/TestCases/Correctness/PropertiesAndEvents.cs

2
ICSharpCode.Decompiler/Tests/TestCases/Readme.txt → ICSharpCode.Decompiler/Tests/TestCases/Correctness/Readme.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
The files in this folder are correctness tests for the decompiler.
The NUnit class running these tests is ../TestRunner.cs.
The NUnit class running these tests is ../../CorrectnessTestRunner.cs.
We:
* compile/assemble a test case (call the result "executable 1")

0
ICSharpCode.Decompiler/Tests/TestCases/Switch.cs → ICSharpCode.Decompiler/Tests/TestCases/Correctness/Switch.cs

0
ICSharpCode.Decompiler/Tests/TestCases/UndocumentedExpressions.cs → ICSharpCode.Decompiler/Tests/TestCases/Correctness/UndocumentedExpressions.cs

0
ICSharpCode.Decompiler/Tests/TestCases/UnsafeCode.cs → ICSharpCode.Decompiler/Tests/TestCases/Correctness/UnsafeCode.cs

0
ICSharpCode.Decompiler/Tests/TestCases/ValueTypeCall.cs → ICSharpCode.Decompiler/Tests/TestCases/Correctness/ValueTypeCall.cs

29
ICSharpCode.Decompiler/Tests/TestCases/ILTest.il

@ -1,29 +0,0 @@ @@ -1,29 +0,0 @@
// C:\Users\Siegfried\Documents\SharpDevelop Projects\HelloWorld\HelloWorld\bin\Debug\HelloWorld.exe
.assembly extern mscorlib
{
.publickeytoken = ( b7 7a 5c 56 19 34 e0 89 )
.ver 4:0:0:0
}
.assembly HelloWorld
{
.ver 0:0:0:0
}
.module HelloWorld.exe
.corflags 0x00000001 // ILOnly
.class private auto ansi abstract sealed beforefieldinit Program
extends [mscorlib]System.Object
{
.method public hidebysig static void Main (string[] args) cil managed
{
.maxstack 8
.entrypoint
ldstr "Hello World!"
call void [mscorlib]System.Console::WriteLine(string)
ret
} // end of method Main
} // end of class <Module>

14
ICSharpCode.Decompiler/Tests/TestCases/Pretty/Readme.txt

@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
The files in this folder are prettiness tests for the decompiler.
The NUnit class running these tests is ../PrettyTestRunner.cs.
It uses pre-defined IL files in order to avoid test failures in cause of compiler changes.
We test different C# compiler versions as well (in future).
Each test consists of a C# file for comparing the resulting code and a source IL file used for assembling/decompiling.
We:
* assemble a test case (call the result "executable 1")
* decompile "executable 1" to C# ("decompiled.cs")
* compare "decompiled.cs" to "source.cs"
The tests pass if the code looks exactly the same as the input code, ignoring comments, empty lines and preprocessor directives.
Loading…
Cancel
Save