Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
kekyo committed May 25, 2022
1 parent 98ea27a commit 7a5ea48
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 5 deletions.
15 changes: 15 additions & 0 deletions il2c.sln
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,27 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{3EBFA913-C
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IL2C.Core.Test.BasicTypes", "tests\IL2C.Core.Test.BasicTypes\IL2C.Core.Test.BasicTypes.csproj", "{A6072CD1-A526-45F2-BB88-D1040AC3A7E8}"
ProjectSection(ProjectDependencies) = postProject
{BB7FA204-433A-416B-B9D0-9A79DF874284} = {BB7FA204-433A-416B-B9D0-9A79DF874284}
{182A62A4-47AC-4290-8EA5-250AE8131613} = {182A62A4-47AC-4290-8EA5-250AE8131613}
{2CBC90EC-5581-452F-8231-086E4553D20E} = {2CBC90EC-5581-452F-8231-086E4553D20E}
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IL2C.Core.Test.Common", "tests\IL2C.Core.Test.Common\IL2C.Core.Test.Common.csproj", "{6811E378-50B3-4206-BB48-1E56A2F2D90E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IL2C.Core.Test.ILConverters", "tests\IL2C.Core.Test.ILConverters\IL2C.Core.Test.ILConverters.csproj", "{DC306000-300C-4E65-826C-2E41C6445CA9}"
ProjectSection(ProjectDependencies) = postProject
{BB7FA204-433A-416B-B9D0-9A79DF874284} = {BB7FA204-433A-416B-B9D0-9A79DF874284}
{182A62A4-47AC-4290-8EA5-250AE8131613} = {182A62A4-47AC-4290-8EA5-250AE8131613}
{2CBC90EC-5581-452F-8231-086E4553D20E} = {2CBC90EC-5581-452F-8231-086E4553D20E}
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IL2C.Core.Test.RuntimeSystems", "tests\IL2C.Core.Test.RuntimeSystems\IL2C.Core.Test.RuntimeSystems.csproj", "{E397A251-4373-4A8E-AA13-3891282DEDC7}"
ProjectSection(ProjectDependencies) = postProject
{BB7FA204-433A-416B-B9D0-9A79DF874284} = {BB7FA204-433A-416B-B9D0-9A79DF874284}
{182A62A4-47AC-4290-8EA5-250AE8131613} = {182A62A4-47AC-4290-8EA5-250AE8131613}
{2CBC90EC-5581-452F-8231-086E4553D20E} = {2CBC90EC-5581-452F-8231-086E4553D20E}
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{C26C4683-9840-4307-8774-F1F952E3591B}"
EndProject
Expand Down
21 changes: 21 additions & 0 deletions tests/IL2C.Core.Test.BasicTypes/IL2C.Core.Test.BasicTypes.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">

<Import Project="..\..\src\IL2C.Build\build\IL2C.Build.props" />
<Import Project="..\..\src\IL2C.Runtime\build\IL2C.Runtime.props" />
<Import Project="..\..\misc\IL2C.Toolchain.gcc4.mingw32\build\IL2C.Toolchain.gcc4.mingw32.props" />

<!-- ====================================================== -->

<PropertyGroup>
<!--
<TargetFrameworks>net48;net6.0</TargetFrameworks>
-->
<TargetFrameworks>net48</TargetFrameworks>
<OutputType>Library</OutputType>
<Optimize>False</Optimize>
<Nullable>enable</Nullable>

<AssemblyName>IL2C.Core.Test.BasicTypes</AssemblyName>
<RootNamespace>IL2C.BasicTypes</RootNamespace>

<IL2CBuildLogLevel>Debug</IL2CBuildLogLevel>
<IL2CBuildLaunchDebugger>true</IL2CBuildLaunchDebugger>
</PropertyGroup>

<ItemGroup>
Expand All @@ -26,4 +38,13 @@
<Compile Include="..\IL2C.Core.Test.Common\*.cs" />
</ItemGroup>

<!-- ====================================================== -->

<Import Project="..\..\src\IL2C.Build\build\IL2C.Build.targets" />
<Import Project="..\..\src\IL2C.Runtime\build\IL2C.Runtime.targets" />
<Import Project="..\..\misc\IL2C.Toolchain.gcc4.mingw32\build\IL2C.Toolchain.gcc4.mingw32.targets" />
<PropertyGroup>
<IL2CBuildToolingDir>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)\..\..\src\IL2C.Build\bin\$(Configuration)\$(_IL2C_PlatformName)'))</IL2CBuildToolingDir>
</PropertyGroup>

</Project>
20 changes: 15 additions & 5 deletions tests/IL2C.Core.Test.Common/TestCaseAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#nullable enable

using System;
using System.Linq;

using NUnit.Framework.Interfaces;

Expand All @@ -23,7 +22,7 @@ public enum TestCaseAsserts
CauseBreak
}

[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
public sealed class TestCaseAttribute :
NUnit.Framework.TestCaseAttribute, NUnit.Framework.ITestAction
{
Expand All @@ -39,7 +38,7 @@ public TestCaseAttribute(
this.Assert = TestCaseAsserts.PerfectMatch;
this.IncludeBaseTypes = false;
this.IncludeTypes = Type.EmptyTypes;
this.IgnoreILErrors = Array.Empty<string>();
this.IgnoreILErrors = new string[0];
}

// This overload contains additional methods, those are used from the test method (first methodName is target.)
Expand All @@ -50,12 +49,22 @@ public TestCaseAttribute(
base.ExpectedResult = expected;

this.MethodName = methodNames[0]; // test method
this.AdditionalMethodNames = methodNames.Skip(1).ToArray(); // additionals
this.AdditionalMethodNames = GetAdditionalMethodNames(methodNames); // additionals

this.Assert = TestCaseAsserts.PerfectMatch;
this.IncludeBaseTypes = false;
this.IncludeTypes = Type.EmptyTypes;
this.IgnoreILErrors = Array.Empty<string>();
this.IgnoreILErrors = new string[0];
}

private static string[] GetAdditionalMethodNames(string[] methodNames)
{
var amns = new string[methodNames.Length - 1];
for (var index = 0; index < (methodNames.Length - 1); index++)
{
amns[index] = methodNames[index + 1];
}
return amns;
}

public string MethodName { get; }
Expand All @@ -79,6 +88,7 @@ public void AfterTest(ITest test)
{
// TODO: delegates to test native code.
}

#if false
private static object?[] ConvertToArgumentsType(object?[] args, Type[] argumentTypes) =>
args.Zip(argumentTypes, ConvertToArgumentType).ToArray();
Expand Down

0 comments on commit 7a5ea48

Please sign in to comment.