diff --git a/.github/workflows/build-linux.yaml b/.github/workflows/build-linux.yaml
index 8d056f90..8d5ad7dc 100644
--- a/.github/workflows/build-linux.yaml
+++ b/.github/workflows/build-linux.yaml
@@ -1,16 +1,5 @@
name: Linux
-on:
- push:
- branches:
- - master
- - devel
- - feature/github-actions-2
- pull_request:
- branches:
- - master
- - devel
- workflow_dispatch:
- branches:
+on: [push]
permissions:
contents: read
jobs:
@@ -23,55 +12,123 @@ jobs:
env:
buildConfiguration: ${{ matrix.buildConfiguration }}
steps:
+
+ #----------------------------------------------------------------------
+
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
lfs: true
- # https://stackoverflow.com/questions/61463578/github-actions-actions-checkoutv2-lfs-true-flag-not-converting-pointers-to-act
+
- name: Checkout LFS objects
run: git lfs checkout
- - name: Setup .NET Core 2.1
+
+ - name: Extract branch name
+ id: extract_branch_name
+ run: |
+ export branch_name=`git name-rev --name-only --exclude=tags/* HEAD`
+ echo "Detected current branch: $branch_name"
+ echo "::set-output name=branch_name::$branch_name"
+
+ #----------------------------------------------------------------------
+
+ - name: Setup .NET Core 2.2
uses: actions/setup-dotnet@v1
with:
- dotnet-version: 2.1.818
+ dotnet-version: 2.2.*
- name: Setup .NET Core 3.1
uses: actions/setup-dotnet@v1
with:
- dotnet-version: 3.1.414
+ dotnet-version: 3.1.*
- name: Setup .NET 5
uses: actions/setup-dotnet@v1
with:
- dotnet-version: 5.0.402
+ dotnet-version: 5.0.*
- name: Setup .NET 6
uses: actions/setup-dotnet@v1
with:
- dotnet-version: 6.0.100
+ dotnet-version: 6.0.*
+
+ #----------------------------------------------------------------------
+
+ #- name: Add msbuild to PATH
+ # uses: microsoft/setup-msbuild@v1.0.3
+
+ #- name: Setup NuGet CLI
+ # uses: nuget/setup-nuget@v1
+
+ #----------------------------------------------------------------------
+
#- name: Initialize tools
# run: bash .github/workflows/init-tools-on-ga.sh
- - name: Install dependencies
- run: |
- dotnet restore il2c.sln
- dotnet restore samples/Calculator/Calculator.Core/Calculator.Core.csproj
-# dotnet restore samples/GettingStartedIL2C/GettingStartedIL2C.sln
-# dotnet restore samples/Calculator/Calculator.sln
+
+ #----------------------------------------------------------------------
+
- name: Build runtime library
run: bash build-runtime.sh ${{env.buildConfiguration}}
+
+ #----------------------------------------------------------------------
+
- name: Build il2c
- run: dotnet build --configuration ${{env.buildConfiguration}} --no-restore -p:BuildIdentifier=$GITHUB_RUN_NUMBER -p:Platform="Any CPU" il2c.sln
-# - name: Build GettingStartedIL2C-x86
-# run: dotnet build --configuration ${{env.buildConfiguration}} --no-restore -p:BuildIdentifier=$GITHUB_RUN_NUMBER -p:Platform=x86 samples/GettingStartedIL2C/GettingStartedIL2C.sln
-# - name: Build GettingStartedIL2C-x64
-# run: dotnet build --configuration ${{env.buildConfiguration}} --no-restore -p:BuildIdentifier=$GITHUB_RUN_NUMBER -p:Platform=x64 samples/GettingStartedIL2C/GettingStartedIL2C.sln
+ run: dotnet build --configuration ${{env.buildConfiguration}} -p:BuildIdentifier=$GITHUB_RUN_NUMBER il2c.sln
+
+ #----------------------------------------------------------------------
+
+ - name: Test il2c (BasicTypes)
+ run: dotnet test --no-build --verbosity normal --configuration ${{env.buildConfiguration}} tests/IL2C.Core.Test.BasicTypes/IL2C.Core.Test.BasicTypes.csproj -- BuildIdentifier=$GITHUB_RUN_NUMBER Platform=x64 CITest=True
+ timeout-minutes: 20
+ - name: Test il2c (ILConverters)
+ run: dotnet test --no-build --verbosity normal --configuration ${{env.buildConfiguration}} tests/IL2C.Core.Test.ILConverters/IL2C.Core.Test.ILConverters.csproj -- BuildIdentifier=$GITHUB_RUN_NUMBER Platform=x64 CITest=True
+ timeout-minutes: 20
+ - name: Test il2c (RuntimeSystems)
+ run: dotnet test --no-build --verbosity normal --configuration ${{env.buildConfiguration}} tests/IL2C.Core.Test.RuntimeSystems/IL2C.Core.Test.RuntimeSystems.csproj -- BuildIdentifier=$GITHUB_RUN_NUMBER Platform=x64 CITest=True
+ timeout-minutes: 20
+
+ #----------------------------------------------------------------------
+
+ - name: Build GettingStartedIL2C
+ run: dotnet build --configuration ${{env.buildConfiguration}} -p:BuildIdentifier=$GITHUB_RUN_NUMBER samples/GettingStartedIL2C/GettingStartedIL2C.sln
+
- name: Build Calculator.Core
- run: dotnet build --configuration ${{env.buildConfiguration}} --no-restore -p:BuildIdentifier=$GITHUB_RUN_NUMBER -p:Platform="AnyCPU" samples/Calculator/Calculator.Core/Calculator.Core.csproj
-# - name: Build Calculator-x86
-# run: dotnet build --configuration ${{env.buildConfiguration}} --no-restore -p:BuildIdentifier=$GITHUB_RUN_NUMBER -p:Platform=x86 samples/Calculator/Calculator.sln
-# - name: Build Calculator-x64
-# run: dotnet build --configuration ${{env.buildConfiguration}} --no-restore -p:BuildIdentifier=$GITHUB_RUN_NUMBER -p:Platform=x64 samples/Calculator/Calculator.sln
+ run: dotnet build --configuration ${{env.buildConfiguration}} -p:BuildIdentifier=$GITHUB_RUN_NUMBER samples/Calculator/Calculator.Core/Calculator.Core.csproj
+ - name: Build Calculator
+ run: dotnet build --configuration ${{env.buildConfiguration}} -p:BuildIdentifier=$GITHUB_RUN_NUMBER samples/Calculator/Calculator/Calculator.csproj
+
+ #- name: Build Calculator-x86
+ # run: dotnet build --configuration ${{env.buildConfiguration}} -p:BuildIdentifier=$GITHUB_RUN_NUMBER -p:Platform=x86 samples/Calculator/Calculator.sln
+ #- name: Build Calculator-x64
+ # run: dotnet build --configuration ${{env.buildConfiguration}} -p:BuildIdentifier=$GITHUB_RUN_NUMBER -p:Platform=x64 samples/Calculator/Calculator.sln
+
- name: Build Calculator-CMake-mingw32
run: bash build.sh ${{env.buildConfiguration}}
working-directory: samples/Calculator/Calculator.CMake
- - name: Test il2c
- run: dotnet test --no-build --verbosity normal --configuration ${{env.buildConfiguration}} tests/IL2C.Core.Test.Fixture/IL2C.Core.Test.Fixture.csproj -- BuildIdentifier=$GITHUB_RUN_NUMBER Platform=x64 CITest=True
- timeout-minutes: 20
+
+ #----------------------------------------------------------------------
+
+ - name: Build packages
+ run: |
+ dotnet pack --configuration ${{env.buildConfiguration}} -p:BuildIdentifier=$GITHUB_RUN_NUMBER -o artifacts src/IL2C.Interop/IL2C.Interop.csproj
+ dotnet pack --configuration ${{env.buildConfiguration}} -p:BuildIdentifier=$GITHUB_RUN_NUMBER -o artifacts src/IL2C.Core/IL2C.Core.csproj
+ dotnet pack --configuration ${{env.buildConfiguration}} -p:BuildIdentifier=$GITHUB_RUN_NUMBER -o artifacts src/IL2C.Build/IL2C.Build.csproj
+ dotnet pack --configuration ${{env.buildConfiguration}} -p:BuildIdentifier=$GITHUB_RUN_NUMBER -o artifacts misc/IL2C.Toolchain.gcc4.mingw32/IL2C.Toolchain.gcc4.mingw32.csproj
+
+ #----------------------------------------------------------------------
+
+ #- name: Deploy NuGet package (Release/devel/il2c-devel)
+ # if: (env.buildConfiguration == 'Release') && (startsWith(github.ref, 'refs/tags/'))
+ # run: |
+ # dotnet nuget push artifacts/IL2C.Interop.*.nupkg --source il2c-devel --api-key ${{secrets.GH_IL2C_NUGET_MYGET_KEY}}
+ # dotnet nuget push artifacts/IL2C.Core.*.nupkg --source il2c-devel --api-key ${{secrets.GH_IL2C_NUGET_MYGET_KEY}}
+ # dotnet nuget push artifacts/IL2C.Build.*.nupkg --source il2c-devel --api-key ${{secrets.GH_IL2C_NUGET_MYGET_KEY}}
+ # dotnet nuget push artifacts/IL2C.Toolchain.gcc4.mingw32.*.nupkg --source il2c-devel --api-key ${{secrets.GH_IL2C_NUGET_MYGET_KEY}}
+
+ #----------------------------------------------------------------------
+
+ #- name: Deploy NuGet package (Release/master/nuget.org)
+ # if: (env.buildConfiguration == 'Release') && (startsWith(github.ref, 'refs/tags/')) && (endsWith(steps.extract_branch_name.outputs.branch_name, 'master'))
+ # run: |
+ # dotnet nuget push artifacts/IL2C.Interop.*.nupkg --source nuget.org --api-key ${{secrets.GH_IL2C_NUGET_NUGET_KEY}}
+ # dotnet nuget push artifacts/IL2C.Core.*.nupkg --source nuget.org --api-key ${{secrets.GH_IL2C_NUGET_NUGET_KEY}}
+ # dotnet nuget push artifacts/IL2C.Build.*.nupkg --source nuget.org --api-key ${{secrets.GH_IL2C_NUGET_NUGET_KEY}}
+ # dotnet nuget push artifacts/IL2C.Toolchain.gcc4.mingw32.*.nupkg --source nuget.org --api-key ${{secrets.GH_IL2C_NUGET_NUGET_KEY}}
diff --git a/.github/workflows/build-windows.yaml b/.github/workflows/build-windows.yaml
index 9fb5a011..51d79290 100644
--- a/.github/workflows/build-windows.yaml
+++ b/.github/workflows/build-windows.yaml
@@ -1,16 +1,5 @@
name: Windows
-on:
- push:
- branches:
- - master
- - devel
- - feature/github-actions-2
- pull_request:
- branches:
- - master
- - devel
- workflow_dispatch:
- branches:
+on: [push]
permissions:
contents: read
jobs:
@@ -23,57 +12,126 @@ jobs:
env:
buildConfiguration: ${{ matrix.buildConfiguration }}
steps:
+
+ #----------------------------------------------------------------------
+
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
lfs: true
- # https://stackoverflow.com/questions/61463578/github-actions-actions-checkoutv2-lfs-true-flag-not-converting-pointers-to-act
+
- name: Checkout LFS objects
run: git lfs checkout
- - name: Setup .NET Core 2.1
+
+ - name: Extract branch name
+ id: extract_branch_name
+ run: |
+ $branch_name=$(git name-rev --name-only --exclude=tags/* HEAD)
+ echo "Detected current branch: ${branch_name}"
+ echo "::set-output name=branch_name::${branch_name}"
+
+ #----------------------------------------------------------------------
+
+ - name: Setup .NET Core 2.2
uses: actions/setup-dotnet@v1
with:
- dotnet-version: 2.1.818
+ dotnet-version: 2.2.*
- name: Setup .NET Core 3.1
uses: actions/setup-dotnet@v1
with:
- dotnet-version: 3.1.414
+ dotnet-version: 3.1.*
- name: Setup .NET 5
uses: actions/setup-dotnet@v1
with:
- dotnet-version: 5.0.402
+ dotnet-version: 5.0.*
- name: Setup .NET 6
uses: actions/setup-dotnet@v1
with:
- dotnet-version: 6.0.100
+ dotnet-version: 6.0.*
+
+ #----------------------------------------------------------------------
+
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.0.3
+
+ - name: Setup NuGet CLI
+ uses: nuget/setup-nuget@v1
+
+ #----------------------------------------------------------------------
+
- name: Initialize tools
run: init-tools.bat
shell: cmd
- - name: Install dependencies
- run: |
- dotnet restore il2c.sln
- dotnet restore samples\GettingStartedIL2C\GettingStartedIL2C.sln
- dotnet restore samples\Calculator\Calculator.sln
+
+ #----------------------------------------------------------------------
+
- name: Build runtime library
run: build-runtime.bat ${{env.buildConfiguration}}
shell: cmd
+
+ #----------------------------------------------------------------------
+
- name: Build il2c
- run: msbuild -p:Configuration=${{env.buildConfiguration}} -r:false -p:BuildIdentifier=$GITHUB_RUN_NUMBER -p:Platform="Any CPU" -maxCpuCount il2c.sln
- - name: Build GettingStartedIL2C-x86
- run: msbuild -p:Configuration=${{env.buildConfiguration}} -r:false -p:BuildIdentifier=$GITHUB_RUN_NUMBER -p:Platform=x86 -maxCpuCount samples\GettingStartedIL2C\GettingStartedIL2C.sln
- - name: Build GettingStartedIL2C-x64
- run: msbuild -p:Configuration=${{env.buildConfiguration}} -r:false -p:BuildIdentifier=$GITHUB_RUN_NUMBER -p:Platform=x64 -maxCpuCount samples\GettingStartedIL2C\GettingStartedIL2C.sln
- - name: Build Calculator-x86
- run: msbuild -p:Configuration=${{env.buildConfiguration}} -r:false -p:BuildIdentifier=$GITHUB_RUN_NUMBER -p:Platform=x86 -maxCpuCount samples\Calculator\Calculator.sln
- - name: Build Calculator-x64
- run: msbuild -p:Configuration=${{env.buildConfiguration}} -r:false -p:BuildIdentifier=$GITHUB_RUN_NUMBER -p:Platform=x64 -maxCpuCount samples\Calculator\Calculator.sln
+ run: dotnet build --configuration ${{env.buildConfiguration}} -p:BuildIdentifier=$GITHUB_RUN_NUMBER il2c.sln
+
+ #----------------------------------------------------------------------
+
+ - name: Test il2c (BasicTypes)
+ run: dotnet test --no-build --verbosity normal --configuration ${{env.buildConfiguration}} tests\IL2C.Core.Test.BasicTypes\IL2C.Core.Test.BasicTypes.csproj -- BuildIdentifier=$GITHUB_RUN_NUMBER Platform=x64 CITest=True
+ timeout-minutes: 20
+ - name: Test il2c (ILConverters)
+ run: dotnet test --no-build --verbosity normal --configuration ${{env.buildConfiguration}} tests\IL2C.Core.Test.ILConverters\IL2C.Core.Test.ILConverters.csproj -- BuildIdentifier=$GITHUB_RUN_NUMBER Platform=x64 CITest=True
+ timeout-minutes: 20
+ - name: Test il2c (RuntimeSystems)
+ run: dotnet test --no-build --verbosity normal --configuration ${{env.buildConfiguration}} tests\IL2C.Core.Test.RuntimeSystems\IL2C.Core.Test.RuntimeSystems.csproj -- BuildIdentifier=$GITHUB_RUN_NUMBER Platform=x64 CITest=True
+ timeout-minutes: 20
+
+ #----------------------------------------------------------------------
+
+ - name: Build GettingStartedIL2C
+ run: dotnet build --configuration ${{env.buildConfiguration}} -p:BuildIdentifier=$GITHUB_RUN_NUMBER samples\GettingStartedIL2C\GettingStartedIL2C.sln
+
+ - name: Build Calculator.Core
+ run: dotnet build --configuration ${{env.buildConfiguration}} -p:BuildIdentifier=$GITHUB_RUN_NUMBER samples\Calculator\Calculator.Core\Calculator.Core.csproj
+ - name: Build Calculator
+ run: dotnet build --configuration ${{env.buildConfiguration}} -p:BuildIdentifier=$GITHUB_RUN_NUMBER samples\Calculator\Calculator\Calculator.csproj
+
+ #- name: Build Calculator-x86
+ # run: msbuild -p:Configuration=${{env.buildConfiguration}} -r:false -p:BuildIdentifier=$GITHUB_RUN_NUMBER -p:Platform=x86 -maxCpuCount samples\Calculator\Calculator.sln
+ #- name: Build Calculator-x64
+ # run: msbuild -p:Configuration=${{env.buildConfiguration}} -r:false -p:BuildIdentifier=$GITHUB_RUN_NUMBER -p:Platform=x64 -maxCpuCount samples\Calculator\Calculator.sln
+
- name: Build Calculator-CMake-mingw32
run: build.bat ${{env.buildConfiguration}}
shell: cmd
working-directory: samples\Calculator\Calculator.CMake
- - name: Test il2c
- run: dotnet test --no-build --verbosity normal --configuration ${{env.buildConfiguration}} tests\IL2C.Core.Test.Fixture\IL2C.Core.Test.Fixture.csproj -- BuildIdentifier=$GITHUB_RUN_NUMBER Platform=x64 CITest=True
- timeout-minutes: 20
+
+ #----------------------------------------------------------------------
+
+ - name: Build packages
+ run: |
+ dotnet pack --configuration ${{env.buildConfiguration}} -p:BuildIdentifier=$GITHUB_RUN_NUMBER -o artifacts src\IL2C.Interop\IL2C.Interop.csproj
+ dotnet pack --configuration ${{env.buildConfiguration}} -p:BuildIdentifier=$GITHUB_RUN_NUMBER -o artifacts src\IL2C.Core\IL2C.Core.csproj
+ dotnet pack --configuration ${{env.buildConfiguration}} -p:BuildIdentifier=$GITHUB_RUN_NUMBER -o artifacts src\IL2C.Build\IL2C.Build.csproj
+ dotnet pack --configuration ${{env.buildConfiguration}} -p:BuildIdentifier=$GITHUB_RUN_NUMBER -o artifacts misc\IL2C.Toolchain.gcc4.mingw32\IL2C.Toolchain.gcc4.mingw32.csproj
+
+ #----------------------------------------------------------------------
+
+ - name: Deploy NuGet package (Release/devel/il2c-devel)
+ if: (env.buildConfiguration == 'Release') && (startsWith(github.ref, 'refs/tags/'))
+ run: |
+ dotnet nuget push artifacts\IL2C.Interop.*.nupkg --source il2c-devel --api-key ${{secrets.GH_IL2C_NUGET_MYGET_KEY}}
+ dotnet nuget push artifacts\IL2C.Core.*.nupkg --source il2c-devel --api-key ${{secrets.GH_IL2C_NUGET_MYGET_KEY}}
+ dotnet nuget push artifacts\IL2C.Build.*.nupkg --source il2c-devel --api-key ${{secrets.GH_IL2C_NUGET_MYGET_KEY}}
+ dotnet nuget push artifacts\IL2C.Toolchain.gcc4.mingw32.*.nupkg --source il2c-devel --api-key ${{secrets.GH_IL2C_NUGET_MYGET_KEY}}
+
+ #----------------------------------------------------------------------
+
+ #- name: Deploy NuGet package (Release/master/nuget.org)
+ # if: (env.buildConfiguration == 'Release') && (startsWith(github.ref, 'refs/tags/')) && (endsWith(steps.extract_branch_name.outputs.branch_name, 'master'))
+ # run: |
+ # dotnet nuget push artifacts\IL2C.Interop.*.nupkg --source nuget.org --api-key ${{secrets.GH_IL2C_NUGET_NUGET_KEY}}
+ # dotnet nuget push artifacts\IL2C.Core.*.nupkg --source nuget.org --api-key ${{secrets.GH_IL2C_NUGET_NUGET_KEY}}
+ # dotnet nuget push artifacts\IL2C.Build.*.nupkg --source nuget.org --api-key ${{secrets.GH_IL2C_NUGET_NUGET_KEY}}
+ # dotnet nuget push artifacts\IL2C.Toolchain.gcc4.mingw32.*.nupkg --source nuget.org --api-key ${{secrets.GH_IL2C_NUGET_NUGET_KEY}}
diff --git a/.nuget/nuget.exe b/.nuget/nuget.exe
index ba10c60a..47387865 100644
--- a/.nuget/nuget.exe
+++ b/.nuget/nuget.exe
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:432d322b16ffab3fed5d24ab7ea30ae10c555a00339a9bf53060aa4b2aee7925
-size 7042968
+oid sha256:c89875d937b7faff3ac024c3ceeceaaecbd786c47b33c09dd4129275a405594b
+size 7088552
diff --git a/NuGet.config b/NuGet.config
index 394f7cb5..d7430828 100644
--- a/NuGet.config
+++ b/NuGet.config
@@ -4,6 +4,5 @@
-
diff --git a/docs/sample-translation-results.md b/docs/sample-translation-results.md
index 6cde9053..814c60a9 100644
--- a/docs/sample-translation-results.md
+++ b/docs/sample-translation-results.md
@@ -75,7 +75,7 @@ void HelloWorld_Main()
.maxstack 2
ldstr "ABC"
isinst [mscorlib]System.ValueType
- brnull.s F1
+ brfalse.s F1
ldc.i4.1
ret
F1:
diff --git a/il2c.sln b/il2c.sln
index 5d5bebed..29f8ee61 100644
--- a/il2c.sln
+++ b/il2c.sln
@@ -31,11 +31,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{5710A57F
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IL2C.Runtime", "src\IL2C.Runtime\IL2C.Runtime.vcxproj", "{182A62A4-47AC-4290-8EA5-250AE8131613}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IL2C.Core.Test.Fixture", "tests\IL2C.Core.Test.Fixture\IL2C.Core.Test.Fixture.csproj", "{B0F1010D-8B73-46F7-AF8E-E3C58F68525F}"
- ProjectSection(ProjectDependencies) = postProject
- {182A62A4-47AC-4290-8EA5-250AE8131613} = {182A62A4-47AC-4290-8EA5-250AE8131613}
- EndProjectSection
-EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IL2C.Interop", "src\IL2C.Interop\IL2C.Interop.csproj", "{854E1ABE-0873-4BDC-8ABF-7F9506DD66DB}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{3EBFA913-CF51-4A28-9E4D-73CB5AE27D2F}"
@@ -49,12 +44,25 @@ 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}"
-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}"
+ 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.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
@@ -128,10 +136,6 @@ Global
{678EFB0E-BC0A-4749-AD48-079F98D9468D}.Release|Any CPU.Build.0 = Release|Any CPU
{182A62A4-47AC-4290-8EA5-250AE8131613}.Debug|Any CPU.ActiveCfg = Debug|x64
{182A62A4-47AC-4290-8EA5-250AE8131613}.Release|Any CPU.ActiveCfg = Release|x64
- {B0F1010D-8B73-46F7-AF8E-E3C58F68525F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {B0F1010D-8B73-46F7-AF8E-E3C58F68525F}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {B0F1010D-8B73-46F7-AF8E-E3C58F68525F}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {B0F1010D-8B73-46F7-AF8E-E3C58F68525F}.Release|Any CPU.Build.0 = Release|Any CPU
{854E1ABE-0873-4BDC-8ABF-7F9506DD66DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{854E1ABE-0873-4BDC-8ABF-7F9506DD66DB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{854E1ABE-0873-4BDC-8ABF-7F9506DD66DB}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -140,10 +144,6 @@ Global
{A6072CD1-A526-45F2-BB88-D1040AC3A7E8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A6072CD1-A526-45F2-BB88-D1040AC3A7E8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A6072CD1-A526-45F2-BB88-D1040AC3A7E8}.Release|Any CPU.Build.0 = Release|Any CPU
- {6811E378-50B3-4206-BB48-1E56A2F2D90E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {6811E378-50B3-4206-BB48-1E56A2F2D90E}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {6811E378-50B3-4206-BB48-1E56A2F2D90E}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {6811E378-50B3-4206-BB48-1E56A2F2D90E}.Release|Any CPU.Build.0 = Release|Any CPU
{DC306000-300C-4E65-826C-2E41C6445CA9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DC306000-300C-4E65-826C-2E41C6445CA9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DC306000-300C-4E65-826C-2E41C6445CA9}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -185,9 +185,7 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
- {B0F1010D-8B73-46F7-AF8E-E3C58F68525F} = {5710A57F-57F8-4D50-8C78-82E2DFDCB613}
{A6072CD1-A526-45F2-BB88-D1040AC3A7E8} = {5710A57F-57F8-4D50-8C78-82E2DFDCB613}
- {6811E378-50B3-4206-BB48-1E56A2F2D90E} = {5710A57F-57F8-4D50-8C78-82E2DFDCB613}
{DC306000-300C-4E65-826C-2E41C6445CA9} = {5710A57F-57F8-4D50-8C78-82E2DFDCB613}
{E397A251-4373-4A8E-AA13-3891282DEDC7} = {5710A57F-57F8-4D50-8C78-82E2DFDCB613}
{C26C4683-9840-4307-8774-F1F952E3591B} = {D105E6CD-626A-4C04-8AF6-0AA34A4E9CF4}
diff --git a/misc/ArtifactCollector/ArtifactCollector.csproj b/misc/ArtifactCollector/ArtifactCollector.csproj
index f3b969b6..e3cb9d93 100644
--- a/misc/ArtifactCollector/ArtifactCollector.csproj
+++ b/misc/ArtifactCollector/ArtifactCollector.csproj
@@ -10,7 +10,7 @@
-
+
diff --git a/misc/IL2C.Toolchain.gcc4.mingw32/IL2C.Toolchain.gcc4.mingw32.csproj b/misc/IL2C.Toolchain.gcc4.mingw32/IL2C.Toolchain.gcc4.mingw32.csproj
index 4df2000e..eb9e2708 100644
--- a/misc/IL2C.Toolchain.gcc4.mingw32/IL2C.Toolchain.gcc4.mingw32.csproj
+++ b/misc/IL2C.Toolchain.gcc4.mingw32/IL2C.Toolchain.gcc4.mingw32.csproj
@@ -7,7 +7,7 @@
-
+
diff --git a/misc/IL2C.Toolchain.gcc4.mingw32/build/IL2C.Toolchain.gcc4.mingw32.targets b/misc/IL2C.Toolchain.gcc4.mingw32/build/IL2C.Toolchain.gcc4.mingw32.targets
index 717c86f5..0a4a1093 100644
--- a/misc/IL2C.Toolchain.gcc4.mingw32/build/IL2C.Toolchain.gcc4.mingw32.targets
+++ b/misc/IL2C.Toolchain.gcc4.mingw32/build/IL2C.Toolchain.gcc4.mingw32.targets
@@ -19,8 +19,8 @@
$(_IL2C_GCC_ReleaseFlags)
$(_IL2C_GCC_DisableOptimizingFlags)
$(_IL2C_GCC_EnableOptimizingFlags)
- $(_IL2C_WinExeMainTemplatePath)
- $(IL2CNativeCompilerRequiredFlags) -mwindows
+ $(_IL2C_WinExeMainTemplatePath)
+ $(IL2CNativeCompilerRequiredFlags) -mwindows
diff --git a/samples/Calculator/Calculator.sln b/samples/Calculator/Calculator.sln
index 877e70e7..3a8de482 100644
--- a/samples/Calculator/Calculator.sln
+++ b/samples/Calculator/Calculator.sln
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.28803.156
+# Visual Studio Version 17
+VisualStudioVersion = 17.2.32526.322
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Calculator.Core", "Calculator.Core\Calculator.Core.csproj", "{FB776AD3-D01F-4DCF-9E99-2697BFFB21F3}"
EndProject
@@ -30,46 +30,78 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Generated", "Generated", "{
Generated\main.c = Generated\main.c
EndProjectSection
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Calculator", "Calculator\Calculator.csproj", "{696CCD4E-7AA6-4C56-93B1-3396F45DE4A0}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
+ Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {FB776AD3-D01F-4DCF-9E99-2697BFFB21F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {FB776AD3-D01F-4DCF-9E99-2697BFFB21F3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FB776AD3-D01F-4DCF-9E99-2697BFFB21F3}.Debug|x64.ActiveCfg = Debug|Any CPU
{FB776AD3-D01F-4DCF-9E99-2697BFFB21F3}.Debug|x64.Build.0 = Debug|Any CPU
{FB776AD3-D01F-4DCF-9E99-2697BFFB21F3}.Debug|x86.ActiveCfg = Debug|Any CPU
{FB776AD3-D01F-4DCF-9E99-2697BFFB21F3}.Debug|x86.Build.0 = Debug|Any CPU
+ {FB776AD3-D01F-4DCF-9E99-2697BFFB21F3}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {FB776AD3-D01F-4DCF-9E99-2697BFFB21F3}.Release|Any CPU.Build.0 = Release|Any CPU
{FB776AD3-D01F-4DCF-9E99-2697BFFB21F3}.Release|x64.ActiveCfg = Release|Any CPU
{FB776AD3-D01F-4DCF-9E99-2697BFFB21F3}.Release|x64.Build.0 = Release|Any CPU
{FB776AD3-D01F-4DCF-9E99-2697BFFB21F3}.Release|x86.ActiveCfg = Release|Any CPU
{FB776AD3-D01F-4DCF-9E99-2697BFFB21F3}.Release|x86.Build.0 = Release|Any CPU
+ {013A7C74-2291-43E5-AF1D-502F2ED62987}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {013A7C74-2291-43E5-AF1D-502F2ED62987}.Debug|Any CPU.Build.0 = Debug|Any CPU
{013A7C74-2291-43E5-AF1D-502F2ED62987}.Debug|x64.ActiveCfg = Debug|Any CPU
{013A7C74-2291-43E5-AF1D-502F2ED62987}.Debug|x64.Build.0 = Debug|Any CPU
{013A7C74-2291-43E5-AF1D-502F2ED62987}.Debug|x86.ActiveCfg = Debug|Any CPU
{013A7C74-2291-43E5-AF1D-502F2ED62987}.Debug|x86.Build.0 = Debug|Any CPU
+ {013A7C74-2291-43E5-AF1D-502F2ED62987}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {013A7C74-2291-43E5-AF1D-502F2ED62987}.Release|Any CPU.Build.0 = Release|Any CPU
{013A7C74-2291-43E5-AF1D-502F2ED62987}.Release|x64.ActiveCfg = Release|Any CPU
{013A7C74-2291-43E5-AF1D-502F2ED62987}.Release|x64.Build.0 = Release|Any CPU
{013A7C74-2291-43E5-AF1D-502F2ED62987}.Release|x86.ActiveCfg = Release|Any CPU
{013A7C74-2291-43E5-AF1D-502F2ED62987}.Release|x86.Build.0 = Release|Any CPU
+ {4DB1CA14-5035-4848-BCDE-10F0A7DC0F50}.Debug|Any CPU.ActiveCfg = Debug|x64
+ {4DB1CA14-5035-4848-BCDE-10F0A7DC0F50}.Debug|Any CPU.Build.0 = Debug|x64
{4DB1CA14-5035-4848-BCDE-10F0A7DC0F50}.Debug|x64.ActiveCfg = Debug|x64
{4DB1CA14-5035-4848-BCDE-10F0A7DC0F50}.Debug|x64.Build.0 = Debug|x64
{4DB1CA14-5035-4848-BCDE-10F0A7DC0F50}.Debug|x86.ActiveCfg = Debug|Win32
{4DB1CA14-5035-4848-BCDE-10F0A7DC0F50}.Debug|x86.Build.0 = Debug|Win32
+ {4DB1CA14-5035-4848-BCDE-10F0A7DC0F50}.Release|Any CPU.ActiveCfg = Release|x64
+ {4DB1CA14-5035-4848-BCDE-10F0A7DC0F50}.Release|Any CPU.Build.0 = Release|x64
{4DB1CA14-5035-4848-BCDE-10F0A7DC0F50}.Release|x64.ActiveCfg = Release|x64
{4DB1CA14-5035-4848-BCDE-10F0A7DC0F50}.Release|x64.Build.0 = Release|x64
{4DB1CA14-5035-4848-BCDE-10F0A7DC0F50}.Release|x86.ActiveCfg = Release|Win32
{4DB1CA14-5035-4848-BCDE-10F0A7DC0F50}.Release|x86.Build.0 = Release|Win32
+ {B4BC66C2-9D98-40BC-BB24-94CA3D0E3DD5}.Debug|Any CPU.ActiveCfg = Debug|x64
+ {B4BC66C2-9D98-40BC-BB24-94CA3D0E3DD5}.Debug|Any CPU.Build.0 = Debug|x64
{B4BC66C2-9D98-40BC-BB24-94CA3D0E3DD5}.Debug|x64.ActiveCfg = Debug|x64
{B4BC66C2-9D98-40BC-BB24-94CA3D0E3DD5}.Debug|x64.Build.0 = Debug|x64
{B4BC66C2-9D98-40BC-BB24-94CA3D0E3DD5}.Debug|x86.ActiveCfg = Debug|Win32
{B4BC66C2-9D98-40BC-BB24-94CA3D0E3DD5}.Debug|x86.Build.0 = Debug|Win32
+ {B4BC66C2-9D98-40BC-BB24-94CA3D0E3DD5}.Release|Any CPU.ActiveCfg = Release|x64
+ {B4BC66C2-9D98-40BC-BB24-94CA3D0E3DD5}.Release|Any CPU.Build.0 = Release|x64
{B4BC66C2-9D98-40BC-BB24-94CA3D0E3DD5}.Release|x64.ActiveCfg = Release|x64
{B4BC66C2-9D98-40BC-BB24-94CA3D0E3DD5}.Release|x64.Build.0 = Release|x64
{B4BC66C2-9D98-40BC-BB24-94CA3D0E3DD5}.Release|x86.ActiveCfg = Release|Win32
{B4BC66C2-9D98-40BC-BB24-94CA3D0E3DD5}.Release|x86.Build.0 = Release|Win32
+ {696CCD4E-7AA6-4C56-93B1-3396F45DE4A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {696CCD4E-7AA6-4C56-93B1-3396F45DE4A0}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {696CCD4E-7AA6-4C56-93B1-3396F45DE4A0}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {696CCD4E-7AA6-4C56-93B1-3396F45DE4A0}.Debug|x64.Build.0 = Debug|Any CPU
+ {696CCD4E-7AA6-4C56-93B1-3396F45DE4A0}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {696CCD4E-7AA6-4C56-93B1-3396F45DE4A0}.Debug|x86.Build.0 = Debug|Any CPU
+ {696CCD4E-7AA6-4C56-93B1-3396F45DE4A0}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {696CCD4E-7AA6-4C56-93B1-3396F45DE4A0}.Release|Any CPU.Build.0 = Release|Any CPU
+ {696CCD4E-7AA6-4C56-93B1-3396F45DE4A0}.Release|x64.ActiveCfg = Release|Any CPU
+ {696CCD4E-7AA6-4C56-93B1-3396F45DE4A0}.Release|x64.Build.0 = Release|Any CPU
+ {696CCD4E-7AA6-4C56-93B1-3396F45DE4A0}.Release|x86.ActiveCfg = Release|Any CPU
+ {696CCD4E-7AA6-4C56-93B1-3396F45DE4A0}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index 575e46b6..858e21c4 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -36,7 +36,7 @@
-
+
diff --git a/src/IL2C.Build/IL2C.Build.csproj b/src/IL2C.Build/IL2C.Build.csproj
index 28981309..9e8034b2 100644
--- a/src/IL2C.Build/IL2C.Build.csproj
+++ b/src/IL2C.Build/IL2C.Build.csproj
@@ -1,12 +1,14 @@
- net462;netcoreapp2.1;netcoreapp2.2;netcoreapp3.1;net5.0;net6.0
+ net462;netcoreapp2.2;netcoreapp3.1;net5.0;net6.0
Exe
enable
il2c
IL2C.Program
+
+ true
IL2C.Build.nuspec
true
false
diff --git a/src/IL2C.Build/IL2C.Build.nuspec b/src/IL2C.Build/IL2C.Build.nuspec
index da5ec109..5ba29115 100644
--- a/src/IL2C.Build/IL2C.Build.nuspec
+++ b/src/IL2C.Build/IL2C.Build.nuspec
@@ -34,7 +34,6 @@
-
diff --git a/src/IL2C.Build/Program.cs b/src/IL2C.Build/Program.cs
index eea28463..498d2798 100644
--- a/src/IL2C.Build/Program.cs
+++ b/src/IL2C.Build/Program.cs
@@ -55,6 +55,7 @@ public static async Task Main(string[] args)
var additionalIncludeDirs = new string[0];
var libraryPaths = new string[0];
var mainTemplatePath = default(string);
+ var enableParallelism = false;
var logLevel = LogLevels.Information;
var logtfm = default(string);
var launchDebugger = false;
@@ -64,8 +65,8 @@ public static async Task Main(string[] args)
{
{ "mode=", "Driving mode [both|translation|compilation]", v => drivingMode = Enum.TryParse(v, true, out var dm) ? dm : DrivingModes.Both },
{ "debug=", "Emit debug informations [none|commentonly|full]", v => debugInformationOptions = Enum.TryParse(v, true, out var t) ? t : DebugInformationOptions.None },
- { "produceCpp=", "Produce C++ extension files (apply extension *.cpp instead *.c, body will not change)", v => produceCpp = bool.TryParse(v, out var pc) ? pc : false },
- { "bundler=", "Produce bundler source file", v => enableBundler = bool.TryParse(v, out var eb) ? eb : false },
+ { "produceCpp=", "Produce C++ extension files (apply extension *.cpp instead *.c, body will not change)", v => produceCpp = bool.TryParse(v, out var pc) && pc },
+ { "bundler=", "Produce bundler source file", v => enableBundler = bool.TryParse(v, out var eb) && eb },
{ "target=", "Target platform [generic|ue4]", v => targetPlatform = Enum.TryParse(v, true, out var tp) ? tp : TargetPlatforms.Generic },
{ "refDirs=", "Reference assembly paths (semi-colon separated)", v => refDirs = v.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries) },
{ "compiler=", "Native compiler driver file", v => nativeCompiler = v },
@@ -78,6 +79,7 @@ public static async Task Main(string[] args)
{ "outputNativeExecutable=", "Output native executable file name", v => outputNativeExecutableFileName = v },
{ "outputNativeDir=", "Output native binary directory path", v => outputNativeDirPath = v },
{ "mainTemplate=", "Native main template path", v => mainTemplatePath = v },
+ { "enableParallel", "Enable parallelism", _ => enableParallelism = true },
{ "logLevel=", "Log level [debug|trace|information|warning|error|silent]", v => logLevel = Enum.TryParse(v, true, out var ll) ? ll : LogLevels.Information },
{ "logtfm=", "Log header tfm", v => logtfm = v },
{ "launchDebugger", "Launch debugger", _ => launchDebugger = true },
@@ -108,38 +110,45 @@ public static async Task Main(string[] args)
Debugger.Launch();
}
- // TODO: refs, trace
+ // TODO: trace
IMethodInformation? mainEntryPoint = null;
string inputCompilationDirPath;
if ((drivingMode & DrivingModes.Translation) == DrivingModes.Translation)
{
var translationOptions = new TranslationOptions(
- true, enableBundler, targetPlatform, debugInformationOptions);
-#if DEBUG
- var results = new List();
- foreach (var assemblyPath in inputPaths)
+ refDirs, enableBundler,
+ targetPlatform, debugInformationOptions);
+
+ IList entryPoints;
+ if (enableParallelism)
{
- var r = await SimpleTranslator.TranslateAsync(
- logger,
- outputBaseDirPath,
- produceCpp,
- translationOptions,
- assemblyPath);
- results.Add(r);
+ entryPoints = await Task.WhenAll(
+ inputPaths.Select(assemblyPath =>
+ SimpleTranslator.TranslateAsync(
+ logger,
+ outputBaseDirPath,
+ produceCpp,
+ translationOptions,
+ assemblyPath).AsTask())).
+ ConfigureAwait(false);
}
-#else
- var results = await Task.WhenAll(
- inputPaths.Select(assemblyPath =>
- SimpleTranslator.TranslateAsync(
+ else
+ {
+ entryPoints = new List();
+ foreach (var assemblyPath in inputPaths)
+ {
+ var r = await SimpleTranslator.TranslateAsync(
logger,
outputBaseDirPath,
produceCpp,
translationOptions,
- assemblyPath).AsTask())).
- ConfigureAwait(false);
-#endif
- mainEntryPoint = results.FirstOrDefault();
+ assemblyPath);
+ entryPoints.Add(r);
+ }
+ }
+
+ mainEntryPoint = entryPoints.FirstOrDefault();
inputCompilationDirPath = outputBaseDirPath;
}
else
@@ -154,7 +163,8 @@ public static async Task Main(string[] args)
{
var toolchainOptions = new ToolchainOptions(
nativeCompiler!, nativeCompilerFlags, nativeLinkingFlags, nativeArchiver!,
- additionalIncludeDirs, libraryPaths, mainTemplatePath);
+ additionalIncludeDirs, libraryPaths, mainTemplatePath,
+ enableParallelism);
var artifactPathOptions = new ArtifactPathOptions(
outputNativeArchiveFileName!, outputNativeExecutableFileName);
diff --git a/src/IL2C.Build/build/IL2C.Build.props b/src/IL2C.Build/build/IL2C.Build.props
index 11adcbe2..2c4d9fe5 100644
--- a/src/IL2C.Build/build/IL2C.Build.props
+++ b/src/IL2C.Build/build/IL2C.Build.props
@@ -41,6 +41,8 @@
$(Configuration)
$(IL2CConfiguration)
il2c
+ true
+ true
diff --git a/src/IL2C.Build/build/IL2C.Build.targets b/src/IL2C.Build/build/IL2C.Build.targets
index 3957691d..5390e965 100644
--- a/src/IL2C.Build/build/IL2C.Build.targets
+++ b/src/IL2C.Build/build/IL2C.Build.targets
@@ -14,14 +14,17 @@
- true
- true
Full
false
false
Generic
+ true
Information
false
+
+
+ Library
+ $(OutputType)
@@ -35,7 +38,7 @@
<_IL2C_PlatformName Condition="$(BundledNETCoreAppTargetFrameworkVersion) < 5.0">netcoreapp$(BundledNETCoreAppTargetFrameworkVersion)
- <_IL2C_PlatformName>netcoreapp2.0
+ <_IL2C_PlatformName>netcoreapp2.2
<_IL2C_PlatformName>net462
@@ -48,8 +51,14 @@
-
-
+
+ <_IL2C_BuildDependsOnTargets Condition="'$(_ILCompose_ScriptBaseDir)' != ''">ILComposeBuildTarget
+ <_IL2C_BuildDependsOnTargets Condition="'$(_ILCompose_ScriptBaseDir)' == ''">Compile
+
+
+
@@ -114,8 +123,8 @@
<_IL2C_OutputNativeArchiveFileName>$(IL2COutputNativeName).a
- <_IL2C_OutputNativeExecutableFileName Condition="('$(OutputType)' != 'Library') AND ('$(OS)' == 'Windows_NT')">$(IL2COutputNativeName).exe
- <_IL2C_OutputNativeExecutableFileName Condition="('$(OutputType)' != 'Library') AND ('$(OS)' != 'Windows_NT')">$(IL2COutputNativeName)
+ <_IL2C_OutputNativeExecutableFileName Condition="('$(IL2COutputType)' != 'Library') AND ('$(OS)' == 'Windows_NT')">$(IL2COutputNativeName).exe
+ <_IL2C_OutputNativeExecutableFileName Condition="('$(IL2COutputType)' != 'Library') AND ('$(OS)' != 'Windows_NT')">$(IL2COutputNativeName)
@@ -129,10 +138,12 @@
<_IL2C_NativeLibPathOption>--libs="$(IL2CNativeLibPath)"
<_IL2C_OutputNativeArchiveFileNameOption>--outputNativeArchive="$(_IL2C_OutputNativeArchiveFileName)"
<_IL2C_OutputNativeExecutableFileNameOption Condition="'$(_IL2C_OutputNativeExecutableFileName)' != ''">--outputNativeExecutable="$(_IL2C_OutputNativeExecutableFileName)"
- <_IL2C_NativeMainTemplatePathOption Condition="'$(OutputType)' != 'Library'">--mainTemplate="$(IL2CNativeMainTemplatePath)"
+ <_IL2C_OutputNativeDirOption>--outputNativeDir="$(IL2COutputPath)"
+ <_IL2C_NativeMainTemplatePathOption Condition="'$(IL2COutputType)' != 'Library'">--mainTemplate="$(IL2CNativeMainTemplatePath)"
+ <_IL2C_EnableParallelismOption Condition="$(IL2CEnableParallelism)">--enableParallel
<_IL2C_LaunchDebuggerOption Condition="$(IL2CBuildLaunchDebugger)">--launchDebugger
- <_IL2C_NativeOptions>$(_IL2C_NativeCompilerOption) $(_IL2C_NativeCompilerFlagsOption) $(_IL2C_NativeLinkingFlagsOption) $(_IL2C_NativeArchiverOption) $(_IL2C_NativeIncludeDirOption) $(_IL2C_NativeLibPathOption) $(_IL2C_OutputNativeArchiveFileNameOption) $(_IL2C_OutputNativeExecutableFileNameOption) $(_IL2C_NativeMainTemplatePathOption) $(_IL2C_LaunchDebuggerOption)
+
<_IL2C_DrivingMode>translation
@@ -152,7 +163,8 @@
<_IL2C_TemporaryDirPathForRuntimeLibrary>$([System.IO.Path]::Combine('$(_IL2C_RuntimeLibraryCacheBaseDirPath)','$([System.Guid]::NewGuid().ToString())'))
- <_IL2C_BuildRuntimeLibraryOptions>$(_IL2C_NativeCompilerOption) $(_IL2C_NativeCompilerFlagsOption) $(_IL2C_NativeArchiverOption) $(_IL2C_NativeIncludeDirOption) $(_IL2C_RaiseDebugBreakOption) --outputNativeArchive="$(_IL2C_RuntimeLibraryCacheFileName)" --outputNativeDir="$(_IL2C_TemporaryDirPathForRuntimeLibrary)"
+ <_IL2C_TemporaryDirPathForRuntimeLibraryOption>--outputNativeDir="$(_IL2C_TemporaryDirPathForRuntimeLibrary)"
+ <_IL2C_BuildRuntimeLibraryOptions>$(_IL2C_NativeCompilerOption) $(_IL2C_NativeCompilerFlagsOption) $(_IL2C_NativeArchiverOption) $(_IL2C_NativeIncludeDirOption) $(_IL2C_RaiseDebugBreakOption) --outputNativeArchive="$(_IL2C_RuntimeLibraryCacheFileName)" $(_IL2C_TemporaryDirPathForRuntimeLibraryOption)
@@ -170,6 +182,10 @@
+
+
+ <_IL2C_NativeOptions>$(_IL2C_NativeCompilerOption) $(_IL2C_NativeCompilerFlagsOption) $(_IL2C_NativeLinkingFlagsOption) $(_IL2C_NativeArchiverOption) $(_IL2C_NativeIncludeDirOption) $(_IL2C_NativeLibPathOption) $(_IL2C_OutputNativeArchiveFileNameOption) $(_IL2C_OutputNativeExecutableFileNameOption) $(_IL2C_OutputNativeDirOption) $(_IL2C_NativeMainTemplatePathOption) $(_IL2C_EnableParallelismOption) $(_IL2C_LaunchDebuggerOption)
+
diff --git a/src/IL2C.Core/AssemblyPreparer.cs b/src/IL2C.Core/AssemblyPreparer.cs
index 236ba0e4..4e49c312 100644
--- a/src/IL2C.Core/AssemblyPreparer.cs
+++ b/src/IL2C.Core/AssemblyPreparer.cs
@@ -67,8 +67,6 @@ private static IEnumerable DecodeAndEnumerateILBodies(
}
}
- private static readonly SequencePoint[] empty = new SequencePoint[0];
-
private static PreparedMethodInformation PrepareMethodBody(
IPrepareContext prepareContext,
IMethodInformation method)
@@ -132,8 +130,8 @@ from ilBody in DecodeAndEnumerateILBodies(dc)
dc.UniqueCodeBlockIndex,
ilBody.Code,
dc.DecodingPathNumber)).
- OrderBy(ilb => ilb.UniqueCodeBlockIndex).
- ThenBy(ilb => ilb.Label.Offset).
+ OrderBy(ilb => ilb.UniqueCodeBlockIndex). // TODO: Pointless?
+ ThenBy(ilb => ilb.Label.Offset). // TODO: Pointless?
ToDictionary(ilb => ilb.Label.Offset, ilb => ilb.Emitter);
//////////////////////////////////////////////////////////////////////////////
@@ -248,16 +246,15 @@ private static PreparedMethodInformation PrepareMethod(
method);
}
- internal static PreparedInformations Prepare(
- TranslateContext translateContext,
- Func predictType,
- Func predictMethod)
+ public static PreparedInformations Prepare(
+ TranslateContext translateContext)
{
IPrepareContext prepareContext = translateContext;
var allTypes = translateContext.Assembly.Modules.
SelectMany(module => module.Types.Concat(module.Types.SelectMany(type => type.NestedTypes))).
- Where(predictType).
+ // NOT marked IgnoreTranslation attribute
+ Where(type => !type.IsIgnoreTranslation).
Distinct().
ToArray();
@@ -296,7 +293,6 @@ internal static PreparedInformations Prepare(
allTypes,
(from type in allTypes
from method in type.DeclaredMethods
- where predictMethod(method)
let preparedMethod = PrepareMethod(prepareContext, method)
where preparedMethod != null
select preparedMethod).
@@ -304,15 +300,5 @@ where predictMethod(method)
preparedMethod => preparedMethod.Method,
preparedMethod => preparedMethod));
}
-
- public static PreparedInformations Prepare(TranslateContext translateContext)
- {
- return Prepare(
- translateContext,
- // All types
- type => true,
- // The methods except type initializer.
- method => !(method.IsConstructor && method.IsStatic));
- }
}
}
diff --git a/src/IL2C.Core/CodeTextStorage.cs b/src/IL2C.Core/CodeTextStorage.cs
index 43b214e3..958eb710 100644
--- a/src/IL2C.Core/CodeTextStorage.cs
+++ b/src/IL2C.Core/CodeTextStorage.cs
@@ -57,7 +57,7 @@ public CodeTextWriter CreateHeaderWriter(string fileName)
protected virtual TextWriter OnCreateTextWriter(string path)
{
- var directoryPath = IOAccessor.SafeGetDirectoryName(path);
+ var directoryPath = Path.GetFullPath(IOAccessor.GetDirectoryPath(path));
try
{
if (!Directory.Exists(directoryPath))
diff --git a/src/IL2C.Core/Drivers/NativeBinaryBuilder.cs b/src/IL2C.Core/Drivers/NativeBinaryBuilder.cs
index 1eeea88e..106b4d1d 100644
--- a/src/IL2C.Core/Drivers/NativeBinaryBuilder.cs
+++ b/src/IL2C.Core/Drivers/NativeBinaryBuilder.cs
@@ -30,6 +30,7 @@ public sealed class ToolchainOptions
public readonly string[] AdditionalIncludeDirs;
public readonly string[] LibraryPaths;
public readonly string? MainTemplatePath;
+ public readonly bool EnableParallelism;
public ToolchainOptions(
string nativeCompiler,
@@ -38,7 +39,8 @@ public ToolchainOptions(
string nativeArchiver,
string[] additionalIncludeDirs,
string[] libraryPaths,
- string? mainTemplatePath)
+ string? mainTemplatePath,
+ bool enableParallelism)
{
this.NativeCompiler = nativeCompiler;
this.NativeCompilerFlags = nativeCompilerFlags;
@@ -47,6 +49,7 @@ public ToolchainOptions(
this.AdditionalIncludeDirs = additionalIncludeDirs;
this.LibraryPaths = libraryPaths;
this.MainTemplatePath = mainTemplatePath;
+ this.EnableParallelism = enableParallelism;
}
}
@@ -98,9 +101,9 @@ private static async Task ExecuteCompilerAsync(
string[] additionalLibraryPaths)
{
var sourceCodeFileName = Path.GetFileNameWithoutExtension(sourceCodePath);
- var outputBasePath = Path.Combine(
+ var outputBasePath = Path.GetFullPath(Path.Combine(
outputStagingDirPath,
- IOAccessor.SafeGetDirectoryName(sourceCodePath.Substring(sourceDir.Length + 1)));
+ IOAccessor.GetDirectoryPath(sourceCodePath.Substring(sourceDir.Length + 1))));
var outputPath = Path.Combine(
outputBasePath,
outputFileName);
@@ -144,7 +147,7 @@ private static ValueTask ExecuteArchiverAsync(
string[] nativeCompilerBasePaths,
string nativeArchiver)
{
- var outputBasePath = IOAccessor.SafeGetDirectoryName(outputPath);
+ var outputBasePath = Path.GetFullPath(IOAccessor.GetDirectoryPath(outputPath));
var buildScriptPath = Path.Combine(
outputBasePath,
$"build_{Path.GetFileNameWithoutExtension(outputPath)}");
@@ -177,14 +180,14 @@ public static async ValueTask CompileToNativeAsync(
Path.Combine(
outputDirFullPath,
artifactPathOptions.OutputNativeArchiveFileName));
- var nativeToolchainBasePath = IOAccessor.SafeGetDirectoryName(
+ var nativeToolchainBasePath = IOAccessor.GetDirectoryPath(
toolchainOptions.NativeCompiler);
var nativeToolchainBasePaths =
string.IsNullOrWhiteSpace(nativeToolchainBasePath) ?
new string[0] :
new[] { Path.GetFullPath(nativeToolchainBasePath) };
- logger.Information($"Preparing for compilation native binary: \"{sourceCodeDirFullPath}\" ...");
+ logger.Information($"Preparing for compilation native binary: {sourceCodeDirFullPath}");
await IOAccessor.SafeCreateDirectoryAsync(
outputDirFullPath, outputDirFullPath != sourceCodeDirFullPath).
@@ -209,39 +212,44 @@ await IOAccessor.SafeCreateDirectoryAsync(
/////////////////////////////////////////////////////////////
// Compiling step:
- logger.Information($"Compiling native binary into \"{outputNativeArchiveFullPath}\" ...");
-
// Compile in small pieces:
// Because LTO (LTCG) is not always enable, it is better to subdivide object files
// to reduce the amount of code when linking.
-#if DEBUG
- var crs = new List();
- foreach (var sourceCodePath in sourceCodePaths)
+ IList crs;
+ if (toolchainOptions.EnableParallelism)
{
- logger.Trace($"Compiling source code: \"{sourceCodePath}\" ...");
- var r = await ExecuteCompilerAsync(
- sourceCodePath,
- outputStagingBaseDirPath,
- Path.GetFileNameWithoutExtension(sourceCodePath) + ".o",
- nativeToolchainBasePaths,
- toolchainOptions.NativeCompiler,
- toolchainOptions.NativeCompilerFlags,
- includeDir,
- sourceDir,
- true,
- null,
- toolchainOptions.AdditionalIncludeDirs,
- new string[0]).
+ logger.Information($"Building native library (In parallelism): {outputNativeArchiveFullPath}");
+
+ crs = await Task.WhenAll(
+ sourceCodePaths.
+ Select(sourceCodePath =>
+ {
+ logger.Trace($"Compiling source code: \"{sourceCodePath}\" ...");
+ return ExecuteCompilerAsync(
+ sourceCodePath,
+ outputStagingBaseDirPath,
+ Path.GetFileNameWithoutExtension(sourceCodePath) + ".o",
+ nativeToolchainBasePaths,
+ toolchainOptions.NativeCompiler,
+ toolchainOptions.NativeCompilerFlags,
+ includeDir,
+ sourceDir,
+ true,
+ null,
+ toolchainOptions.AdditionalIncludeDirs,
+ new string[0]);
+ })).
ConfigureAwait(false);
- crs.Add(r);
}
-#else
- var crs = await Task.WhenAll(
- sourceCodePaths.
- Select(sourceCodePath =>
+ else
+ {
+ logger.Information($"Building native library: {outputNativeArchiveFullPath}");
+
+ crs = new List();
+ foreach (var sourceCodePath in sourceCodePaths)
{
- logger.Trace($"Compiling source code: \"{sourceCodePath}\" ...");
- return ExecuteCompilerAsync(
+ logger.Trace($"Compiling source code: {sourceCodePath}");
+ var r = await ExecuteCompilerAsync(
sourceCodePath,
outputStagingBaseDirPath,
Path.GetFileNameWithoutExtension(sourceCodePath) + ".o",
@@ -253,10 +261,12 @@ await IOAccessor.SafeCreateDirectoryAsync(
true,
null,
toolchainOptions.AdditionalIncludeDirs,
- new string[0]);
- })).
- ConfigureAwait(false);
-#endif
+ new string[0]).
+ ConfigureAwait(false);
+ crs.Add(r);
+ }
+ }
+
var cr = crs.FirstOrDefault(r => r.ExitCode != 0);
if (cr.ExitCode != 0)
{
@@ -287,7 +297,7 @@ mainEntryPoint is { } &&
outputDirFullPath,
artifactPathOptions.OutputNativeExecutableFileName));
- logger.Information($"Linking native binary \"{outputNativeExecutableFullPath}\"");
+ logger.Information($"Linking native binary: {outputNativeExecutableFullPath}");
var mainSourceCodePath = Path.Combine(
outputDirFullPath,
@@ -324,7 +334,11 @@ mainEntryPoint is { } &&
throw new Exception($"{Path.GetFileName(toolchainOptions.NativeCompiler)}: {crf}");
}
- logger.Information($"Built native binary: \"{outputNativeExecutableFullPath}\" ...");
+ logger.Information($"Built native binary: {outputNativeExecutableFullPath}");
+ }
+ else
+ {
+ logger.Information($"Built native library: {outputNativeArchiveFullPath}");
}
}
}
diff --git a/src/IL2C.Core/Drivers/SimpleTranslator.cs b/src/IL2C.Core/Drivers/SimpleTranslator.cs
index 321f8ce0..e706da14 100644
--- a/src/IL2C.Core/Drivers/SimpleTranslator.cs
+++ b/src/IL2C.Core/Drivers/SimpleTranslator.cs
@@ -19,18 +19,18 @@ namespace IL2C.Drivers
{
public sealed class TranslationOptions
{
- public readonly bool ReadSymbols;
+ public readonly string[] ReferenceBasePaths;
public readonly bool EnableBundler;
public readonly TargetPlatforms TargetPlatform;
public readonly DebugInformationOptions DebugInformationOption;
public TranslationOptions(
- bool readSymbols,
+ string[] referenceBasePaths,
bool enableBundler,
TargetPlatforms targetPlatform,
DebugInformationOptions debugInformationOption)
{
- this.ReadSymbols = readSymbols;
+ this.ReferenceBasePaths = referenceBasePaths;
this.EnableBundler = enableBundler;
this.TargetPlatform = targetPlatform;
this.DebugInformationOption = debugInformationOption;
@@ -45,18 +45,18 @@ public static async ValueTask TranslateAsync(
TranslationOptions options,
string assemblyPath)
{
- logger.Information($"Preparing assembly: \"{Path.GetFullPath(assemblyPath)}\" ...");
+ logger.Information($"Preparing assembly: {Path.GetFullPath(assemblyPath)}");
await IOAccessor.SafeCreateDirectoryAsync(
storage.BasePath, true).
ConfigureAwait(false);
var translateContext = new TranslateContext(
- assemblyPath, options.ReadSymbols, options.TargetPlatform);
+ logger, assemblyPath, options.ReferenceBasePaths, options.TargetPlatform);
var preparedFunctions = AssemblyPreparer.Prepare(
translateContext);
- logger.Information($"Translating assembly: \"{Path.GetFullPath(assemblyPath)}\" ...");
+ logger.Information($"Translating assembly: {Path.GetFullPath(assemblyPath)}");
// TODO: Makes asynchronously operation.
@@ -78,7 +78,7 @@ await IOAccessor.SafeCreateDirectoryAsync(
options.DebugInformationOption);
}
- logger.Information($"Translated assembly: Stored into \"{Path.GetFullPath(storage.BasePath)}\"");
+ logger.Information($"Translated assembly: Stored into {Path.GetFullPath(storage.BasePath)}");
return translateContext.MetadataContext.EntryPoint;
}
diff --git a/src/IL2C.Core/IL2C.Core.csproj b/src/IL2C.Core/IL2C.Core.csproj
index 539be241..d9b2ad1f 100644
--- a/src/IL2C.Core/IL2C.Core.csproj
+++ b/src/IL2C.Core/IL2C.Core.csproj
@@ -1,7 +1,7 @@
- net462;net48;netstandard2.0;netstandard2.1;netcoreapp2.2;netcoreapp3.1;net5.0;net6.0
+ net462;net48;netstandard2.0;netstandard2.1;netcoreapp2.0;netcoreapp2.1;netcoreapp2.2;netcoreapp3.0;netcoreapp3.1;net5.0;net6.0
Library
IL2C.Core
diff --git a/src/IL2C.Core/Internal/IOAccessor.cs b/src/IL2C.Core/Internal/IOAccessor.cs
index d1f3fd77..ad2635be 100644
--- a/src/IL2C.Core/Internal/IOAccessor.cs
+++ b/src/IL2C.Core/Internal/IOAccessor.cs
@@ -43,45 +43,72 @@ public static string ToRelativePath(string baseDirPath, string path)
return candidate.Length >= 1 ? candidate : ".";
}
- public static string SafeGetDirectoryName(string path) =>
- Path.GetDirectoryName(path) ?? ".";
+ public static string GetDirectoryPath(string path) =>
+ Path.GetDirectoryName(path) switch
+ {
+ null => Path.DirectorySeparatorChar.ToString(),
+ { Length: 0 } => ".",
+ { } d => d,
+ };
- public static ValueTask SafeCreateDirectoryAsync(string path, bool clean) =>
- new ValueTask(Task.Run(() =>
+ public static ValueTask SafeCreateDirectoryAsync(string path, bool clean)
+ {
+ if (clean)
{
- if (clean)
+ return new ValueTask(Task.Run(() =>
{
try
{
Directory.Delete(path, true);
+ Directory.CreateDirectory(path);
}
catch
{
}
- }
+ }));
+ }
+ else
+ {
if (!Directory.Exists(path))
{
- try
- {
- Directory.CreateDirectory(path);
- }
- catch
+ return new ValueTask(Task.Run(() =>
{
- }
+ try
+ {
+ Directory.CreateDirectory(path);
+ }
+ catch
+ {
+ }
+ }));
}
- }));
+ else
+ {
+ return default;
+ }
+ }
+ }
-#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER
- public static ValueTask ReadAllTextAsync(string path, Encoding encoding) =>
- new ValueTask(File.ReadAllTextAsync(path, encoding));
- public static ValueTask WriteAllTextAsync(string path, string contents, Encoding encoding) =>
- new ValueTask(File.WriteAllTextAsync(path, contents, encoding));
-#else
- public static ValueTask ReadAllTextAsync(string path, Encoding encoding) =>
- new ValueTask(Task.Run(() => File.ReadAllText(path, encoding)));
- public static ValueTask WriteAllTextAsync(string path, string contents, Encoding encoding) =>
- new ValueTask(Task.Run(() => File.WriteAllText(path, contents, encoding)));
-#endif
+ public static async ValueTask ReadAllTextAsync(
+ string path, Encoding encoding)
+ {
+ using var fs = new FileStream(
+ path, FileMode.Open, FileAccess.Read, FileShare.Read, 65536, true);
+ var tr = new StreamReader(fs, encoding);
+
+ return await tr.ReadToEndAsync().ConfigureAwait(false);
+ }
+
+ public static async ValueTask WriteAllTextAsync(
+ string path, string contents, Encoding encoding)
+ {
+ using var fs = new FileStream(
+ path, FileMode.Create, FileAccess.ReadWrite, FileShare.None, 65536, true);
+ var tw = new StreamWriter(fs, encoding);
+
+ await tw.WriteAsync(contents).ConfigureAwait(false);
+ await tw.FlushAsync().ConfigureAwait(false);
+ }
public static async ValueTask ExecuteAsync(
string workingPath, string scriptName, string[] searchPaths,
diff --git a/src/IL2C.Core/Internal/SymbolManipulator.cs b/src/IL2C.Core/Internal/SymbolManipulator.cs
index d48a0238..aecb621b 100644
--- a/src/IL2C.Core/Internal/SymbolManipulator.cs
+++ b/src/IL2C.Core/Internal/SymbolManipulator.cs
@@ -48,6 +48,30 @@ public static string GetCLanguageScopedPath(IEnumerable scopeNames) =>
public static string GetCLanguageScopedPath(params string[] scopeNames) =>
GetCLanguageScopedPath((IEnumerable)scopeNames);
+ public static IEnumerable RenameDuplicatingSymbols(this IEnumerable names)
+ {
+ // symbol
+ // symbol2
+ // symbol3
+ // ...
+
+ var nameIndex = new Dictionary();
+ foreach (var name in names)
+ {
+ if (nameIndex.TryGetValue(name, out var index))
+ {
+ index++;
+ nameIndex[name] = index;
+ yield return name + index;
+ }
+ else
+ {
+ nameIndex[name] = 1;
+ yield return name;
+ }
+ }
+ }
+
public static string GetCLanguageTypeName(
Type type, string? symbolName = null, bool cArrayExpression = false)
{
diff --git a/src/IL2C.Core/Metadata/AssemblyResolver.cs b/src/IL2C.Core/Metadata/AssemblyResolver.cs
new file mode 100644
index 00000000..0c788fcd
--- /dev/null
+++ b/src/IL2C.Core/Metadata/AssemblyResolver.cs
@@ -0,0 +1,156 @@
+////////////////////////////////////////////////////////////////////////////
+//
+// IL2C - A translator for ECMA-335 CIL/MSIL to C language.
+// Copyright (c) Kouji Matsui (@kozy_kekyo, @kekyo@mastodon.cloud)
+//
+// Licensed under Apache-v2: https://opensource.org/licenses/Apache-2.0
+//
+////////////////////////////////////////////////////////////////////////////
+
+#nullable enable
+
+using System.IO;
+using System.Linq;
+
+using Mono.Cecil;
+using Mono.Cecil.Cil;
+using Mono.Cecil.Pdb;
+
+using IL2C.Internal;
+
+namespace IL2C.Metadata
+{
+ internal sealed class AssemblyResolver : DefaultAssemblyResolver
+ {
+ private sealed class SymbolReaderProvider : ISymbolReaderProvider
+ {
+ // HACK: cecil will lock symbol file when uses defaulted reading method.
+ // Makes safer around entire building process.
+
+ private static readonly PdbReaderProvider parent = new();
+
+ private readonly ILogger logger;
+
+ public SymbolReaderProvider(ILogger logger) =>
+ this.logger = logger;
+
+ public ISymbolReader? GetSymbolReader(ModuleDefinition module, string fileName)
+ {
+ if (module.HasDebugHeader)
+ {
+ var fullPath = Path.GetFullPath(fileName);
+
+ var header = module.GetDebugHeader();
+ if (header.Entries.
+ FirstOrDefault(e => e.Directory.Type == ImageDebugType.EmbeddedPortablePdb) is { } entry)
+ {
+ var sr = new EmbeddedPortablePdbReaderProvider().
+ GetSymbolReader(module, fileName);
+ this.logger.Trace($"Symbol loaded from: {fullPath}");
+ return sr;
+ }
+
+ var debuggingPath = Path.Combine(
+ IOAccessor.GetDirectoryPath(fullPath),
+ Path.GetFileNameWithoutExtension(fullPath) + ".pdb");
+
+ if (File.Exists(debuggingPath))
+ {
+ var ms = new MemoryStream();
+ using (var pdbStream = new FileStream(
+ debuggingPath, FileMode.Open, FileAccess.Read, FileShare.Read))
+ {
+ pdbStream.CopyTo(ms);
+ }
+ ms.Position = 0;
+
+ var sr = parent.GetSymbolReader(module, ms);
+ this.logger.Trace($"Symbol loaded from: {debuggingPath}");
+ return sr;
+ }
+ }
+
+ this.logger.Trace($"Symbol not found: {fileName}");
+ return null;
+ }
+
+ public ISymbolReader? GetSymbolReader(ModuleDefinition module, Stream symbolStream)
+ {
+ var ms = new MemoryStream();
+ symbolStream.CopyTo(ms);
+ ms.Position = 0;
+
+ symbolStream.Dispose();
+
+ return parent.GetSymbolReader(module, ms);
+ }
+ }
+
+ private readonly ILogger logger;
+
+ public AssemblyResolver(
+ ILogger logger, string targetBasePath, string[] referenceBasePaths)
+ {
+ this.logger = logger;
+
+ void Add(string path)
+ {
+ var fullPath = Path.GetFullPath(path);
+ base.AddSearchDirectory(fullPath);
+ this.logger.Trace($"Reference base path: {fullPath}");
+ }
+
+ Add(targetBasePath);
+
+ foreach (var referenceBasePath in referenceBasePaths)
+ {
+ Add(referenceBasePath);
+ }
+ }
+
+ public override AssemblyDefinition Resolve(AssemblyNameReference name)
+ {
+ var parameters = new ReaderParameters()
+ {
+ ReadWrite = false,
+ InMemory = true,
+ AssemblyResolver = this,
+ SymbolReaderProvider = new SymbolReaderProvider(this.logger),
+ ReadSymbols = true,
+ };
+ var ad = base.Resolve(name, parameters);
+ this.logger.Trace($"Assembly loaded: {ad.MainModule.FileName}");
+ return ad;
+ }
+
+ public AssemblyDefinition ReadAssemblyFrom(string assemblyPath)
+ {
+ var parameters = new ReaderParameters()
+ {
+ ReadWrite = false,
+ InMemory = true,
+ AssemblyResolver = this,
+ SymbolReaderProvider = new SymbolReaderProvider(this.logger),
+ ReadSymbols = true,
+ };
+ var ad = AssemblyDefinition.ReadAssembly(assemblyPath, parameters);
+ this.logger.Trace($"Assembly loaded: {ad.MainModule.FileName}");
+ return ad;
+ }
+
+ public ModuleDefinition ReadModuleFrom(string modulePath)
+ {
+ var parameters = new ReaderParameters()
+ {
+ ReadWrite = false,
+ InMemory = true,
+ AssemblyResolver = this,
+ SymbolReaderProvider = new SymbolReaderProvider(this.logger),
+ ReadSymbols = true,
+ };
+ var md = ModuleDefinition.ReadModule(modulePath, parameters);
+ this.logger.Trace($"Module loaded: {md.FileName}");
+ return md;
+ }
+ }
+}
diff --git a/src/IL2C.Core/Metadata/BasePathAssemblyResolver.cs b/src/IL2C.Core/Metadata/BasePathAssemblyResolver.cs
deleted file mode 100644
index 868a9b45..00000000
--- a/src/IL2C.Core/Metadata/BasePathAssemblyResolver.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// IL2C - A translator for ECMA-335 CIL/MSIL to C language.
-// Copyright (c) Kouji Matsui (@kozy_kekyo, @kekyo@mastodon.cloud)
-//
-// Licensed under Apache-v2: https://opensource.org/licenses/Apache-2.0
-//
-////////////////////////////////////////////////////////////////////////////
-
-using Mono.Cecil;
-
-namespace IL2C.Metadata
-{
- internal sealed class BasePathAssemblyResolver : DefaultAssemblyResolver
- {
- public BasePathAssemblyResolver(string basePath)
- {
- this.AddSearchDirectory(basePath);
- }
-
- public override AssemblyDefinition Resolve(AssemblyNameReference name)
- {
- var definition = base.Resolve(name);
- this.RegisterAssembly(definition);
- return definition;
- }
- }
-}
diff --git a/src/IL2C.Core/Metadata/MetadataContext.cs b/src/IL2C.Core/Metadata/MetadataContext.cs
index 94c3c9de..01662ba4 100644
--- a/src/IL2C.Core/Metadata/MetadataContext.cs
+++ b/src/IL2C.Core/Metadata/MetadataContext.cs
@@ -13,8 +13,10 @@
using System.Linq;
using Mono.Cecil;
+using Mono.Cecil.Pdb;
using IL2C.Metadata.Specialized;
+using System.Diagnostics;
namespace IL2C.Metadata
{
@@ -70,6 +72,8 @@ internal sealed class MetadataContext
private static readonly HashSet derivedFromMulticastDelegateValidTargetMethods =
new HashSet { ".ctor", "Invoke" };
+ private readonly ILogger logger;
+
private readonly AssemblyDefinition resolvedCoreAssembly;
private readonly ModuleDefinition resolvedCoreModule;
@@ -81,66 +85,65 @@ internal sealed class MetadataContext
new Dictionary(ModuleReferenceComparer.Instance);
private readonly Dictionary members =
new Dictionary(MemberReferenceComparer.Instance);
- private readonly BasePathAssemblyResolver resolver;
+ private readonly AssemblyResolver resolver;
- internal MetadataContext(string assemblyPath, bool readSymbols)
+ internal MetadataContext(
+ ILogger logger, string assemblyPath, string[] referenceBasePaths)
{
- resolver = new BasePathAssemblyResolver(Path.GetDirectoryName(assemblyPath));
- var assemblyReaderParameter = new ReaderParameters
- {
- AssemblyResolver = resolver,
- ReadSymbols = readSymbols
- };
+ this.logger = logger;
+
+ this.resolver = new AssemblyResolver(
+ this.logger, assemblyPath, referenceBasePaths);
- var mainAssembly = AssemblyDefinition.ReadAssembly(assemblyPath, assemblyReaderParameter);
+ var mainAssembly = this.resolver.ReadAssemblyFrom(assemblyPath);
var mainAssemblyInformation = new AssemblyInformation(mainAssembly, this);
- resolvedCoreModule = mainAssembly.MainModule.TypeSystem.Object.Resolve().Module;
- resolvedCoreAssembly = resolvedCoreModule.Assembly;
+ this.resolvedCoreModule = mainAssembly.MainModule.TypeSystem.Object.Resolve().Module;
+ this.resolvedCoreAssembly = this.resolvedCoreModule.Assembly;
var resolvedCoreAssemblyInformation = new AssemblyInformation(
- resolvedCoreAssembly, this);
+ this.resolvedCoreAssembly, this);
var resolvedCoreModuleInformation = new ModuleInformation(
- resolvedCoreModule, resolvedCoreAssemblyInformation);
+ this.resolvedCoreModule, resolvedCoreAssemblyInformation);
this.MainAssembly = mainAssemblyInformation;
- assemblies.Add(mainAssembly, mainAssemblyInformation);
- assemblies.Add(resolvedCoreAssembly, resolvedCoreAssemblyInformation);
- modules.Add(resolvedCoreModule, resolvedCoreModuleInformation);
- assemblyByModule.Add(resolvedCoreModule, resolvedCoreAssembly);
-
- this.VoidType = this.GetOrAddType(resolvedCoreModule.TypeSystem.Void);
- this.ObjectType = this.GetOrAddType(resolvedCoreModule.TypeSystem.Object);
- this.ValueTypeType = this.GetOrAddType(resolvedCoreModule.GetType("System.ValueType"));
- this.EnumType = this.GetOrAddType(resolvedCoreModule.GetType("System.Enum"));
- this.DelegateType = this.GetOrAddType(resolvedCoreModule.GetType("System.Delegate"));
- this.MulticastDelegateType = this.GetOrAddType(resolvedCoreModule.GetType("System.MulticastDelegate"));
- this.ArrayType = this.GetOrAddType(resolvedCoreModule.GetType("System.Array"));
- this.ExceptionType = this.GetOrAddType(resolvedCoreModule.GetType("System.Exception"));
-
- this.ByteType = this.GetOrAddType(resolvedCoreModule.TypeSystem.Byte);
- this.SByteType = this.GetOrAddType(resolvedCoreModule.TypeSystem.SByte);
- this.Int16Type = this.GetOrAddType(resolvedCoreModule.TypeSystem.Int16);
- this.UInt16Type = this.GetOrAddType(resolvedCoreModule.TypeSystem.UInt16);
- this.Int32Type = this.GetOrAddType(resolvedCoreModule.TypeSystem.Int32);
- this.UInt32Type = this.GetOrAddType(resolvedCoreModule.TypeSystem.UInt32);
- this.Int64Type = this.GetOrAddType(resolvedCoreModule.TypeSystem.Int64);
- this.UInt64Type = this.GetOrAddType(resolvedCoreModule.TypeSystem.UInt64);
- this.SingleType = this.GetOrAddType(resolvedCoreModule.TypeSystem.Single);
- this.DoubleType = this.GetOrAddType(resolvedCoreModule.TypeSystem.Double);
- this.IntPtrType = this.GetOrAddType(resolvedCoreModule.TypeSystem.IntPtr);
- this.UIntPtrType = this.GetOrAddType(resolvedCoreModule.TypeSystem.UIntPtr);
- this.CharType = this.GetOrAddType(resolvedCoreModule.TypeSystem.Char);
- this.StringType = this.GetOrAddType(resolvedCoreModule.TypeSystem.String);
- this.BooleanType = this.GetOrAddType(resolvedCoreModule.TypeSystem.Boolean);
-
- this.RuntimeFieldHandle = this.GetOrAddType(resolvedCoreModule.GetType("System.RuntimeFieldHandle"));
+ this.assemblies.Add(mainAssembly, mainAssemblyInformation);
+ this.assemblies.Add(this.resolvedCoreAssembly, resolvedCoreAssemblyInformation);
+ this.modules.Add(this.resolvedCoreModule, resolvedCoreModuleInformation);
+ this.assemblyByModule.Add(this.resolvedCoreModule, resolvedCoreAssembly);
+
+ this.VoidType = this.GetOrAddType(this.resolvedCoreModule.TypeSystem.Void);
+ this.ObjectType = this.GetOrAddType(this.resolvedCoreModule.TypeSystem.Object);
+ this.ValueTypeType = this.GetOrAddType(this.resolvedCoreModule.GetType("System.ValueType"));
+ this.EnumType = this.GetOrAddType(this.resolvedCoreModule.GetType("System.Enum"));
+ this.DelegateType = this.GetOrAddType(this.resolvedCoreModule.GetType("System.Delegate"));
+ this.MulticastDelegateType = this.GetOrAddType(this.resolvedCoreModule.GetType("System.MulticastDelegate"));
+ this.ArrayType = this.GetOrAddType(this.resolvedCoreModule.GetType("System.Array"));
+ this.ExceptionType = this.GetOrAddType(this.resolvedCoreModule.GetType("System.Exception"));
+
+ this.ByteType = this.GetOrAddType(this.resolvedCoreModule.TypeSystem.Byte);
+ this.SByteType = this.GetOrAddType(this.resolvedCoreModule.TypeSystem.SByte);
+ this.Int16Type = this.GetOrAddType(this.resolvedCoreModule.TypeSystem.Int16);
+ this.UInt16Type = this.GetOrAddType(this.resolvedCoreModule.TypeSystem.UInt16);
+ this.Int32Type = this.GetOrAddType(this.resolvedCoreModule.TypeSystem.Int32);
+ this.UInt32Type = this.GetOrAddType(this.resolvedCoreModule.TypeSystem.UInt32);
+ this.Int64Type = this.GetOrAddType(this.resolvedCoreModule.TypeSystem.Int64);
+ this.UInt64Type = this.GetOrAddType(this.resolvedCoreModule.TypeSystem.UInt64);
+ this.SingleType = this.GetOrAddType(this.resolvedCoreModule.TypeSystem.Single);
+ this.DoubleType = this.GetOrAddType(this.resolvedCoreModule.TypeSystem.Double);
+ this.IntPtrType = this.GetOrAddType(this.resolvedCoreModule.TypeSystem.IntPtr);
+ this.UIntPtrType = this.GetOrAddType(this.resolvedCoreModule.TypeSystem.UIntPtr);
+ this.CharType = this.GetOrAddType(this.resolvedCoreModule.TypeSystem.Char);
+ this.StringType = this.GetOrAddType(this.resolvedCoreModule.TypeSystem.String);
+ this.BooleanType = this.GetOrAddType(this.resolvedCoreModule.TypeSystem.Boolean);
+
+ this.RuntimeFieldHandle = this.GetOrAddType(this.resolvedCoreModule.GetType("System.RuntimeFieldHandle"));
this.EntryPoint = mainAssembly.EntryPoint is { } entryPoint ?
this.GetOrAddMethod(entryPoint) : null;
}
public IAssemblyInformation MainAssembly { get; }
- public IEnumerable Assemblies => assemblies.Values;
+ public IEnumerable Assemblies => this.assemblies.Values;
public IMethodInformation EntryPoint { get; }
@@ -272,16 +275,46 @@ internal TypeInformation GetOrAddType(
}
var module = this.GetOrAddModule(typeReference);
- if (typeReference.Module.Equals(resolvedCoreModule) &&
- validTargetMembers.TryGetValue(typeReference.FullName, out var filterList))
+ if (typeReference.Module.Assembly.FullName.Equals(resolvedCoreModule.Assembly.FullName))
+ {
+ if (validTargetMembers.TryGetValue(typeReference.FullName, out var filterList))
+ {
+ return new TypeInformation(typeReference, module, filterList);
+ }
+ }
+
+ // Excepts Corlib's COM interface (Such as _AppDomain, _Assembly, _Attribute ...)
+ var typeDefinition = typeReference.Resolve();
+ if (typeDefinition.Interfaces.
+ Where(ii =>
+ ii.InterfaceType.Module.Assembly.FullName.Equals(resolvedCoreModule.Assembly.FullName) &&
+ ii.InterfaceType.Name.StartsWith("_") &&
+ ii.InterfaceType.Resolve() is { } itd &&
+ itd.CustomAttributes.Any(ca =>
+ ca.AttributeType.FullName == "System.Runtime.InteropServices.ComVisibleAttribute" &&
+ ca.ConstructorArguments.Count == 1 &&
+ ca.ConstructorArguments[0].Value.Equals(true))).
+ Select(it => it.InterfaceType).
+ ToArray() is { } itfts &&
+ itfts.Length >= 1)
{
- return new TypeInformation(typeReference, module, filterList);
+ return new TypeInformation(typeReference, module, m =>
+ {
+ if (m is TypeReference tr &&
+ itfts.Any(itft => itft.FullName == tr.FullName))
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ });
}
// Special filter for the enum type.
if (typeReference.IsValueType && !typeReference.IsPrimitive && !typeReference.IsPointer)
{
- var typeDefinition = typeReference.Resolve();
if (typeDefinition.IsEnum)
{
return new TypeInformation(typeReference, module, m =>
@@ -304,17 +337,12 @@ internal TypeInformation GetOrAddType(
if (!typeReference.IsValueType && !typeReference.IsArray &&
!typeReference.IsByReference && !typeReference.IsPointer)
{
- var typeDefinition = typeReference.Resolve();
- // TODO: try to resolve typeDefinition from mscorelib
- if (typeDefinition == null)
- {
- throw new InvalidProgramSequenceException($"cannot resolve type {typeReference.FullName}");
- }
if (typeDefinition.IsClass && !typeDefinition.IsAbstract &&
MemberReferenceComparer.Instance.Equals(
typeDefinition.BaseType, ((TypeInformation)MulticastDelegateType).Member))
{
- return new TypeInformation(typeReference, module, derivedFromMulticastDelegateValidTargetMethods);
+ return new TypeInformation(
+ typeReference, module, derivedFromMulticastDelegateValidTargetMethods);
}
}
diff --git a/src/IL2C.Core/Metadata/MethodInformation.cs b/src/IL2C.Core/Metadata/MethodInformation.cs
index f1c03701..590ee3f3 100644
--- a/src/IL2C.Core/Metadata/MethodInformation.cs
+++ b/src/IL2C.Core/Metadata/MethodInformation.cs
@@ -59,10 +59,11 @@ public interface IMethodInformation : IMemberInformation
string CLanguageFunctionName { get; }
string CLanguageInteropName { get; }
string CLanguageFunctionPrototype { get; }
- string CLanguagePInvokePrototype { get; }
string CLanguageFunctionType { get; }
string CLanguageFunctionNamedType { get; }
string CLanguageFunctionFullNamedType { get; }
+
+ string GetCLanguageFunctionTypeWithVariableName(string name, bool isInterop);
}
internal sealed class MethodInformation
@@ -129,13 +130,18 @@ private IParameterInformation CreateThisParameterInformation(ITypeInformation th
thisType.IsValueType ? thisType.MakeByReference() : thisType,
emptyCustomAttribute);
- private IParameterInformation ToParameterInformation(ParameterReference parameter) =>
- new ParameterInformation(
+ private IParameterInformation ToParameterInformation(ParameterReference parameter)
+ {
+ var index = this.HasThis ?
+ (parameter.Index + 1) :
+ parameter.Index;
+ return new ParameterInformation(
this,
- this.HasThis ? (parameter.Index + 1) : parameter.Index,
- parameter.Name,
+ index,
+ string.IsNullOrWhiteSpace(parameter.Name) ? $"arg{index}__" : parameter.Name,
this.MetadataContext.GetOrAddType(parameter.ParameterType),
parameter.Resolve().CustomAttributes.ToArray());
+ }
public override string MetadataTypeName => "Method";
@@ -196,7 +202,7 @@ private IParameterInformation ToParameterInformation(ParameterReference paramete
Concat(this.Member.Parameters.Select(this.ToParameterInformation)).
ToArray() :
this.Member.Parameters.
- Select(ToParameterInformation).
+ Select(this.ToParameterInformation).
ToArray();
public ILocalVariableInformation[] LocalVariables =>
this.Definition.Body.Variables.
@@ -437,10 +443,12 @@ public string CLanguageFunctionPrototype
var parametersString = (this.Parameters.Length >= 1) ?
string.Join(
", ",
- this.Parameters.Select(parameter => string.Format(
+ this.Parameters.Select((parameter, index) => string.Format(
"{0} {1}",
parameter.TargetType.CLanguageTypeName,
- parameter.ParameterName))) :
+ string.IsNullOrWhiteSpace(parameter.ParameterName) ?
+ $"arg{(this.HasThis ? (index + 1) : index)}__" :
+ parameter.ParameterName))) :
"void";
var returnTypeName =
@@ -454,36 +462,6 @@ public string CLanguageFunctionPrototype
}
}
- public string CLanguagePInvokePrototype
- {
- // System.Int32 Foo.Bar.Baz.MooMethod(System.String name) --> int32_t MooMethod(const wchar_t* name)
- get
- {
- var parametersString = (this.Parameters.Length >= 1) ?
- string.Join(
- ", ",
- this.Parameters.Select(parameter => string.Format(
- "{0} {1}",
- parameter.TargetType.CLanguageInteropTypeName,
- parameter.ParameterName))) :
- "void";
-
- var returnTypeName =
- this.ReturnType.CLanguageInteropTypeName;
-
- var stdcallPostfix =
- (this.PInvokeInformation is PInvokeInfo pi && (pi.IsCallConvStdCall || pi.IsCallConvWinapi)) ?
- "IL2C_DLLIMPORT_STDCALL " : " ";
-
- return string.Format(
- "IL2C_DLLIMPORT_PREFIX {0} {1}{2}({3})",
- returnTypeName,
- stdcallPostfix,
- this.Definition.PInvokeInfo.EntryPoint,
- parametersString);
- }
- }
-
private enum CLanguageFunctionTypeFormats
{
Type,
@@ -491,46 +469,74 @@ private enum CLanguageFunctionTypeFormats
FullNamedType
}
- private string GetCLanguageFunctionType(CLanguageFunctionTypeFormats format)
+ private string GetCLanguageFunctionType(
+ CLanguageFunctionTypeFormats format,
+ bool isInterop,
+ string name = default)
{
- // The first argument (arg0) is switched type name by virtual attribute between strict type and "void*."
+ // The first argument (arg0) is switched type name by virtual attribute between strict type and "void*".
// non virtual : int32_t (*DoThat)(System_String* this__)
// virtual : int32_t (*DoThat)(void* this__)
+ string GetCLanguageTypeName(ITypeInformation type) =>
+ isInterop ? type.CLanguageInteropTypeName : type.CLanguageTypeName;
+
var parametersString = (this.Parameters.Length >= 1) ?
string.Join(
", ",
this.Parameters.Select((parameter, index) =>
- ((this.IsVirtual && (index == 0)) ? "void*" : parameter.TargetType.CLanguageTypeName) +
- ((format == CLanguageFunctionTypeFormats.Type) ? string.Empty : (" " + parameter.ParameterName)))) :
+ ((this.IsVirtual && (index == 0)) ?
+ "void*" : GetCLanguageTypeName(parameter.TargetType)) +
+ ((format == CLanguageFunctionTypeFormats.Type) ?
+ string.Empty :
+ string.IsNullOrWhiteSpace(parameter.ParameterName) ?
+ $" arg{(this.HasThis ? (index + 1) : index)}__" :
+ $" {parameter.ParameterName}"))) :
"void";
- var returnTypeName = this.ReturnType.CLanguageTypeName;
+ var returnTypeName = GetCLanguageTypeName(this.ReturnType);
+
+ var exactName = (name != null) ? name :
+ format switch
+ {
+ CLanguageFunctionTypeFormats.FullNamedType => this.CLanguageFunctionFullName,
+ CLanguageFunctionTypeFormats.NamedType => this.CLanguageFunctionName,
+ _ => string.Empty,
+ };
- var name = (format == CLanguageFunctionTypeFormats.FullNamedType) ?
- this.CLanguageFunctionFullName :
- (format == CLanguageFunctionTypeFormats.NamedType) ?
- this.CLanguageFunctionName :
+ var callingConvension = this.PInvokeInformation is PInvokeInfo pi ?
+ (pi.IsCallConvStdCall || pi.IsCallConvWinapi, pi.IsCallConvCdecl) switch
+ {
+ (true, _) => "IL2C_DLLIMPORT_STDCALL ",
+ (_, true) => "IL2C_DLLIMPORT_CDECL ",
+ _ => string.Empty,
+ } :
string.Empty;
return string.Format(
- "{0} (*{1})({2})",
+ "{0} ({1}*{2})({3})",
returnTypeName,
- name,
+ callingConvension,
+ exactName,
parametersString);
}
+ public string GetCLanguageFunctionTypeWithVariableName(string name, bool isInterop) =>
+ // !isInterop : System.Int32 Foo.Bar.Baz.MooMethod(System.String) --> int32_t (*name)(System_String*)
+ // isInterop : System.Int32 Foo.Bar.Baz.MooMethod(System.String) --> int32_t (*name)(const wchar_t*)
+ this.GetCLanguageFunctionType(CLanguageFunctionTypeFormats.Type, isInterop, name);
+
public string CLanguageFunctionType =>
// System.Int32 Foo.Bar.Baz.MooMethod(System.String) --> int32_t (*)(System_String*)
- this.GetCLanguageFunctionType(CLanguageFunctionTypeFormats.Type);
+ this.GetCLanguageFunctionType(CLanguageFunctionTypeFormats.Type, false);
public string CLanguageFunctionNamedType =>
// System.Int32 Foo.Bar.Baz.MooMethod(System.String) --> int32_t (*MooMethod__System_String)(System_String* this__)
- this.GetCLanguageFunctionType(CLanguageFunctionTypeFormats.NamedType);
+ this.GetCLanguageFunctionType(CLanguageFunctionTypeFormats.NamedType, false);
public string CLanguageFunctionFullNamedType =>
// System.Int32 Foo.Bar.Baz.MooMethod(System.String) --> int32_t (*Foo_Bar_Baz_MooMethod__System_String)(System_String* this__)
- this.GetCLanguageFunctionType(CLanguageFunctionTypeFormats.FullNamedType);
+ this.GetCLanguageFunctionType(CLanguageFunctionTypeFormats.FullNamedType, false);
protected override MethodDefinition OnResolve(MethodReference member) =>
member.Resolve();
diff --git a/src/IL2C.Core/Metadata/Specialized/BoxedValueTypeInformation.cs b/src/IL2C.Core/Metadata/Specialized/BoxedValueTypeInformation.cs
index 39115b9d..aafd3b51 100644
--- a/src/IL2C.Core/Metadata/Specialized/BoxedValueTypeInformation.cs
+++ b/src/IL2C.Core/Metadata/Specialized/BoxedValueTypeInformation.cs
@@ -31,6 +31,7 @@ public BoxedValueTypeInformation(ITypeInformation boxedType)
public string ScopeName => string.Empty;
public bool IsValidDefinition => false;
+ public bool IsIgnoreTranslation => false;
public bool IsPublic => false;
public bool IsNotPublic => false;
diff --git a/src/IL2C.Core/Metadata/Specialized/UntypedReferenceTypeInformation.cs b/src/IL2C.Core/Metadata/Specialized/UntypedReferenceTypeInformation.cs
index 3e4be701..b7def1b6 100644
--- a/src/IL2C.Core/Metadata/Specialized/UntypedReferenceTypeInformation.cs
+++ b/src/IL2C.Core/Metadata/Specialized/UntypedReferenceTypeInformation.cs
@@ -31,6 +31,7 @@ private UntypedReferenceTypeInformation()
public string ScopeName => string.Empty;
public bool IsValidDefinition => false;
+ public bool IsIgnoreTranslation => false;
public bool IsPublic => false;
public bool IsNotPublic => false;
diff --git a/src/IL2C.Core/Metadata/TypeInformation.cs b/src/IL2C.Core/Metadata/TypeInformation.cs
index 42cef416..22e85d1d 100644
--- a/src/IL2C.Core/Metadata/TypeInformation.cs
+++ b/src/IL2C.Core/Metadata/TypeInformation.cs
@@ -24,6 +24,8 @@ public interface ITypeInformation : IMemberInformation
{
string ScopeName { get; }
+ bool IsIgnoreTranslation { get; }
+
bool IsPublic { get; }
bool IsNotPublic { get; }
bool IsNestedPublic { get; }
@@ -219,6 +221,11 @@ public override string AttributeDescription
}
}
+ public bool IsIgnoreTranslation =>
+ this.Definition is TypeDefinition definition &&
+ definition.CustomAttributes.
+ Any(ca => ca.AttributeType.FullName == "System.Runtime.InteropServices.IgnoreTranslationAttribute");
+
public bool IsPublic => (this.Definition as TypeDefinition)?.IsPublic ?? false;
public bool IsNotPublic => (this.Definition as TypeDefinition)?.IsNotPublic ?? false;
public bool IsNestedPublic => (this.Definition as TypeDefinition)?.IsNestedPublic ?? false;
@@ -353,7 +360,10 @@ public bool IsReferenceType
public bool IsRequiredTraverse =>
(this.Member.IsValueType &&
!this.Member.IsPrimitive && !this.Member.IsPointer && !this.IsByReference && !this.IsEnum &&
- this.Fields.Any(f => f.FieldType.IsRequiredTraverse)) ||
+ this.Fields.
+ // Recursive check stopping condition: #105
+ Where(f => f.FieldType.FriendlyName != this.FriendlyName).
+ Any(f => f.FieldType.IsRequiredTraverse)) ||
this.IsReferenceType;
private static int InternalGetStaticSizeOfValue(ITypeInformation type) =>
@@ -412,6 +422,7 @@ public ITypeInformation ElementType
null;
}
}
+
public ITypeInformation[] InterfaceTypes
{
get
diff --git a/src/IL2C.Core/TranslateContext.cs b/src/IL2C.Core/TranslateContext.cs
index e369cc98..23e95265 100644
--- a/src/IL2C.Core/TranslateContext.cs
+++ b/src/IL2C.Core/TranslateContext.cs
@@ -29,6 +29,8 @@ public sealed class TranslateContext
: IPrepareContext, IExtractContextHost
{
#region Fields
+ private readonly ILogger logger;
+
private readonly Dictionary> registeredTypes =
new Dictionary>();
private readonly Dictionary> registeredTypesByDeclaringType =
@@ -44,9 +46,17 @@ public sealed class TranslateContext
private string currentExceptionNestedFrameIndexName;
#endregion
- public TranslateContext(string assemblyPath, bool readSymbols, TargetPlatforms targetPlatform)
+ public TranslateContext(
+ ILogger logger,
+ string assemblyPath,
+ string[] referenceBasePath,
+ TargetPlatforms targetPlatform)
{
- var context = new MetadataContext(assemblyPath, readSymbols);
+ this.logger = logger;
+
+ var context = new MetadataContext(
+ this.logger, assemblyPath, referenceBasePath);
+
this.MetadataContext = context;
this.Assembly = context.MainAssembly;
this.TargetPlatform = targetPlatform;
diff --git a/src/IL2C.Core/Writers/FunctionWriter.cs b/src/IL2C.Core/Writers/FunctionWriter.cs
index ed435bdc..edb78a7d 100644
--- a/src/IL2C.Core/Writers/FunctionWriter.cs
+++ b/src/IL2C.Core/Writers/FunctionWriter.cs
@@ -44,21 +44,28 @@ private static void InternalConvertExecutionFrame(
if (objRefEntries.Length >= 1)
{
tw.WriteLine("//-------------------- objref");
- foreach (var objRefEntry in objRefEntries)
+ var objrefNames = objRefEntries.
+ Select(oe => extractContext.GetSymbolName(oe)).
+ RenameDuplicatingSymbols();
+ foreach (var (objRefEntry, name) in
+ objRefEntries.Zip(objrefNames, (oe, on) => (oe, on)))
{
tw.WriteLine(
"{0} {1};",
objRefEntry.TargetType.CLanguageTypeName,
- extractContext.GetSymbolName(objRefEntry));
+ name);
}
}
if (valueEntries.Length >= 1)
{
tw.WriteLine("//-------------------- value type");
- foreach (var valueEntry in valueEntries)
+ var valueNames = valueEntries.
+ Select(ve => extractContext.GetSymbolName(ve)).
+ RenameDuplicatingSymbols();
+ foreach (var (valueEntry, name) in
+ valueEntries.Zip(valueNames, (ve, vn) => (ve, vn)))
{
- var name = extractContext.GetSymbolName(valueEntry);
tw.WriteLine(
"const IL2C_RUNTIME_TYPE {0}_type__;",
name);
@@ -274,10 +281,12 @@ private static void InternalConvertFromFunction(
tw.WriteLine("// [3-3] Local variables (!objref):");
tw.SplitLine();
- foreach (var local in localDefinitions)
+ var localNames = localDefinitions.
+ Select(local => extractContext.GetSymbolName(local)).
+ RenameDuplicatingSymbols();
+ foreach (var (local, name) in localDefinitions.
+ Zip(localNames, (local, name) => (local, name)))
{
- var name = extractContext.GetSymbolName(local);
-
// HACK: The local variables mark to "volatile."
// Because the gcc misread these variables calculated statically (or maybe assigned to the registers)
// at compile time with optimization.
@@ -617,19 +626,6 @@ private static void InternalConvertFromAbstractFunction(
tw.SplitLine();
}
- private static string GetMarshaledInExpression(IParameterInformation parameter)
- {
- // TODO: UTF8 conversion
- // TODO: Apply MarshalAsAttribute
-
- if (parameter.TargetType.IsStringType)
- {
- return string.Format("{0}->string_body__", parameter.ParameterName);
- }
-
- return parameter.ParameterName;
- }
-
private static void InternalConvertFromInternalCallFunction(
CodeTextWriter tw,
IMethodInformation method)
@@ -643,46 +639,65 @@ private static void InternalConvertFromInternalCallFunction(
method.FriendlyName);
tw.SplitLine();
- // P/Invoke linkage doesn't verify the C header declarations.
- // It will lookp up by the library symbol name.
- if (method.PInvokeInformation != null)
- {
- tw.WriteLine(
- "extern {0};",
- method.CLanguagePInvokePrototype);
- tw.SplitLine();
- }
-
- if (method.IsPrivate)
- {
- tw.WriteLine("static inline {0}", method.CLanguageFunctionPrototype);
- }
- else
- {
- tw.WriteLine(method.CLanguageFunctionPrototype);
- }
+ tw.WriteLine(method.CLanguageFunctionPrototype);
tw.WriteLine("{");
using (var _ = tw.Shift())
{
+ static string GetMarshaledInExpression(IParameterInformation parameter)
+ {
+ // TODO: UTF8 conversion
+ // TODO: Apply MarshalAsAttribute
+
+ if (parameter.TargetType.IsStringType)
+ {
+ return string.Format("{0}->string_body__", parameter.ParameterName);
+ }
+ return parameter.ParameterName;
+ }
+
var arguments = string.Join(
", ",
method.Parameters.Select(GetMarshaledInExpression));
- if (method.ReturnType.IsVoidType)
+ if (method.PInvokeInformation != null)
{
+ // TODO: caching
tw.WriteLine(
- "{0}({1});",
- method.CLanguageInteropName,
- arguments);
+ "{0} = il2c_pinvoke_get_function__(\"{1}\", \"{2}\");",
+ method.GetCLanguageFunctionTypeWithVariableName("pFunc__", true),
+ method.PInvokeInformation.Module.Name,
+ method.CLanguageInteropName);
+ if (method.ReturnType.IsVoidType)
+ {
+ tw.WriteLine(
+ "(*pFunc__)({0});",
+ arguments);
+ }
+ else
+ {
+ tw.WriteLine(
+ "return (*pFunc__)({0});",
+ arguments);
+ }
}
else
{
- tw.WriteLine(
- "return {0}({1});",
- method.CLanguageInteropName,
- arguments);
+ if (method.ReturnType.IsVoidType)
+ {
+ tw.WriteLine(
+ "{0}({1});",
+ method.CLanguageInteropName,
+ arguments);
+ }
+ else
+ {
+ tw.WriteLine(
+ "return {0}({1});",
+ method.CLanguageInteropName,
+ arguments);
+ }
}
}
diff --git a/src/IL2C.Core/Writers/SourceCodeWriter.cs b/src/IL2C.Core/Writers/SourceCodeWriter.cs
index 4e8dbda9..b8f01ae8 100644
--- a/src/IL2C.Core/Writers/SourceCodeWriter.cs
+++ b/src/IL2C.Core/Writers/SourceCodeWriter.cs
@@ -252,6 +252,10 @@ private static void InternalWriteSourceCode(
twSource.SplitLine();
}
+ twSource.WriteLine("//////////////////////////////////////////////////////////////////////////////////");
+ twSource.WriteLine("// [9-4] Static fields:");
+ twSource.SplitLine();
+
// Generate static fileds
foreach (var field in otherStaticFields)
{
@@ -274,6 +278,10 @@ private static void InternalWriteSourceCode(
}
twSource.SplitLine();
+ twSource.WriteLine("//////////////////////////////////////////////////////////////////////////////////");
+ twSource.WriteLine("// [9-5] Type initializer handler:");
+ twSource.SplitLine();
+
// Generate type initializer function
var typeInitializerBodyName =
type.MangledUniqueName + "__TryIntialize__";
@@ -294,6 +302,10 @@ private static void InternalWriteSourceCode(
twSource.WriteLine("}");
twSource.SplitLine();
+ twSource.WriteLine("//////////////////////////////////////////////////////////////////////////////////");
+ twSource.WriteLine("// [9-6] Static field access handlers:");
+ twSource.SplitLine();
+
// Generate filed access handlers
foreach (var field in staticFields)
{
@@ -339,7 +351,7 @@ private static void InternalWriteSourceCode(
}
twSource.WriteLine("//////////////////////////////////////////////////////////////////////////////////");
- twSource.WriteLine("// [9-4] Type: {0}", type.FriendlyName);
+ twSource.WriteLine("// [9-7] Type: {0}", type.FriendlyName);
twSource.SplitLine();
// All methods and constructor exclude type initializer
diff --git a/src/IL2C.Core/Writers/TypeWriter.cs b/src/IL2C.Core/Writers/TypeWriter.cs
index 4d200d94..b8cc2498 100644
--- a/src/IL2C.Core/Writers/TypeWriter.cs
+++ b/src/IL2C.Core/Writers/TypeWriter.cs
@@ -11,6 +11,7 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
+
using IL2C.Internal;
using IL2C.Metadata;
@@ -358,14 +359,6 @@ public static void WriteMemberDefinitions(
"static {0};",
method.CLanguageFunctionPrototype);
}
- // Make inlining private interop methods
- else if (method.IsExtern && method.IsPrivate)
- {
- tw.WriteLine(
- "static inline /* {0} */ {1};",
- method.AttributeDescription,
- method.CLanguageFunctionPrototype);
- }
else
{
tw.WriteLine(
diff --git a/src/IL2C.Interop/IL2CServices.cs b/src/IL2C.Interop/IL2CServices.cs
new file mode 100644
index 00000000..12a1c3c1
--- /dev/null
+++ b/src/IL2C.Interop/IL2CServices.cs
@@ -0,0 +1,16 @@
+////////////////////////////////////////////////////////////////////////////
+//
+// IL2C - A translator for ECMA-335 CIL/MSIL to C language.
+// Copyright (c) Kouji Matsui (@kozy_kekyo, @kekyo@mastodon.cloud)
+//
+// Licensed under Apache-v2: https://opensource.org/licenses/Apache-2.0
+//
+////////////////////////////////////////////////////////////////////////////
+
+namespace System.Runtime.InteropServices
+{
+ public static class IL2CServices
+ {
+ public static bool IsInNativeExecution => false;
+ }
+}
diff --git a/src/IL2C.Interop/IgnoreTranslationAttribute.cs b/src/IL2C.Interop/IgnoreTranslationAttribute.cs
new file mode 100644
index 00000000..00684568
--- /dev/null
+++ b/src/IL2C.Interop/IgnoreTranslationAttribute.cs
@@ -0,0 +1,19 @@
+////////////////////////////////////////////////////////////////////////////
+//
+// IL2C - A translator for ECMA-335 CIL/MSIL to C language.
+// Copyright (c) Kouji Matsui (@kozy_kekyo, @kekyo@mastodon.cloud)
+//
+// Licensed under Apache-v2: https://opensource.org/licenses/Apache-2.0
+//
+////////////////////////////////////////////////////////////////////////////
+
+namespace System.Runtime.InteropServices
+{
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface | AttributeTargets.Enum | AttributeTargets.Delegate, AllowMultiple=false, Inherited=false)]
+ public sealed class IgnoreTranslationAttribute : Attribute
+ {
+ public IgnoreTranslationAttribute()
+ {
+ }
+ }
+}
diff --git a/src/IL2C.Runtime/include/System.Threading.Thread.h b/src/IL2C.Runtime/include/System.Threading.Thread.h
new file mode 100644
index 00000000..894d95ad
--- /dev/null
+++ b/src/IL2C.Runtime/include/System.Threading.Thread.h
@@ -0,0 +1,17 @@
+////////////////////////////////////////////////////////////////////////////
+//
+// IL2C - A translator for ECMA-335 CIL/MSIL to C language.
+// Copyright (c) Kouji Matsui (@kozy_kekyo, @kekyo@mastodon.cloud)
+//
+// Licensed under Apache-v2: https://opensource.org/licenses/Apache-2.0
+//
+////////////////////////////////////////////////////////////////////////////
+
+#ifndef System_Threading_Thread_dll_H__
+#define System_Threading_Thread_dll_H__
+
+#pragma once
+
+#include
+
+#endif
diff --git a/src/IL2C.Runtime/include/System.Threading.h b/src/IL2C.Runtime/include/System.Threading.h
new file mode 100644
index 00000000..41bd7124
--- /dev/null
+++ b/src/IL2C.Runtime/include/System.Threading.h
@@ -0,0 +1,17 @@
+////////////////////////////////////////////////////////////////////////////
+//
+// IL2C - A translator for ECMA-335 CIL/MSIL to C language.
+// Copyright (c) Kouji Matsui (@kozy_kekyo, @kekyo@mastodon.cloud)
+//
+// Licensed under Apache-v2: https://opensource.org/licenses/Apache-2.0
+//
+////////////////////////////////////////////////////////////////////////////
+
+#ifndef System_Threading_dll_H__
+#define System_Threading_dll_H__
+
+#pragma once
+
+#include
+
+#endif
diff --git a/src/IL2C.Runtime/include/System/Attribute.h b/src/IL2C.Runtime/include/System/Attribute.h
new file mode 100644
index 00000000..6bf0fc29
--- /dev/null
+++ b/src/IL2C.Runtime/include/System/Attribute.h
@@ -0,0 +1,44 @@
+////////////////////////////////////////////////////////////////////////////
+//
+// IL2C - A translator for ECMA-335 CIL/MSIL to C language.
+// Copyright (c) Kouji Matsui (@kozy_kekyo, @kekyo@mastodon.cloud)
+//
+// Licensed under Apache-v2: https://opensource.org/licenses/Apache-2.0
+//
+////////////////////////////////////////////////////////////////////////////
+
+#ifndef System_Attribute_H__
+#define System_Attribute_H__
+
+#pragma once
+
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/////////////////////////////////////////////////////////////
+// System.Attribute
+
+typedef struct System_Attribute System_Attribute;
+typedef System_Object_VTABLE_DECL__ System_Attribute_VTABLE_DECL__;
+
+struct System_Attribute
+{
+ System_Attribute_VTABLE_DECL__* vptr0__;
+};
+
+#define System_Attribute_VTABLE__ System_Object_VTABLE__
+
+IL2C_DECLARE_RUNTIME_TYPE(System_Attribute);
+
+static inline void System_Attribute__ctor(System_Attribute* this__)
+{
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/src/IL2C.Runtime/include/System/IO/FileNotFoundException.h b/src/IL2C.Runtime/include/System/IO/FileNotFoundException.h
new file mode 100644
index 00000000..61366245
--- /dev/null
+++ b/src/IL2C.Runtime/include/System/IO/FileNotFoundException.h
@@ -0,0 +1,46 @@
+////////////////////////////////////////////////////////////////////////////
+//
+// IL2C - A translator for ECMA-335 CIL/MSIL to C language.
+// Copyright (c) Kouji Matsui (@kozy_kekyo, @kekyo@mastodon.cloud)
+//
+// Licensed under Apache-v2: https://opensource.org/licenses/Apache-2.0
+//
+////////////////////////////////////////////////////////////////////////////
+
+#ifndef System_IO_FileNotFoundException_H__
+#define System_IO_FileNotFoundException_H__
+
+#pragma once
+
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/////////////////////////////////////////////////////////////
+// System.IO.IOException
+
+typedef System_IO_IOException System_IO_FileNotFoundException;
+
+typedef System_IO_IOException_VTABLE_DECL__ System_IO_FileNotFoundException_VTABLE_DECL__;
+
+#define System_IO_FileNotFoundException_VTABLE__ System_IO_IOException_VTABLE__
+
+IL2C_DECLARE_RUNTIME_TYPE(System_IO_FileNotFoundException);
+
+static inline void System_IO_FileNotFoundException__ctor(System_IO_FileNotFoundException* this__)
+{
+ System_IO_IOException__ctor((System_IO_IOException*)this__);
+}
+
+static inline void System_IO_FileNotFoundException__ctor__System_String(System_IO_FileNotFoundException* this__, System_String* message)
+{
+ System_IO_IOException__ctor__System_String((System_IO_IOException*)this__, message);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/src/IL2C.Runtime/include/System/IO/IOException.h b/src/IL2C.Runtime/include/System/IO/IOException.h
new file mode 100644
index 00000000..0451c58e
--- /dev/null
+++ b/src/IL2C.Runtime/include/System/IO/IOException.h
@@ -0,0 +1,46 @@
+////////////////////////////////////////////////////////////////////////////
+//
+// IL2C - A translator for ECMA-335 CIL/MSIL to C language.
+// Copyright (c) Kouji Matsui (@kozy_kekyo, @kekyo@mastodon.cloud)
+//
+// Licensed under Apache-v2: https://opensource.org/licenses/Apache-2.0
+//
+////////////////////////////////////////////////////////////////////////////
+
+#ifndef System_IO_IOException_H__
+#define System_IO_IOException_H__
+
+#pragma once
+
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/////////////////////////////////////////////////////////////
+// System.IO.IOException
+
+typedef System_SystemException System_IO_IOException;
+
+typedef System_SystemException_VTABLE_DECL__ System_IO_IOException_VTABLE_DECL__;
+
+#define System_IO_IOException_VTABLE__ System_SystemException_VTABLE__
+
+IL2C_DECLARE_RUNTIME_TYPE(System_IO_IOException);
+
+static inline void System_IO_IOException__ctor(System_IO_IOException* this__)
+{
+ System_SystemException__ctor((System_SystemException*)this__);
+}
+
+static inline void System_IO_IOException__ctor__System_String(System_IO_IOException* this__, System_String* message)
+{
+ System_SystemException__ctor__System_String((System_SystemException*)this__, message);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/src/IL2C.Runtime/include/System/IntPtr.h b/src/IL2C.Runtime/include/System/IntPtr.h
index c6b12ac5..07a833fa 100644
--- a/src/IL2C.Runtime/include/System/IntPtr.h
+++ b/src/IL2C.Runtime/include/System/IntPtr.h
@@ -38,6 +38,11 @@ extern const intptr_t System_IntPtr_Zero;
extern intptr_t* System_IntPtr_Zero_REF__;
+#define System_IntPtr_ToInt32(this__) ((int32_t)*(this__))
+#define System_IntPtr_ToInt64(this__) ((int64_t)*(this__))
+
+#define System_IntPtr_get_Size() ((int32_t)sizeof(intptr_t))
+
#define System_IntPtr_op_Explicit__System_Int32(value) ((intptr_t)(value))
#define System_IntPtr_op_Explicit__System_Int64(value) ((intptr_t)(value))
#define System_IntPtr_op_Addition__System_IntPtr_System_Int32(lhs, rhs) (((intptr_t)(lhs)) + ((intptr_t)(rhs)))
diff --git a/src/IL2C.Runtime/include/System/NotImplementedException.h b/src/IL2C.Runtime/include/System/NotImplementedException.h
new file mode 100644
index 00000000..b8ac2169
--- /dev/null
+++ b/src/IL2C.Runtime/include/System/NotImplementedException.h
@@ -0,0 +1,46 @@
+////////////////////////////////////////////////////////////////////////////
+//
+// IL2C - A translator for ECMA-335 CIL/MSIL to C language.
+// Copyright (c) Kouji Matsui (@kozy_kekyo, @kekyo@mastodon.cloud)
+//
+// Licensed under Apache-v2: https://opensource.org/licenses/Apache-2.0
+//
+////////////////////////////////////////////////////////////////////////////
+
+#ifndef System_NotImplementedException_H__
+#define System_NotImplementedException_H__
+
+#pragma once
+
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/////////////////////////////////////////////////////////////
+// System.NotImplementedException
+
+typedef System_SystemException System_NotImplementedException;
+
+typedef System_SystemException_VTABLE_DECL__ System_NotImplementedException_VTABLE_DECL__;
+
+#define System_NotImplementedException_VTABLE__ System_SystemException_VTABLE__
+
+IL2C_DECLARE_RUNTIME_TYPE(System_NotImplementedException);
+
+static inline void System_NotImplementedException__ctor(System_NotImplementedException* this__)
+{
+ System_SystemException__ctor((System_SystemException*)this__);
+}
+
+static inline void System_NotImplementedException__ctor__System_String(System_NotImplementedException* this__, System_String* message)
+{
+ System_SystemException__ctor__System_String((System_SystemException*)this__, message);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/src/IL2C.Runtime/include/System/Runtime/InteropServices/IL2CServices.h b/src/IL2C.Runtime/include/System/Runtime/InteropServices/IL2CServices.h
new file mode 100644
index 00000000..04d19f9c
--- /dev/null
+++ b/src/IL2C.Runtime/include/System/Runtime/InteropServices/IL2CServices.h
@@ -0,0 +1,32 @@
+////////////////////////////////////////////////////////////////////////////
+//
+// IL2C - A translator for ECMA-335 CIL/MSIL to C language.
+// Copyright (c) Kouji Matsui (@kozy_kekyo, @kekyo@mastodon.cloud)
+//
+// Licensed under Apache-v2: https://opensource.org/licenses/Apache-2.0
+//
+////////////////////////////////////////////////////////////////////////////
+
+#ifndef System_Runtime_InteropServices_IL2CServices_H__
+#define System_Runtime_InteropServices_IL2CServices_H__
+
+#pragma once
+
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/////////////////////////////////////////////////////////////
+// System.Runtime.InteropServices.IL2CServices
+
+IL2C_DECLARE_RUNTIME_TYPE(System_Runtime_InteropServices_IL2CServices);
+
+#define System_Runtime_InteropServices_IL2CServices_get_IsInNativeExecution() (true)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/src/IL2C.Runtime/include/System/SystemException.h b/src/IL2C.Runtime/include/System/SystemException.h
new file mode 100644
index 00000000..0c474627
--- /dev/null
+++ b/src/IL2C.Runtime/include/System/SystemException.h
@@ -0,0 +1,46 @@
+////////////////////////////////////////////////////////////////////////////
+//
+// IL2C - A translator for ECMA-335 CIL/MSIL to C language.
+// Copyright (c) Kouji Matsui (@kozy_kekyo, @kekyo@mastodon.cloud)
+//
+// Licensed under Apache-v2: https://opensource.org/licenses/Apache-2.0
+//
+////////////////////////////////////////////////////////////////////////////
+
+#ifndef System_SystemException_H__
+#define System_SystemException_H__
+
+#pragma once
+
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/////////////////////////////////////////////////////////////
+// System.SystemException
+
+typedef System_Exception System_SystemException;
+
+typedef System_Exception_VTABLE_DECL__ System_SystemException_VTABLE_DECL__;
+
+#define System_SystemException_VTABLE__ System_Exception_VTABLE__
+
+IL2C_DECLARE_RUNTIME_TYPE(System_SystemException);
+
+static inline void System_SystemException__ctor(System_SystemException* this__)
+{
+ System_Exception__ctor((System_Exception*)this__);
+}
+
+static inline void System_SystemException__ctor__System_String(System_SystemException* this__, System_String* message)
+{
+ System_Exception__ctor__System_String((System_Exception*)this__, message);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/src/IL2C.Runtime/include/System/UIntPtr.h b/src/IL2C.Runtime/include/System/UIntPtr.h
index 7e01a3a8..27c9aea3 100644
--- a/src/IL2C.Runtime/include/System/UIntPtr.h
+++ b/src/IL2C.Runtime/include/System/UIntPtr.h
@@ -34,6 +34,11 @@ extern /* virtual */ int32_t System_UIntPtr_GetHashCode(uintptr_t* this__);
extern bool System_UIntPtr_Equals__System_UIntPtr(uintptr_t* this__, uintptr_t obj);
extern /* virtual */ bool System_UIntPtr_Equals__System_Object(uintptr_t* this__, System_Object* obj);
+#define System_UIntPtr_ToUInt32(this__) ((uint32_t)*(this__))
+#define System_UIntPtr_ToUInt64(this__) ((uint64_t)*(this__))
+
+#define System_UIntPtr_get_Size() ((int32_t)sizeof(uintptr_t))
+
#define System_UIntPtr_op_Explicit__System_UInt32(value) ((uintptr_t)(value))
#define System_UIntPtr_op_Explicit__System_UInt64(value) ((uintptr_t)(value))
#define System_UIntPtr_op_Addition__System_UIntPtr_System_Int32(lhs, rhs) (((uintptr_t)(lhs)) + ((uintptr_t)(rhs)))
diff --git a/src/IL2C.Runtime/include/il2c.h b/src/IL2C.Runtime/include/il2c.h
index 42893774..178b50f2 100644
--- a/src/IL2C.Runtime/include/il2c.h
+++ b/src/IL2C.Runtime/include/il2c.h
@@ -22,15 +22,20 @@ extern "C" {
#if defined(_MSC_VER)
+#if defined(_WIN32)
+#define IL2C_DLLIMPORT_STDCALL __stdcall
+#define IL2C_DLLIMPORT_CDECL __cdecl
+#else
+#define IL2C_DLLIMPORT_STDCALL
+#define IL2C_DLLIMPORT_CDECL
+#endif
+
#if defined(_WDM) || defined(UEFI)
#undef _WIN32
#endif
#include
-#define IL2C_DLLIMPORT_PREFIX __declspec(dllimport)
-#define IL2C_DLLIMPORT_STDCALL __stdcall
-
#define il2c_assume__(expr) __assume(expr)
#define il2c_likely__(expr) (expr)
#define il2c_unlikely__(expr) (expr)
@@ -38,6 +43,14 @@ extern "C" {
#elif defined(__GNUC__)
+#if defined(_WIN32)
+#define IL2C_DLLIMPORT_STDCALL __stdcall
+#define IL2C_DLLIMPORT_CDECL __cdecl
+#else
+#define IL2C_DLLIMPORT_STDCALL
+#define IL2C_DLLIMPORT_CDECL
+#endif
+
#if defined(__x86_64__) || defined(__i386__)
#include
#elif defined(__ARM_NEON__)
@@ -46,14 +59,6 @@ extern "C" {
#include
#endif
-#define IL2C_DLLIMPORT_PREFIX
-
-#if defined(_WIN32)
-#define IL2C_DLLIMPORT_STDCALL __stdcall
-#else
-#define IL2C_DLLIMPORT_STDCALL
-#endif
-
#define il2c_assume__(expr) do { if (!(expr)) __builtin_unreachable(); } while (0)
#define il2c_likely__(expr) __builtin_expect(!!(expr), 1)
#define il2c_unlikely__(expr) __builtin_expect(!!(expr), 0)
@@ -61,8 +66,8 @@ extern "C" {
#else
-#define IL2C_DLLIMPORT_PREFIX
#define IL2C_DLLIMPORT_STDCALL
+#define IL2C_DLLIMPORT_CDECL
#define il2c_assume__(expr) ((void)0)
#define il2c_likely__(expr) (expr)
@@ -380,6 +385,7 @@ typedef void* untyped_ptr;
#include "System/Enum.h"
#include "System/Delegate.h"
#include "System/MulticastDelegate.h"
+#include "System/Attribute.h"
#include "System/RuntimeFieldHandle.h"
#include "System/Runtime/CompilerServices/RuntimeHelpers.h"
#include "System/Exception.h"
@@ -393,6 +399,7 @@ typedef void* untyped_ptr;
#include "System/Runtime/InteropServices/GCHandleType.h"
#include "System/Runtime/InteropServices/GCHandle.h"
#include "System/Runtime/InteropServices/NativePointer.h"
+#include "System/Runtime/InteropServices/IL2CServices.h"
#include "System/IDisposable.h"
#include "System/Threading/Interlocked.h"
#include "System/Threading/Monitor.h"
@@ -403,6 +410,10 @@ typedef void* untyped_ptr;
#include "System/UnhandledExceptionEventArgs.h"
#include "System/UnhandledExceptionEventHandler.h"
#include "System/AppDomain.h"
+#include "System/SystemException.h"
+#include "System/NotImplementedException.h"
+#include "System/IO/IOException.h"
+#include "System/IO/FileNotFoundException.h"
// Independent types for IL2C core.
#include "System/Console.h"
@@ -571,6 +582,11 @@ const uintptr_t typeName##_RUNTIME_TYPE__[] = { \
0 \
}
+///////////////////////////////////////////////////////
+// P/Invoke runtime
+
+extern void* il2c_pinvoke_get_function__(const char* pDllName, const char* pEntryPointName);
+
#ifdef __cplusplus
}
#endif
diff --git a/src/IL2C.Runtime/include/netstandard.h b/src/IL2C.Runtime/include/netstandard.h
new file mode 100644
index 00000000..82dcdfd7
--- /dev/null
+++ b/src/IL2C.Runtime/include/netstandard.h
@@ -0,0 +1,17 @@
+////////////////////////////////////////////////////////////////////////////
+//
+// IL2C - A translator for ECMA-335 CIL/MSIL to C language.
+// Copyright (c) Kouji Matsui (@kozy_kekyo, @kekyo@mastodon.cloud)
+//
+// Licensed under Apache-v2: https://opensource.org/licenses/Apache-2.0
+//
+////////////////////////////////////////////////////////////////////////////
+
+#ifndef netstandard_dll_H__
+#define netstandard_dll_H__
+
+#pragma once
+
+#include
+
+#endif
diff --git a/src/IL2C.Runtime/src/Core/il2c_pinvoke.c b/src/IL2C.Runtime/src/Core/il2c_pinvoke.c
new file mode 100644
index 00000000..3996e41a
--- /dev/null
+++ b/src/IL2C.Runtime/src/Core/il2c_pinvoke.c
@@ -0,0 +1,110 @@
+////////////////////////////////////////////////////////////////////////////
+//
+// IL2C - A translator for ECMA-335 CIL/MSIL to C language.
+// Copyright (c) Kouji Matsui (@kozy_kekyo, @kekyo@mastodon.cloud)
+//
+// Licensed under Apache-v2: https://opensource.org/licenses/Apache-2.0
+//
+////////////////////////////////////////////////////////////////////////////
+
+#include
+
+#if defined(_MSC_VER)
+// function declared with 'noreturn' has non-void return type
+#pragma warning(disable:4646)
+// function declared with 'noreturn' has a return statement
+#pragma warning(disable:4645)
+// unreachable code
+#pragma warning(disable:4702)
+#endif
+
+/////////////////////////////////////////////////////////////
+// P/Invoke runtime
+
+#if defined(_WIN32)
+IL2C_CONST_STRING(il2c_dll_not_found_message, L"Dll not found.");
+
+void* il2c_pinvoke_get_function__(const char* pDllName, const char* pEntryPointName)
+{
+ il2c_assert(pDllName != NULL);
+ il2c_assert(pEntryPointName != NULL);
+
+ HMODULE handle = LoadLibraryA(pDllName);
+ if (handle != NULL)
+ {
+ void* pFunc = (void*)GetProcAddress(handle, pEntryPointName);
+ if (pFunc != NULL)
+ {
+ return pFunc;
+ }
+ }
+
+#if 1 // TODO: Improves with error message (FormatMessage API)
+ System_IO_FileNotFoundException* ex = il2c_get_uninitialized_object(System_IO_FileNotFoundException);
+ System_IO_FileNotFoundException__ctor__System_String(ex, il2c_dll_not_found_message);
+ il2c_throw(ex);
+ il2c_assert(false);
+ return NULL;
+#else
+ // https://github.com/dotnet/runtime/blob/6d0bcc4cc7cf98e661c91d4f2abace2c5bd282a5/src/coreclr/vm/nativelibrary.cpp
+ switch (GetLastError())
+ {
+ case ERROR_FILE_NOT_FOUND:
+ case ERROR_PATH_NOT_FOUND:
+ case ERROR_MOD_NOT_FOUND:
+ case ERROR_DLL_NOT_FOUND:
+ case ERROR_ACCESS_DENIED:
+ System_IO_FileNotFoundException* ex = il2c_get_uninitialized_object(System_IO_FileNotFoundException);
+ System_IO_FileNotFoundException__ctor__System_String(ex, il2c_dll_not_found_message);
+ il2c_throw(ex);
+ il2c_assert(false);
+ return NULL;
+ default:
+ System_IO_FileNotFoundException* ex = il2c_get_uninitialized_object(System_IO_FileNotFoundException);
+ System_IO_FileNotFoundException__ctor__System_String(ex, il2c_dll_not_found_message);
+ il2c_throw(ex);
+ il2c_assert(false);
+ return NULL;
+ }
+#endif
+}
+#elif defined(__linux__)
+IL2C_CONST_STRING(il2c_dll_not_found_message, L"Dll not found.");
+
+void* il2c_pinvoke_get_function__(const char* pDllName, const char* pEntryPointName)
+{
+ il2c_assert(pDllName != NULL);
+ il2c_assert(pEntryPointName != NULL);
+
+ void* handle = dlopen(pDllName, RTLD_LAZY);
+ if (handle != NULL)
+ {
+ void* pFunc = (void*)dlsym(handle, pEntryPointName);
+ if (pFunc != NULL)
+ {
+ return pFunc;
+ }
+ }
+
+ // TODO: Improves with error message (dlerror API)
+ System_IO_FileNotFoundException* ex = il2c_get_uninitialized_object(System_IO_FileNotFoundException);
+ System_IO_FileNotFoundException__ctor__System_String(ex, il2c_dll_not_found_message);
+ il2c_throw(ex);
+ il2c_assert(false);
+ return NULL;
+}
+#else
+IL2C_CONST_STRING(il2c_not_implemented_message, L"Not implemented.");
+
+il2c_noreturn__ void* il2c_pinvoke_get_function__(const char* pDllName, const char* pEntryPointName)
+{
+ il2c_assert(pDllName != NULL);
+ il2c_assert(pEntryPointName != NULL);
+
+ System_NotImplementedException* ex = il2c_get_uninitialized_object(System_NotImplementedException);
+ System_NotImplementedException__ctor__System_String(ex, il2c_not_implemented_message);
+ il2c_throw(ex);
+ il2c_assert(false);
+ return NULL;
+}
+#endif
diff --git a/src/IL2C.Runtime/src/Platform/linux.h b/src/IL2C.Runtime/src/Platform/linux.h
index 228589bd..6caaa82b 100644
--- a/src/IL2C.Runtime/src/Platform/linux.h
+++ b/src/IL2C.Runtime/src/Platform/linux.h
@@ -41,6 +41,8 @@ extern "C" {
#include
#include
+#include
+
#include "gcc.h"
#include "strings.h"
#include "pthread.h"
diff --git a/src/IL2C.Runtime/src/System/Attribute.c b/src/IL2C.Runtime/src/System/Attribute.c
new file mode 100644
index 00000000..c09ad457
--- /dev/null
+++ b/src/IL2C.Runtime/src/System/Attribute.c
@@ -0,0 +1,25 @@
+////////////////////////////////////////////////////////////////////////////
+//
+// IL2C - A translator for ECMA-335 CIL/MSIL to C language.
+// Copyright (c) Kouji Matsui (@kozy_kekyo, @kekyo@mastodon.cloud)
+//
+// Licensed under Apache-v2: https://opensource.org/licenses/Apache-2.0
+//
+////////////////////////////////////////////////////////////////////////////
+
+#include "il2c_private.h"
+
+/////////////////////////////////////////////////////////////
+// System.Attribute
+
+/////////////////////////////////////////////////
+// VTable and runtime type info declarations
+
+IL2C_RUNTIME_TYPE_BEGIN(
+ System_Attribute,
+ "System.Attribute",
+ IL2C_TYPE_REFERENCE,
+ sizeof(System_Attribute),
+ System_Object,
+ 0, 0)
+IL2C_RUNTIME_TYPE_END();
diff --git a/src/IL2C.Runtime/src/System/IO/FileNotFoundException.c b/src/IL2C.Runtime/src/System/IO/FileNotFoundException.c
new file mode 100644
index 00000000..19c1af15
--- /dev/null
+++ b/src/IL2C.Runtime/src/System/IO/FileNotFoundException.c
@@ -0,0 +1,19 @@
+////////////////////////////////////////////////////////////////////////////
+//
+// IL2C - A translator for ECMA-335 CIL/MSIL to C language.
+// Copyright (c) Kouji Matsui (@kozy_kekyo, @kekyo@mastodon.cloud)
+//
+// Licensed under Apache-v2: https://opensource.org/licenses/Apache-2.0
+//
+////////////////////////////////////////////////////////////////////////////
+
+#include "il2c_private.h"
+
+/////////////////////////////////////////////////////////////
+// System.IO.FileNotFoundException
+
+/////////////////////////////////////////////////
+// VTable and runtime type info declarations
+
+IL2C_RUNTIME_TYPE_BEGIN(System_IO_FileNotFoundException, "System.IO.FileNotFoundException", IL2C_TYPE_REFERENCE, sizeof(System_IO_FileNotFoundException), System_IO_IOException, 0, 0)
+IL2C_RUNTIME_TYPE_END();
diff --git a/src/IL2C.Runtime/src/System/IO/IOException.c b/src/IL2C.Runtime/src/System/IO/IOException.c
new file mode 100644
index 00000000..392e1302
--- /dev/null
+++ b/src/IL2C.Runtime/src/System/IO/IOException.c
@@ -0,0 +1,19 @@
+////////////////////////////////////////////////////////////////////////////
+//
+// IL2C - A translator for ECMA-335 CIL/MSIL to C language.
+// Copyright (c) Kouji Matsui (@kozy_kekyo, @kekyo@mastodon.cloud)
+//
+// Licensed under Apache-v2: https://opensource.org/licenses/Apache-2.0
+//
+////////////////////////////////////////////////////////////////////////////
+
+#include "il2c_private.h"
+
+/////////////////////////////////////////////////////////////
+// System.IO.IOException
+
+/////////////////////////////////////////////////
+// VTable and runtime type info declarations
+
+IL2C_RUNTIME_TYPE_BEGIN(System_IO_IOException, "System.IO.IOException", IL2C_TYPE_REFERENCE, sizeof(System_IO_IOException), System_SystemException, 0, 0)
+IL2C_RUNTIME_TYPE_END();
diff --git a/src/IL2C.Runtime/src/System/NotImplementedException.c b/src/IL2C.Runtime/src/System/NotImplementedException.c
new file mode 100644
index 00000000..55dc7534
--- /dev/null
+++ b/src/IL2C.Runtime/src/System/NotImplementedException.c
@@ -0,0 +1,19 @@
+////////////////////////////////////////////////////////////////////////////
+//
+// IL2C - A translator for ECMA-335 CIL/MSIL to C language.
+// Copyright (c) Kouji Matsui (@kozy_kekyo, @kekyo@mastodon.cloud)
+//
+// Licensed under Apache-v2: https://opensource.org/licenses/Apache-2.0
+//
+////////////////////////////////////////////////////////////////////////////
+
+#include "il2c_private.h"
+
+/////////////////////////////////////////////////////////////
+// System.NotImplementedException
+
+/////////////////////////////////////////////////
+// VTable and runtime type info declarations
+
+IL2C_RUNTIME_TYPE_BEGIN(System_NotImplementedException, "System.NotImplementedException", IL2C_TYPE_REFERENCE, sizeof(System_NotImplementedException), System_SystemException, 0, 0)
+IL2C_RUNTIME_TYPE_END();
diff --git a/src/IL2C.Runtime/src/System/Runtime/InteropServices/IL2CServices.c b/src/IL2C.Runtime/src/System/Runtime/InteropServices/IL2CServices.c
new file mode 100644
index 00000000..2a6863f8
--- /dev/null
+++ b/src/IL2C.Runtime/src/System/Runtime/InteropServices/IL2CServices.c
@@ -0,0 +1,19 @@
+////////////////////////////////////////////////////////////////////////////
+//
+// IL2C - A translator for ECMA-335 CIL/MSIL to C language.
+// Copyright (c) Kouji Matsui (@kozy_kekyo, @kekyo@mastodon.cloud)
+//
+// Licensed under Apache-v2: https://opensource.org/licenses/Apache-2.0
+//
+////////////////////////////////////////////////////////////////////////////
+
+#include "il2c_private.h"
+#include
+
+/////////////////////////////////////////////////
+// VTable and runtime type info declarations
+
+IL2C_RUNTIME_TYPE_STATIC(
+ System_Runtime_InteropServices_IL2CServices,
+ "System.Runtime.InteropServices.IL2CServices",
+ System_Object);
diff --git a/src/IL2C.Runtime/src/System/SystemException.c b/src/IL2C.Runtime/src/System/SystemException.c
new file mode 100644
index 00000000..996229e9
--- /dev/null
+++ b/src/IL2C.Runtime/src/System/SystemException.c
@@ -0,0 +1,19 @@
+////////////////////////////////////////////////////////////////////////////
+//
+// IL2C - A translator for ECMA-335 CIL/MSIL to C language.
+// Copyright (c) Kouji Matsui (@kozy_kekyo, @kekyo@mastodon.cloud)
+//
+// Licensed under Apache-v2: https://opensource.org/licenses/Apache-2.0
+//
+////////////////////////////////////////////////////////////////////////////
+
+#include "il2c_private.h"
+
+/////////////////////////////////////////////////////////////
+// System.SystemException
+
+/////////////////////////////////////////////////
+// VTable and runtime type info declarations
+
+IL2C_RUNTIME_TYPE_BEGIN(System_SystemException, "System.SystemException", IL2C_TYPE_REFERENCE, sizeof(System_SystemException), System_Exception, 0, 0)
+IL2C_RUNTIME_TYPE_END();
diff --git a/src/PlayGround/Calculator.Core/Calculator.Core.csproj b/src/PlayGround/Calculator.Core/Calculator.Core.csproj
index 94afc79d..54811b85 100644
--- a/src/PlayGround/Calculator.Core/Calculator.Core.csproj
+++ b/src/PlayGround/Calculator.Core/Calculator.Core.csproj
@@ -7,18 +7,19 @@
- netstandard2.0
+ net48;netstandard2.0
Calculator.Core
Calculator
-
-
-
-
+ CommentOnly
+ true
+ Information
+ false
-
+
+
diff --git a/src/PlayGround/Calculator/Calculator.csproj b/src/PlayGround/Calculator/Calculator.csproj
index acacac29..d893a3d8 100644
--- a/src/PlayGround/Calculator/Calculator.csproj
+++ b/src/PlayGround/Calculator/Calculator.csproj
@@ -13,15 +13,13 @@
Calculator
Calculator
- -Os
-
-
-
-
-
+ CommentOnly
+ true
+ Information
+ false
-
+
diff --git a/src/PlayGround/HelloWorld/HelloWorld.csproj b/src/PlayGround/HelloWorld/HelloWorld.csproj
index 84c73899..f4bbabb3 100644
--- a/src/PlayGround/HelloWorld/HelloWorld.csproj
+++ b/src/PlayGround/HelloWorld/HelloWorld.csproj
@@ -8,10 +8,16 @@
Exe
- net6.0
+ net48;net6.0
-
- -s
+ CommentOnly
+ true
+ Information
+ false
+
+
+
+
diff --git a/src/PlayGround/ShowMessageBoxOnWindows/ShowMessageBoxOnWindows.csproj b/src/PlayGround/ShowMessageBoxOnWindows/ShowMessageBoxOnWindows.csproj
index eadb7893..60972da7 100644
--- a/src/PlayGround/ShowMessageBoxOnWindows/ShowMessageBoxOnWindows.csproj
+++ b/src/PlayGround/ShowMessageBoxOnWindows/ShowMessageBoxOnWindows.csproj
@@ -10,14 +10,20 @@
WinExe
- net6.0
+ net48;net6.0
false
-
- -s
+ CommentOnly
+ true
+ Information
+ false
+
+
+
+
diff --git a/src/PlayGround/TakeAdvantageWithIL2CInvoke/TakeAdvantageWithIL2CInvoke.csproj b/src/PlayGround/TakeAdvantageWithIL2CInvoke/TakeAdvantageWithIL2CInvoke.csproj
index 6c1f7960..05af0668 100644
--- a/src/PlayGround/TakeAdvantageWithIL2CInvoke/TakeAdvantageWithIL2CInvoke.csproj
+++ b/src/PlayGround/TakeAdvantageWithIL2CInvoke/TakeAdvantageWithIL2CInvoke.csproj
@@ -8,12 +8,16 @@
Exe
- net6.0
-
-
- -s
-
-
+ net48;net6.0
+
+ CommentOnly
+ true
+ Information
+ false
+
+
+
+
diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props
index 3d1a0e55..3f66969d 100644
--- a/tests/Directory.Build.props
+++ b/tests/Directory.Build.props
@@ -6,7 +6,7 @@
false
portable
- False
+ true
diff --git a/tests/IL2C.Core.Test.BasicTypes/IL2C.Core.Test.BasicTypes.csproj b/tests/IL2C.Core.Test.BasicTypes/IL2C.Core.Test.BasicTypes.csproj
index d8b82d48..ee517a8b 100644
--- a/tests/IL2C.Core.Test.BasicTypes/IL2C.Core.Test.BasicTypes.csproj
+++ b/tests/IL2C.Core.Test.BasicTypes/IL2C.Core.Test.BasicTypes.csproj
@@ -1,29 +1,59 @@
+
+
+
+
+
+
- net48;netstandard2.0
+ net48;net6.0
+
+ net47;net6.0
+
Library
False
enable
+ true
+ $(DefineConstants);$(OS)
IL2C.Core.Test.BasicTypes
IL2C.BasicTypes
+
+ CommentOnly
+ true
+ Debug
+ false
+
+
+
+
-
+
-
+
+
-
-
+
+
+
+
+
+
+ $([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)\..\..\src\IL2C.Build\bin\$(Configuration)\$(_IL2C_PlatformName)'))
+
diff --git a/tests/IL2C.Core.Test.BasicTypes/Properties/AssemblyInfo.cs b/tests/IL2C.Core.Test.BasicTypes/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000..9052f96f
--- /dev/null
+++ b/tests/IL2C.Core.Test.BasicTypes/Properties/AssemblyInfo.cs
@@ -0,0 +1,12 @@
+////////////////////////////////////////////////////////////////////////////
+//
+// IL2C - A translator for ECMA-335 CIL/MSIL to C language.
+// Copyright (c) Kouji Matsui (@kozy_kekyo, @kekyo@mastodon.cloud)
+//
+// Licensed under Apache-v2: https://opensource.org/licenses/Apache-2.0
+//
+////////////////////////////////////////////////////////////////////////////
+
+using IL2C;
+
+[assembly: SetCulture("en-us")]
diff --git a/tests/IL2C.Core.Test.BasicTypes/System_Boolean/System_Boolean.cs b/tests/IL2C.Core.Test.BasicTypes/System_Boolean/System_Boolean.cs
index f44df82c..9490a5b1 100644
--- a/tests/IL2C.Core.Test.BasicTypes/System_Boolean/System_Boolean.cs
+++ b/tests/IL2C.Core.Test.BasicTypes/System_Boolean/System_Boolean.cs
@@ -11,25 +11,25 @@
namespace IL2C.BasicTypes
{
- [TestCase(true, "IsValueType")]
- [TestCase(1, "SizeOf")]
- [TestCase("True", "ToString", true)]
- [TestCase("False", "ToString", false)]
- [TestCase(true, "TryParse", "True")]
- [TestCase(false, "TryParse", "False")]
public sealed class System_Boolean
{
+ [TestCase(true, "IsValueType")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool IsValueType();
+ [TestCase(1, "SizeOf")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int SizeOf();
+ [TestCase("True", "ToString", true)]
+ [TestCase("False", "ToString", false)]
public static string ToString(bool value)
{
return value.ToString();
}
+ [TestCase(true, "TryParse", "True")]
+ [TestCase(false, "TryParse", "False")]
public static bool TryParse(string str)
{
bool.TryParse(str, out var value);
diff --git a/tests/IL2C.Core.Test.BasicTypes/System_Boolean/System_Boolean.il b/tests/IL2C.Core.Test.BasicTypes/System_Boolean/System_Boolean.il
index 7b85b14d..e959644e 100644
--- a/tests/IL2C.Core.Test.BasicTypes/System_Boolean/System_Boolean.il
+++ b/tests/IL2C.Core.Test.BasicTypes/System_Boolean/System_Boolean.il
@@ -6,7 +6,7 @@
ldc.i4.s 123
box bool
isinst [netstandard]System.ValueType
- brnull.s F1
+ brfalse.s F1
ldc.i4.1
ret
F1:
diff --git a/tests/IL2C.Core.Test.BasicTypes/System_Byte/System_Byte.cs b/tests/IL2C.Core.Test.BasicTypes/System_Byte/System_Byte.cs
index 17f0b542..d09998ce 100644
--- a/tests/IL2C.Core.Test.BasicTypes/System_Byte/System_Byte.cs
+++ b/tests/IL2C.Core.Test.BasicTypes/System_Byte/System_Byte.cs
@@ -11,25 +11,25 @@
namespace IL2C.BasicTypes
{
- [TestCase(true, "IsValueType")]
- [TestCase(1, "SizeOf")]
- [TestCase("255", "ToString", byte.MaxValue)]
- [TestCase("0", "ToString", byte.MinValue)]
- [TestCase(byte.MaxValue, "TryParse", "255")]
- [TestCase(byte.MinValue, "TryParse", "0")]
public sealed class System_Byte
{
+ [TestCase(true, "IsValueType")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool IsValueType();
+ [TestCase(1, "SizeOf")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int SizeOf();
+ [TestCase("255", "ToString", byte.MaxValue)]
+ [TestCase("0", "ToString", byte.MinValue)]
public static string ToString(byte value)
{
return value.ToString();
}
+ [TestCase(byte.MaxValue, "TryParse", "255")]
+ [TestCase(byte.MinValue, "TryParse", "0")]
public static byte TryParse(string str)
{
byte.TryParse(str, out var value);
diff --git a/tests/IL2C.Core.Test.BasicTypes/System_Byte/System_Byte.il b/tests/IL2C.Core.Test.BasicTypes/System_Byte/System_Byte.il
index 9cfc5aba..036d438d 100644
--- a/tests/IL2C.Core.Test.BasicTypes/System_Byte/System_Byte.il
+++ b/tests/IL2C.Core.Test.BasicTypes/System_Byte/System_Byte.il
@@ -6,7 +6,7 @@
ldc.i4.s 123
box uint8
isinst [netstandard]System.ValueType
- brnull.s F1
+ brfalse.s F1
ldc.i4.1
ret
F1:
diff --git a/tests/IL2C.Core.Test.BasicTypes/System_Char/System_Char.cs b/tests/IL2C.Core.Test.BasicTypes/System_Char/System_Char.cs
index cd237f29..f4360335 100644
--- a/tests/IL2C.Core.Test.BasicTypes/System_Char/System_Char.cs
+++ b/tests/IL2C.Core.Test.BasicTypes/System_Char/System_Char.cs
@@ -11,17 +11,13 @@
namespace IL2C.BasicTypes
{
- [TestCase(true, "IsValueType")]
- [TestCase(2, "SizeOf")]
- [TestCase("\u0000", "ToStringMin")]
- [TestCase("\uffff", "ToStringMax")]
- [TestCase(char.MinValue, "TryParseMin")]
- [TestCase(char.MaxValue, "TryParseMax")]
public sealed class System_Char
{
+ [TestCase(true, "IsValueType")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool IsValueType();
+ [TestCase(2, "SizeOf")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int SizeOf();
@@ -31,24 +27,28 @@ public sealed class System_Char
// (ex: ToString("\u0000") and ToString("\uffff") if apply sets for test methods)
// But cause failed conflicting both these test case names (maybe contains invalid char).
+ [TestCase("\u0000", "ToStringMin")]
public static string ToStringMin()
{
char value = char.MinValue;
return value.ToString();
}
+ [TestCase("\uffff", "ToStringMax")]
public static string ToStringMax()
{
char value = char.MaxValue;
return value.ToString();
}
+ [TestCase(char.MinValue, "TryParseMin")]
public static char TryParseMin()
{
char.TryParse("\u0000", out var value);
return value;
}
+ [TestCase(char.MaxValue, "TryParseMax")]
public static char TryParseMax()
{
char.TryParse("\uffff", out var value);
diff --git a/tests/IL2C.Core.Test.BasicTypes/System_Char/System_Char.il b/tests/IL2C.Core.Test.BasicTypes/System_Char/System_Char.il
index 129eb34f..9aaf138d 100644
--- a/tests/IL2C.Core.Test.BasicTypes/System_Char/System_Char.il
+++ b/tests/IL2C.Core.Test.BasicTypes/System_Char/System_Char.il
@@ -6,7 +6,7 @@
ldc.i4 12345
box char
isinst [netstandard]System.ValueType
- brnull.s F1
+ brfalse.s F1
ldc.i4.1
ret
F1:
diff --git a/tests/IL2C.Core.Test.BasicTypes/System_Delegate/System_Delegate.cs b/tests/IL2C.Core.Test.BasicTypes/System_Delegate/System_Delegate.cs
index 4df67e9c..47186839 100644
--- a/tests/IL2C.Core.Test.BasicTypes/System_Delegate/System_Delegate.cs
+++ b/tests/IL2C.Core.Test.BasicTypes/System_Delegate/System_Delegate.cs
@@ -13,17 +13,6 @@ namespace IL2C.BasicTypes
{
public delegate void IntRefDelegate(ref int value);
- [TestCase(10100, new[] { "Remove_DelegateInstance", "IntRefImpl1", "IntRefImpl2" }, 1000, IncludeTypes = new[] { typeof(IntRefDelegate) })]
- [TestCase(10100, new[] { "Remove_DelegateTarget", "IntRefImpl1", "IntRefImpl2" }, 1000, IncludeTypes = new[] { typeof(IntRefDelegate) })]
- [TestCase(5050, new[] { "Remove_DelegateMiddle", "IntRefImpl1", "IntRefImpl2", "IntRefImpl3" }, 1000, IncludeTypes = new[] { typeof(IntRefDelegate) })]
- [TestCase(50000, new[] { "Remove_DelegateHead", "IntRefImpl1", "IntRefImpl2", "IntRefImpl3" }, 1000, IncludeTypes = new[] { typeof(IntRefDelegate) })]
- [TestCase(50500, new[] { "Remove_NotContainsDelegate", "IntRefImpl1", "IntRefImpl2", "IntRefImpl3", "IntRefImpl4" }, 1000, IncludeTypes = new[] { typeof(IntRefDelegate) })]
- [TestCase(1000, new[] { "Remove_FromNullToDelegate", "IntRefImpl1" }, 1000, IncludeTypes = new[] { typeof(IntRefDelegate) })]
- [TestCase(5000, new[] { "Remove_ToMulticastDelegate1", "IntRefImpl1", "IntRefImpl2", "IntRefImpl3" }, 1000, IncludeTypes = new[] { typeof(IntRefDelegate) })]
- [TestCase(1010, new[] { "Remove_ToMulticastDelegate2", "IntRefImpl1", "IntRefImpl2", "IntRefImpl3" }, 1000, IncludeTypes = new[] { typeof(IntRefDelegate) })]
- [TestCase(50500, new[] { "Remove_NotContainsMulticastDelegate", "IntRefImpl1", "IntRefImpl2", "IntRefImpl3" }, 1000, IncludeTypes = new[] { typeof(IntRefDelegate) })]
- [TestCase(1000, new[] { "Remove_EntireMatchedMulticastDelegate", "IntRefImpl1", "IntRefImpl2", "IntRefImpl3" }, 1000, IncludeTypes = new[] { typeof(IntRefDelegate) })]
- [TestCase(1000, new[] { "Remove_FromNullToMulticastDelegate", "IntRefImpl1", "IntRefImpl2" }, 1000, IncludeTypes = new[] { typeof(IntRefDelegate) })]
public sealed class System_Delegate
{
private static void IntRefImpl1(ref int value)
@@ -46,6 +35,7 @@ private static void IntRefImpl4(ref int value)
value *= 3;
}
+ [TestCase(10100, new[] { "Remove_DelegateInstance", "IntRefImpl1", "IntRefImpl2" }, 1000, IncludeTypes = new[] { typeof(IntRefDelegate) })]
public static int Remove_DelegateInstance(int value)
{
var dlg1 = new IntRefDelegate(IntRefImpl1);
@@ -56,7 +46,7 @@ public static int Remove_DelegateInstance(int value)
// Remove only a tail delegate.
// (dlg1 + dlg2 + dlg1) - dlg1 = (dlg1 + dlg2)
- var dlg = (IntRefDelegate)Delegate.Remove(dlgA, dlg1);
+ var dlg = (IntRefDelegate?)Delegate.Remove(dlgA, dlg1);
var v = value;
dlg?.Invoke(ref v);
@@ -64,6 +54,7 @@ public static int Remove_DelegateInstance(int value)
return v;
}
+ [TestCase(10100, new[] { "Remove_DelegateTarget", "IntRefImpl1", "IntRefImpl2" }, 1000, IncludeTypes = new[] { typeof(IntRefDelegate) })]
public static int Remove_DelegateTarget(int value)
{
var dlg1 = new IntRefDelegate(IntRefImpl1);
@@ -75,7 +66,7 @@ public static int Remove_DelegateTarget(int value)
// Remove only a tail delegate.
// (dlg1 + dlg2 + dlg3[=dlg1]) - dlg1 = (dlg1 + dlg2)
- var dlg = (IntRefDelegate)Delegate.Remove(dlgA, dlg1);
+ var dlg = (IntRefDelegate?)Delegate.Remove(dlgA, dlg1);
var v = value;
dlg?.Invoke(ref v);
@@ -83,6 +74,7 @@ public static int Remove_DelegateTarget(int value)
return v;
}
+ [TestCase(5050, new[] { "Remove_DelegateMiddle", "IntRefImpl1", "IntRefImpl2", "IntRefImpl3" }, 1000, IncludeTypes = new[] { typeof(IntRefDelegate) })]
public static int Remove_DelegateMiddle(int value)
{
var dlg1 = new IntRefDelegate(IntRefImpl1);
@@ -93,7 +85,7 @@ public static int Remove_DelegateMiddle(int value)
dlgA += dlg3;
// (dlg1 + dlg2 + dlg3) - dlg2 = (dlg1 + dlg3)
- var dlg = (IntRefDelegate)Delegate.Remove(dlgA, dlg2);
+ var dlg = (IntRefDelegate?)Delegate.Remove(dlgA, dlg2);
var v = value;
dlg?.Invoke(ref v);
@@ -101,6 +93,7 @@ public static int Remove_DelegateMiddle(int value)
return v;
}
+ [TestCase(50000, new[] { "Remove_DelegateHead", "IntRefImpl1", "IntRefImpl2", "IntRefImpl3" }, 1000, IncludeTypes = new[] { typeof(IntRefDelegate) })]
public static int Remove_DelegateHead(int value)
{
var dlg1 = new IntRefDelegate(IntRefImpl1);
@@ -111,7 +104,7 @@ public static int Remove_DelegateHead(int value)
dlgA += dlg3;
// (dlg1 + dlg2 + dlg3) - dlg1 = (dlg2 + dlg3)
- var dlg = (IntRefDelegate)Delegate.Remove(dlgA, dlg1);
+ var dlg = (IntRefDelegate?)Delegate.Remove(dlgA, dlg1);
var v = value;
dlg?.Invoke(ref v);
@@ -119,6 +112,7 @@ public static int Remove_DelegateHead(int value)
return v;
}
+ [TestCase(50500, new[] { "Remove_NotContainsDelegate", "IntRefImpl1", "IntRefImpl2", "IntRefImpl3", "IntRefImpl4" }, 1000, IncludeTypes = new[] { typeof(IntRefDelegate) })]
public static int Remove_NotContainsDelegate(int value)
{
var dlg1 = new IntRefDelegate(IntRefImpl1);
@@ -130,7 +124,7 @@ public static int Remove_NotContainsDelegate(int value)
dlgA += dlg3;
// (dlg1 + dlg2 + dlg3) - dlg4 = (dlg1 + dlg2 + dlg3)
- var dlg = (IntRefDelegate)Delegate.Remove(dlgA, dlg4);
+ var dlg = (IntRefDelegate?)Delegate.Remove(dlgA, dlg4);
var v = value;
dlg?.Invoke(ref v);
@@ -138,12 +132,13 @@ public static int Remove_NotContainsDelegate(int value)
return v;
}
+ [TestCase(1000, new[] { "Remove_FromNullToDelegate", "IntRefImpl1" }, 1000, IncludeTypes = new[] { typeof(IntRefDelegate) })]
public static int Remove_FromNullToDelegate(int value)
{
var dlg1 = new IntRefDelegate(IntRefImpl1);
// null - dlg1 = null
- var dlg = (IntRefDelegate)Delegate.Remove(null, dlg1);
+ var dlg = (IntRefDelegate?)Delegate.Remove(null, dlg1);
var v = value;
dlg?.Invoke(ref v);
@@ -151,6 +146,7 @@ public static int Remove_FromNullToDelegate(int value)
return v;
}
+ [TestCase(5000, new[] { "Remove_ToMulticastDelegate1", "IntRefImpl1", "IntRefImpl2", "IntRefImpl3" }, 1000, IncludeTypes = new[] { typeof(IntRefDelegate) })]
public static int Remove_ToMulticastDelegate1(int value)
{
var dlg1 = new IntRefDelegate(IntRefImpl1);
@@ -163,7 +159,7 @@ public static int Remove_ToMulticastDelegate1(int value)
var dlgB = dlg1 + dlg2;
// (dlg1 + dlg2 + dlg3) - (dlg1 + dlg2) = dlg3
- var dlg = (IntRefDelegate)Delegate.Remove(dlgA, dlgB);
+ var dlg = (IntRefDelegate?)Delegate.Remove(dlgA, dlgB);
var v = value;
dlg?.Invoke(ref v);
@@ -171,6 +167,7 @@ public static int Remove_ToMulticastDelegate1(int value)
return v;
}
+ [TestCase(1010, new[] { "Remove_ToMulticastDelegate2", "IntRefImpl1", "IntRefImpl2", "IntRefImpl3" }, 1000, IncludeTypes = new[] { typeof(IntRefDelegate) })]
public static int Remove_ToMulticastDelegate2(int value)
{
var dlg1 = new IntRefDelegate(IntRefImpl1);
@@ -183,7 +180,7 @@ public static int Remove_ToMulticastDelegate2(int value)
var dlgB = dlg2 + dlg3;
// (dlg1 + dlg2 + dlg3) - (dlg2 + dlg3) = dlg1
- var dlg = (IntRefDelegate)Delegate.Remove(dlgA, dlgB);
+ var dlg = (IntRefDelegate?)Delegate.Remove(dlgA, dlgB);
var v = value;
dlg?.Invoke(ref v);
@@ -191,6 +188,7 @@ public static int Remove_ToMulticastDelegate2(int value)
return v;
}
+ [TestCase(50500, new[] { "Remove_NotContainsMulticastDelegate", "IntRefImpl1", "IntRefImpl2", "IntRefImpl3" }, 1000, IncludeTypes = new[] { typeof(IntRefDelegate) })]
public static int Remove_NotContainsMulticastDelegate(int value)
{
var dlg1 = new IntRefDelegate(IntRefImpl1);
@@ -203,7 +201,7 @@ public static int Remove_NotContainsMulticastDelegate(int value)
var dlgB = dlg2 + dlg1;
// (dlg1 + dlg2 + dlg3) - (dlg2 + dlg1) = (dlg1 + dlg2 + dlg3)
- var dlg = (IntRefDelegate)Delegate.Remove(dlgA, dlgB);
+ var dlg = (IntRefDelegate?)Delegate.Remove(dlgA, dlgB);
var v = value;
dlg?.Invoke(ref v);
@@ -211,6 +209,9 @@ public static int Remove_NotContainsMulticastDelegate(int value)
return v;
}
+ [TestCase(1000, new[] { "Remove_EntireMatchedMulticastDelegate", "IntRefImpl1", "IntRefImpl2", "IntRefImpl3" }, 1000, IncludeTypes = new[] { typeof(IntRefDelegate) },
+ // TODO: I didn't understand why cause indexoutofrange error on only executing linux mono x64 environment...
+ RunOnPlatforms = RunOnPlatforms.DotNet)]
public static int Remove_EntireMatchedMulticastDelegate(int value)
{
var dlg1 = new IntRefDelegate(IntRefImpl1);
@@ -224,7 +225,7 @@ public static int Remove_EntireMatchedMulticastDelegate(int value)
dlgB += dlg3;
// (dlg1 + dlg2 + dlg3) - (dlg1 + dlg2 + dlg3) = null
- var dlg = (IntRefDelegate)Delegate.Remove(dlgA, dlgB);
+ var dlg = (IntRefDelegate?)Delegate.Remove(dlgA, dlgB);
var v = value;
dlg?.Invoke(ref v);
@@ -232,6 +233,7 @@ public static int Remove_EntireMatchedMulticastDelegate(int value)
return v;
}
+ [TestCase(1000, new[] { "Remove_FromNullToMulticastDelegate", "IntRefImpl1", "IntRefImpl2" }, 1000, IncludeTypes = new[] { typeof(IntRefDelegate) })]
public static int Remove_FromNullToMulticastDelegate(int value)
{
var dlg1 = new IntRefDelegate(IntRefImpl1);
@@ -240,7 +242,7 @@ public static int Remove_FromNullToMulticastDelegate(int value)
var dlgA = dlg1 + dlg2;
// null - (dlg1 + dlg2) = null
- var dlg = (IntRefDelegate)Delegate.Remove(null, dlgA);
+ var dlg = (IntRefDelegate?)Delegate.Remove(null, dlgA);
var v = value;
dlg?.Invoke(ref v);
diff --git a/tests/IL2C.Core.Test.BasicTypes/System_Double/System_Double.cs b/tests/IL2C.Core.Test.BasicTypes/System_Double/System_Double.cs
index 9664dda9..ec088e95 100644
--- a/tests/IL2C.Core.Test.BasicTypes/System_Double/System_Double.cs
+++ b/tests/IL2C.Core.Test.BasicTypes/System_Double/System_Double.cs
@@ -12,25 +12,30 @@
namespace IL2C.BasicTypes
{
// Some tests are using the IgnoreInvokeResult flag, because float string format is bit different (but no problem.)
- [TestCase(true, "IsValueType")]
- [TestCase(8, "SizeOf")]
- [TestCase("1.797693134862316e+308", "ToString", double.MaxValue, Assert = TestCaseAsserts.IgnoreValidateInvokeResult)] // Real value is 1.7976931348623157E+308
- [TestCase("-1.797693134862316e+308", "ToString", double.MinValue, Assert = TestCaseAsserts.IgnoreValidateInvokeResult)] // Real value is -1.7976931348623157E+308
- [TestCase(double.MaxValue, "TryParse", "1.7976931348623157E+308")]
- [TestCase(double.MinValue, "TryParse", "-1.7976931348623157E+308")]
public sealed class System_Double
{
+ [TestCase(true, "IsValueType")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool IsValueType();
+ [TestCase(8, "SizeOf")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int SizeOf();
+#if NET6_0_OR_GREATER
+ [TestCase("1.7976931348623157E+308", "ToString", double.MaxValue)]
+ [TestCase("-1.7976931348623157E+308", "ToString", double.MinValue)]
+#else
+ [TestCase("1.79769313486232E+308", "ToString", double.MaxValue)]
+ [TestCase("-1.79769313486232E+308", "ToString", double.MinValue)]
+#endif
public static string ToString(double value)
{
return value.ToString();
}
+ [TestCase(double.MaxValue, "TryParse", "1.7976931348623157E+308")]
+ [TestCase(double.MinValue, "TryParse", "-1.7976931348623157E+308")]
public static double TryParse(string str)
{
double.TryParse(str, out var value);
diff --git a/tests/IL2C.Core.Test.BasicTypes/System_Double/System_Double.il b/tests/IL2C.Core.Test.BasicTypes/System_Double/System_Double.il
index 2a4024b8..38b8cb52 100644
--- a/tests/IL2C.Core.Test.BasicTypes/System_Double/System_Double.il
+++ b/tests/IL2C.Core.Test.BasicTypes/System_Double/System_Double.il
@@ -6,7 +6,7 @@
ldc.r8 1234567.890123
box float64
isinst [netstandard]System.ValueType
- brnull.s F1
+ brfalse.s F1
ldc.i4.1
ret
F1:
diff --git a/tests/IL2C.Core.Test.BasicTypes/System_Int16/System_Int16.cs b/tests/IL2C.Core.Test.BasicTypes/System_Int16/System_Int16.cs
index f65dfbb4..364d7cde 100644
--- a/tests/IL2C.Core.Test.BasicTypes/System_Int16/System_Int16.cs
+++ b/tests/IL2C.Core.Test.BasicTypes/System_Int16/System_Int16.cs
@@ -11,25 +11,25 @@
namespace IL2C.BasicTypes
{
- [TestCase(true, "IsValueType")]
- [TestCase(2, "SizeOf")]
- [TestCase("32767", "ToString", short.MaxValue)]
- [TestCase("-32768", "ToString", short.MinValue)]
- [TestCase(short.MaxValue, "TryParse", "32767")]
- [TestCase(short.MinValue, "TryParse", "-32768")]
public sealed class System_Int16
{
+ [TestCase(true, "IsValueType")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool IsValueType();
+ [TestCase(2, "SizeOf")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int SizeOf();
+ [TestCase("32767", "ToString", short.MaxValue)]
+ [TestCase("-32768", "ToString", short.MinValue)]
public static string ToString(short value)
{
return value.ToString();
}
+ [TestCase(short.MaxValue, "TryParse", "32767")]
+ [TestCase(short.MinValue, "TryParse", "-32768")]
public static short TryParse(string str)
{
short.TryParse(str, out var value);
diff --git a/tests/IL2C.Core.Test.BasicTypes/System_Int16/System_Int16.il b/tests/IL2C.Core.Test.BasicTypes/System_Int16/System_Int16.il
index 506cea81..26a04128 100644
--- a/tests/IL2C.Core.Test.BasicTypes/System_Int16/System_Int16.il
+++ b/tests/IL2C.Core.Test.BasicTypes/System_Int16/System_Int16.il
@@ -6,7 +6,7 @@
ldc.i4 12345
box int16
isinst [netstandard]System.ValueType
- brnull.s F1
+ brfalse.s F1
ldc.i4.1
ret
F1:
diff --git a/tests/IL2C.Core.Test.BasicTypes/System_Int32/System_Int32.cs b/tests/IL2C.Core.Test.BasicTypes/System_Int32/System_Int32.cs
index 445e60e9..8519e1bb 100644
--- a/tests/IL2C.Core.Test.BasicTypes/System_Int32/System_Int32.cs
+++ b/tests/IL2C.Core.Test.BasicTypes/System_Int32/System_Int32.cs
@@ -11,26 +11,26 @@
namespace IL2C.BasicTypes
{
- [TestCase(true, "IsValueType")]
- [TestCase(4, "SizeOf")]
- [TestCase("2147483647", "ToString", int.MaxValue)]
- [TestCase("-2147483647", "ToString", int.MinValue + 1)]
- [TestCase("-2147483648", "ToString", int.MinValue)] // It's special case for internal
- [TestCase(int.MaxValue, "TryParse", "2147483647")]
- [TestCase(int.MinValue, "TryParse", "-2147483648")]
public sealed class System_Int32
{
+ [TestCase(true, "IsValueType")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool IsValueType();
+ [TestCase(4, "SizeOf")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int SizeOf();
+ [TestCase("2147483647", "ToString", int.MaxValue)]
+ [TestCase("-2147483647", "ToString", int.MinValue + 1)]
+ [TestCase("-2147483648", "ToString", int.MinValue)] // It's special case for internal
public static string ToString(int value)
{
return value.ToString();
}
+ [TestCase(int.MaxValue, "TryParse", "2147483647")]
+ [TestCase(int.MinValue, "TryParse", "-2147483648")]
public static int TryParse(string str)
{
int.TryParse(str, out var value);
diff --git a/tests/IL2C.Core.Test.BasicTypes/System_Int32/System_Int32.il b/tests/IL2C.Core.Test.BasicTypes/System_Int32/System_Int32.il
index e70e1b64..29775ca2 100644
--- a/tests/IL2C.Core.Test.BasicTypes/System_Int32/System_Int32.il
+++ b/tests/IL2C.Core.Test.BasicTypes/System_Int32/System_Int32.il
@@ -6,7 +6,7 @@
ldc.i4 1234567
box int32
isinst [netstandard]System.ValueType
- brnull.s F1
+ brfalse.s F1
ldc.i4.1
ret
F1:
diff --git a/tests/IL2C.Core.Test.BasicTypes/System_Int64/System_Int64.cs b/tests/IL2C.Core.Test.BasicTypes/System_Int64/System_Int64.cs
index 35aa2595..f73595bb 100644
--- a/tests/IL2C.Core.Test.BasicTypes/System_Int64/System_Int64.cs
+++ b/tests/IL2C.Core.Test.BasicTypes/System_Int64/System_Int64.cs
@@ -11,26 +11,26 @@
namespace IL2C.BasicTypes
{
- [TestCase(true, "IsValueType")]
- [TestCase(8, "SizeOf")]
- [TestCase("9223372036854775807", "ToString", long.MaxValue)]
- [TestCase("-9223372036854775807", "ToString", long.MinValue + 1)]
- [TestCase("-9223372036854775808", "ToString", long.MinValue)] // It's special case for internal
- [TestCase(long.MaxValue, "TryParse", "9223372036854775807")]
- [TestCase(long.MinValue, "TryParse", "-9223372036854775808")]
public sealed class System_Int64
{
+ [TestCase(true, "IsValueType")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool IsValueType();
+ [TestCase(8, "SizeOf")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int SizeOf();
+ [TestCase("9223372036854775807", "ToString", long.MaxValue)]
+ [TestCase("-9223372036854775807", "ToString", long.MinValue + 1)]
+ [TestCase("-9223372036854775808", "ToString", long.MinValue)] // It's special case for internal
public static string ToString(long value)
{
return value.ToString();
}
+ [TestCase(long.MaxValue, "TryParse", "9223372036854775807")]
+ [TestCase(long.MinValue, "TryParse", "-9223372036854775808")]
public static long TryParse(string str)
{
long.TryParse(str, out var value);
diff --git a/tests/IL2C.Core.Test.BasicTypes/System_Int64/System_Int64.il b/tests/IL2C.Core.Test.BasicTypes/System_Int64/System_Int64.il
index 3f7a4b52..167f2497 100644
--- a/tests/IL2C.Core.Test.BasicTypes/System_Int64/System_Int64.il
+++ b/tests/IL2C.Core.Test.BasicTypes/System_Int64/System_Int64.il
@@ -6,7 +6,7 @@
ldc.i8 1234567890123
box int64
isinst [netstandard]System.ValueType
- brnull.s F1
+ brfalse.s F1
ldc.i4.1
ret
F1:
diff --git a/tests/IL2C.Core.Test.BasicTypes/System_IntPtr/System_IntPtr.cs b/tests/IL2C.Core.Test.BasicTypes/System_IntPtr/System_IntPtr.cs
index 55b93ad0..edd42bc5 100644
--- a/tests/IL2C.Core.Test.BasicTypes/System_IntPtr/System_IntPtr.cs
+++ b/tests/IL2C.Core.Test.BasicTypes/System_IntPtr/System_IntPtr.cs
@@ -12,39 +12,56 @@
namespace IL2C.BasicTypes
{
- [TestCase(true, "IsValueType")]
- [TestCase(4, "SizeOf", Assert = TestCaseAsserts.IgnoreValidateInvokeResult)] // Unit test environment is unknown, gcc is 32bit
- [TestCase("2147483647", "ToString", int.MaxValue)]
- [TestCase("-2147483648", "ToString", int.MinValue)]
- [TestCase(true, "Zero", 0)]
- [TestCase(true, "Equality", 0)]
- [TestCase(false, "NonEquality", 0)]
public sealed class System_IntPtr
{
+ [TestCase(true, "IsValueType")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool IsValueType();
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern int SizeOf();
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ public static extern int SizeOfImpl();
+
+ [TestCase(true, "SizeOf")]
+ public static bool SizeOf() =>
+ IntPtr.Size == SizeOfImpl();
+
+ [TestCase("2147483647", "ToString", int.MaxValue)]
+ [TestCase("-2147483648", "ToString", int.MinValue)]
+ public static string ToString(int value)
+ {
+ return ((IntPtr)value).ToString();
+ }
+
+ [TestCase(true, "Zero", 0)]
+ public static bool Zero(int v)
+ {
+ return ((IntPtr)v) == IntPtr.Zero;
+ }
- public static string ToString(IntPtr value)
+ [TestCase(true, "Equality", 0)]
+ public static bool Equality(int v)
{
- return value.ToString();
+ return ((IntPtr)v) == IntPtr.Zero;
}
- public static bool Zero(IntPtr v)
+ [TestCase(false, "NonEquality", 0)]
+ public static bool NonEquality(int v)
{
- return v == IntPtr.Zero;
+ return ((IntPtr)v) != IntPtr.Zero;
}
- public static bool Equality(IntPtr v)
+ [TestCase(123, "ToInt32", 123)]
+ public static int ToInt32(int v)
{
- return v == IntPtr.Zero;
+ var ip = (IntPtr)v;
+ return ip.ToInt32();
}
- public static bool NonEquality(IntPtr v)
+ [TestCase(123L, "ToInt64", 123L)]
+ public static long ToInt64(long v)
{
- return v != IntPtr.Zero;
+ var ip = (IntPtr)v;
+ return ip.ToInt64();
}
}
}
diff --git a/tests/IL2C.Core.Test.BasicTypes/System_IntPtr/System_IntPtr.il b/tests/IL2C.Core.Test.BasicTypes/System_IntPtr/System_IntPtr.il
index c48ba3d4..1ed1b19e 100644
--- a/tests/IL2C.Core.Test.BasicTypes/System_IntPtr/System_IntPtr.il
+++ b/tests/IL2C.Core.Test.BasicTypes/System_IntPtr/System_IntPtr.il
@@ -7,7 +7,7 @@
conv.i
box native int
isinst [netstandard]System.ValueType
- brnull.s F1
+ brfalse.s F1
ldc.i4.1
ret
F1:
@@ -15,7 +15,7 @@
ret
}
- .method public static int32 SizeOf() cil managed
+ .method public static int32 SizeOfImpl() cil managed
{
.maxstack 1
sizeof native int
diff --git a/tests/IL2C.Core.Test.BasicTypes/System_Object/System_Object.cs b/tests/IL2C.Core.Test.BasicTypes/System_Object/System_Object.cs
index 57f4a444..3bb13945 100644
--- a/tests/IL2C.Core.Test.BasicTypes/System_Object/System_Object.cs
+++ b/tests/IL2C.Core.Test.BasicTypes/System_Object/System_Object.cs
@@ -11,36 +11,36 @@
namespace IL2C.BasicTypes
{
- [TestCase(true, "IsValueType", 123)]
- [TestCase(false, "IsValueType", "ABC")]
- [TestCase("System.Int32", "ToString", int.MaxValue, IgnoreILErrors = new[] { "ThisMismatch" })]
- [TestCase("System.String", "ToString", "ABC", IgnoreILErrors = new[] { "ThisMismatch" })]
- [TestCase("System.Int32", "GetType", int.MaxValue)]
- [TestCase("System.String", "GetType", "ABC")]
- [TestCase(true, "RefEquals_Same")]
- [TestCase(false, "RefEquals_NotSame")]
- [TestCase(false, "RefEquals", "ABC", "DEF")]
- [TestCase(false, "RefEquals", 123, "ABC")]
- [TestCase(false, "RefEquals", null, "ABC")]
- [TestCase(true, "RefEquals", null, null)]
public sealed class System_Object
{
+ [TestCase(true, "IsValueType", 123)]
+ [TestCase(false, "IsValueType", "ABC")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool IsValueType(object value);
// This is non virtual calling test.
+ [TestCase("System.Int32", "ToString", int.MaxValue, IgnoreILErrors = new[] { "ThisMismatch" })]
+ [TestCase("System.String", "ToString", "ABC", IgnoreILErrors = new[] { "ThisMismatch" })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string ToString(object value);
+ [TestCase("System.Int32", "GetType", int.MaxValue)]
+ [TestCase("System.String", "GetType", "ABC")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string GetType(object value);
+ [TestCase(true, "RefEquals_Same")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool RefEquals_Same();
+ [TestCase(false, "RefEquals_NotSame")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool RefEquals_NotSame();
+ [TestCase(false, "RefEquals", "ABC", "DEF")]
+ [TestCase(false, "RefEquals", 123, "ABC")]
+ [TestCase(false, "RefEquals", null, "ABC")]
+ [TestCase(true, "RefEquals", null, null)]
public static bool RefEquals(object value1, object value2)
{
return object.ReferenceEquals(value1, value2);
diff --git a/tests/IL2C.Core.Test.BasicTypes/System_Object/System_Object.il b/tests/IL2C.Core.Test.BasicTypes/System_Object/System_Object.il
index c173a3e6..569e8270 100644
--- a/tests/IL2C.Core.Test.BasicTypes/System_Object/System_Object.il
+++ b/tests/IL2C.Core.Test.BasicTypes/System_Object/System_Object.il
@@ -5,7 +5,7 @@
.maxstack 2
ldarg.0
isinst [netstandard]System.ValueType
- brnull.s F1
+ brfalse.s F1
ldc.i4.1
ret
F1:
diff --git a/tests/IL2C.Core.Test.BasicTypes/System_SByte/System_SByte.cs b/tests/IL2C.Core.Test.BasicTypes/System_SByte/System_SByte.cs
index 1da34d49..26f8ce7f 100644
--- a/tests/IL2C.Core.Test.BasicTypes/System_SByte/System_SByte.cs
+++ b/tests/IL2C.Core.Test.BasicTypes/System_SByte/System_SByte.cs
@@ -11,25 +11,25 @@
namespace IL2C.BasicTypes
{
- [TestCase(true, "IsValueType")]
- [TestCase(1, "SizeOf")]
- [TestCase("127", "ToString", sbyte.MaxValue)]
- [TestCase("-128", "ToString", sbyte.MinValue)]
- [TestCase(sbyte.MaxValue, "TryParse", "127")]
- [TestCase(sbyte.MinValue, "TryParse", "-128")]
public sealed class System_SByte
{
+ [TestCase(true, "IsValueType")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool IsValueType();
+ [TestCase(1, "SizeOf")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int SizeOf();
+ [TestCase("127", "ToString", sbyte.MaxValue)]
+ [TestCase("-128", "ToString", sbyte.MinValue)]
public static string ToString(sbyte value)
{
return value.ToString();
}
+ [TestCase(sbyte.MaxValue, "TryParse", "127")]
+ [TestCase(sbyte.MinValue, "TryParse", "-128")]
public static sbyte TryParse(string str)
{
sbyte.TryParse(str, out var value);
diff --git a/tests/IL2C.Core.Test.BasicTypes/System_SByte/System_SByte.il b/tests/IL2C.Core.Test.BasicTypes/System_SByte/System_SByte.il
index c6e0d510..b6ad58a9 100644
--- a/tests/IL2C.Core.Test.BasicTypes/System_SByte/System_SByte.il
+++ b/tests/IL2C.Core.Test.BasicTypes/System_SByte/System_SByte.il
@@ -6,7 +6,7 @@
ldc.i4.s 123
box int8
isinst [netstandard]System.ValueType
- brnull.s F1
+ brfalse.s F1
ldc.i4.1
ret
F1:
diff --git a/tests/IL2C.Core.Test.BasicTypes/System_Single/System_Single.cs b/tests/IL2C.Core.Test.BasicTypes/System_Single/System_Single.cs
index 095bde21..ab4df822 100644
--- a/tests/IL2C.Core.Test.BasicTypes/System_Single/System_Single.cs
+++ b/tests/IL2C.Core.Test.BasicTypes/System_Single/System_Single.cs
@@ -12,25 +12,30 @@
namespace IL2C.BasicTypes
{
// Some tests are using the IgnoreInvokeResult flag, because float string format is bit different (but no problem.)
- [TestCase(true, "IsValueType")]
- [TestCase(4, "SizeOf")]
- [TestCase("3.4028235e+038", "ToString", float.MaxValue, Assert = TestCaseAsserts.IgnoreValidateInvokeResult)] // Real value is 3.40282347E+38
- [TestCase("-3.4028235e+038", "ToString", float.MinValue, Assert = TestCaseAsserts.IgnoreValidateInvokeResult)] // Real value is -3.40282347E+38
- [TestCase(float.MaxValue, "TryParse", "3.40282347E+38")]
- [TestCase(float.MinValue, "TryParse", "-3.40282347E+38")]
public sealed class System_Single
{
+ [TestCase(true, "IsValueType")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool IsValueType();
+ [TestCase(4, "SizeOf")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int SizeOf();
+#if NET6_0_OR_GREATER
+ [TestCase("3.4028235E+38", "ToString", float.MaxValue)]
+ [TestCase("-3.4028235E+38", "ToString", float.MinValue)]
+#else
+ [TestCase("3.402823E+38", "ToString", float.MaxValue)]
+ [TestCase("-3.402823E+38", "ToString", float.MinValue)]
+#endif
public static string ToString(float value)
{
return value.ToString();
}
+ [TestCase(float.MaxValue, "TryParse", "3.40282347E+38")]
+ [TestCase(float.MinValue, "TryParse", "-3.40282347E+38")]
public static float TryParse(string str)
{
float.TryParse(str, out var value);
diff --git a/tests/IL2C.Core.Test.BasicTypes/System_Single/System_Single.il b/tests/IL2C.Core.Test.BasicTypes/System_Single/System_Single.il
index f1084224..9d697111 100644
--- a/tests/IL2C.Core.Test.BasicTypes/System_Single/System_Single.il
+++ b/tests/IL2C.Core.Test.BasicTypes/System_Single/System_Single.il
@@ -6,7 +6,7 @@
ldc.r4 12345.67
box float32
isinst [netstandard]System.ValueType
- brnull.s F1
+ brfalse.s F1
ldc.i4.1
ret
F1:
diff --git a/tests/IL2C.Core.Test.BasicTypes/System_String/System_String.cs b/tests/IL2C.Core.Test.BasicTypes/System_String/System_String.cs
index aa02d763..5a10967b 100644
--- a/tests/IL2C.Core.Test.BasicTypes/System_String/System_String.cs
+++ b/tests/IL2C.Core.Test.BasicTypes/System_String/System_String.cs
@@ -12,80 +12,68 @@
namespace IL2C.BasicTypes
{
- [TestCase(false, "IsValueType")]
- [TestCase("ABC", "ToString", "ABC")]
- [TestCase("ABCDEF", "Concat", "ABC", "DEF")]
- [TestCase("CDEFGH", "Substring", "ABCDEFGH", 2)]
- [TestCase("CDE", "Substring1", "ABCDEFGH", 2, 3)]
- [TestCase('A', "Indexer", "ABCDEFGH", 0)]
- [TestCase('H', "Indexer", "ABCDEFGH", 7)]
- [TestCase(8, "Length", "ABCDEFGH")]
- [TestCase(false, "IsNullOrWhiteSpace", "ABCDEFGH")]
- [TestCase(true, "IsNullOrWhiteSpace", "")]
- [TestCase(true, "IsNullOrWhiteSpace", null!)]
- [TestCase(true, "Equals1", "ABC", "ABC")]
- [TestCase(false, "Equals1", "ABC", "ABCDEF")]
- [TestCase(false, "Equals1", "ABC", "DEF")]
- [TestCase(false, "IndexOutOfRange", "ABC", 0)]
- [TestCase(false, "IndexOutOfRange", "ABC", 2)]
- [TestCase(true, "IndexOutOfRange", "ABC", -1)]
- [TestCase(true, "IndexOutOfRange", "ABC", 3)]
- [TestCase(true, "Equality", "ABC", "ABC")]
- [TestCase(false, "Equality", "ABC", "ABCDEF")]
- [TestCase(false, "Equality", "ABC", "DEF")]
- [TestCase(false, "Equality", "ABC", null)]
- [TestCase(false, "Equality", null, "DEF")]
- [TestCase(true, "Equality", null, null)]
- [TestCase(false, "Inequality", "ABC", "ABC")]
- [TestCase(true, "Inequality", "ABC", "ABCDEF")]
- [TestCase(true, "Inequality", "ABC", "DEF")]
- [TestCase(true, "Inequality", "ABC", null)]
- [TestCase(true, "Inequality", null, "DEF")]
- [TestCase(false, "Inequality", null, null)]
public sealed class System_String
{
// NOTE: ToString and Equals are written by IL.
// Because they are compiled with callvirt opcode from Roslyn.
+ [TestCase(false, "IsValueType")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool IsValueType();
+ [TestCase("ABC", "ToString", "ABC")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string ToString(string value);
+ [TestCase("ABCDEF", "Concat", "ABC", "DEF")]
public static string Concat(string value1, string value2)
{
return string.Concat(value1, value2);
}
+ [TestCase("CDEFGH", "Substring", "ABCDEFGH", 2)]
public static string Substring(string str, int index)
{
return str.Substring(index);
}
+ [TestCase("CDE", "Substring1", "ABCDEFGH", 2, 3)]
public static string Substring1(string str, int index, int count)
{
return str.Substring(index, count);
}
+ [TestCase('A', "Indexer", "ABCDEFGH", 0)]
+ [TestCase('H', "Indexer", "ABCDEFGH", 7)]
public static char Indexer(string str, int index)
{
return str[index];
}
+ [TestCase(8, "Length", "ABCDEFGH")]
public static int Length(string str)
{
return str.Length;
}
+ [TestCase(false, "IsNullOrWhiteSpace", "ABCDEFGH")]
+ [TestCase(true, "IsNullOrWhiteSpace", "")]
+ [TestCase(true, "IsNullOrWhiteSpace", null!)]
public static bool IsNullOrWhiteSpace(string str)
{
return string.IsNullOrWhiteSpace(str);
}
+ [TestCase(true, "Equals1", "ABC", "ABC")]
+ [TestCase(false, "Equals1", "ABC", "ABCDEF")]
+ [TestCase(false, "Equals1", "ABC", "DEF")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool Equals1(string value1, string value2);
+ [TestCase(false, "IndexOutOfRange", "ABC", 0)]
+ [TestCase(false, "IndexOutOfRange", "ABC", 2)]
+ [TestCase(true, "IndexOutOfRange", "ABC", -1)]
+ [TestCase(true, "IndexOutOfRange", "ABC", 3)]
public static bool IndexOutOfRange(string str, int index)
{
try
@@ -99,11 +87,23 @@ public static bool IndexOutOfRange(string str, int index)
return false;
}
+ [TestCase(true, "Equality", "ABC", "ABC")]
+ [TestCase(false, "Equality", "ABC", "ABCDEF")]
+ [TestCase(false, "Equality", "ABC", "DEF")]
+ [TestCase(false, "Equality", "ABC", null)]
+ [TestCase(false, "Equality", null, "DEF")]
+ [TestCase(true, "Equality", null, null)]
public static bool Equality(string value1, string value2)
{
return value1 == value2;
}
+ [TestCase(false, "Inequality", "ABC", "ABC")]
+ [TestCase(true, "Inequality", "ABC", "ABCDEF")]
+ [TestCase(true, "Inequality", "ABC", "DEF")]
+ [TestCase(true, "Inequality", "ABC", null)]
+ [TestCase(true, "Inequality", null, "DEF")]
+ [TestCase(false, "Inequality", null, null)]
public static bool Inequality(string value1, string value2)
{
return value1 != value2;
diff --git a/tests/IL2C.Core.Test.BasicTypes/System_String/System_String.il b/tests/IL2C.Core.Test.BasicTypes/System_String/System_String.il
index 7a323566..4b08aeb7 100644
--- a/tests/IL2C.Core.Test.BasicTypes/System_String/System_String.il
+++ b/tests/IL2C.Core.Test.BasicTypes/System_String/System_String.il
@@ -5,7 +5,7 @@
.maxstack 2
ldstr "ABC"
isinst [netstandard]System.ValueType
- brnull.s F1
+ brfalse.s F1
ldc.i4.1
ret
F1:
diff --git a/tests/IL2C.Core.Test.BasicTypes/System_String/System_String_Format1.cs b/tests/IL2C.Core.Test.BasicTypes/System_String/System_String_Format1.cs
index d20c7ff7..24d09ec7 100644
--- a/tests/IL2C.Core.Test.BasicTypes/System_String/System_String_Format1.cs
+++ b/tests/IL2C.Core.Test.BasicTypes/System_String/System_String_Format1.cs
@@ -19,7 +19,7 @@ public sealed class Format11_CustomProducer
public sealed class Format12_CustomProducer : IFormattable
{
- public string ToString(string format, IFormatProvider formatProvider)
+ public string ToString(string? format, IFormatProvider? formatProvider)
{
switch (format)
{
@@ -32,59 +32,59 @@ public string ToString(string format, IFormatProvider formatProvider)
}
[TestId("System_String")]
- [TestCase("ABC123DEF", "Format1", "ABC{0}DEF", (byte)123)]
- [TestCase("ABC-123DEF", "Format1", "ABC{0}DEF", (sbyte)-123)]
- [TestCase("ABC-12345DEF", "Format1", "ABC{0}DEF", (short)-12345)]
- [TestCase("ABC12345DEF", "Format1", "ABC{0}DEF", (ushort)12345)]
- [TestCase("ABC1234567DEF", "Format1", "ABC{0}DEF", 1234567)]
- [TestCase("ABC-1234567DEF", "Format1", "ABC{0}DEF", -1234567)]
- [TestCase("ABC1234567890123DEF", "Format1", "ABC{0}DEF", 1234567890123)]
- [TestCase("ABC-1234567890123DEF", "Format1", "ABC{0}DEF", -1234567890123)]
- [TestCase("ABC123.456DEF", "Format1", "ABC{0}DEF", 123.456f)]
- [TestCase("ABC123.456789DEF", "Format1", "ABC{0}DEF", 123.456789)]
- [TestCase("ABCTrueDEF", "Format1", "ABC{0}DEF", true)]
- [TestCase("ABCFalseDEF", "Format1", "ABC{0}DEF", false)]
- [TestCase("ABCXDEF", "Format1", "ABC{0}DEF", 'X')]
- [TestCase("ABCXYZDEF", "Format1", "ABC{0}DEF", "XYZ")]
- [TestCase("ABCXYZDEF", "Format11_Custom", "ABC{0}DEF", IncludeTypes = new[] { typeof(Format11_CustomProducer) })]
- [TestCase("ABCXYZDEF", "Format11_Custom", "ABC{0:}DEF", IncludeTypes = new[] { typeof(Format11_CustomProducer) })]
- [TestCase("ABCXYZDEF", "Format11_Custom", "ABC{0:N}DEF", IncludeTypes = new[] { typeof(Format11_CustomProducer) })]
- [TestCase("ABC333DEF", "Format12_Custom", "ABC{0}DEF", IncludeTypes = new[] { typeof(Format12_CustomProducer) })]
- [TestCase("ABC333DEF", "Format12_Custom", "ABC{0:}DEF", IncludeTypes = new[] { typeof(Format12_CustomProducer) })]
- [TestCase("ABC111DEF", "Format12_Custom", "ABC{0:N}DEF", IncludeTypes = new[] { typeof(Format12_CustomProducer) })]
- [TestCase("123ABCDEF", "Format1", "{0}ABCDEF", 123)]
- [TestCase("ABCDEF123", "Format1", "ABCDEF{0}", 123)]
- [TestCase("123ABC123DEF123", "Format1", "{0}ABC{0}DEF{0}", 123)]
- [TestCase("ABCDEF", "Format1", "ABCDEF", 123)]
- [TestCase("ABCDEF", "Format1", "ABC{0}DEF", "")]
- [TestCase("ABCDEF", "Format1", "ABC{0}DEF", null)]
- [TestCase(true, "Format1_Exception", "ABC{", 123)]
- [TestCase(true, "Format1_Exception", "ABC{0", 123)]
- [TestCase(true, "Format1_Exception", "ABC{0:", 123)]
- [TestCase(true, "Format1_Exception", "ABC{}DEF", 123)]
- [TestCase(true, "Format1_Exception", "ABC{A}DEF", 123)]
- [TestCase(true, "Format1_Exception", "ABC{:}DEF", 123)]
- [TestCase(true, "Format1_Exception", "ABC{12345678901234}DEF", 123)]
- [TestCase(true, "Format1_Exception", "ABC{1}DEF", 123)]
public sealed class System_String_Format1
{
+ [TestCase("ABC123DEF", "Format1", "ABC{0}DEF", (byte)123)]
+ [TestCase("ABC-123DEF", "Format1", "ABC{0}DEF", (sbyte)-123)]
+ [TestCase("ABC-12345DEF", "Format1", "ABC{0}DEF", (short)-12345)]
+ [TestCase("ABC12345DEF", "Format1", "ABC{0}DEF", (ushort)12345)]
+ [TestCase("ABC1234567DEF", "Format1", "ABC{0}DEF", 1234567)]
+ [TestCase("ABC-1234567DEF", "Format1", "ABC{0}DEF", -1234567)]
+ [TestCase("ABC1234567890123DEF", "Format1", "ABC{0}DEF", 1234567890123)]
+ [TestCase("ABC-1234567890123DEF", "Format1", "ABC{0}DEF", -1234567890123)]
+ [TestCase("ABC123.456DEF", "Format1", "ABC{0}DEF", 123.456f)]
+ [TestCase("ABC123.456789DEF", "Format1", "ABC{0}DEF", 123.456789)]
+ [TestCase("ABCTrueDEF", "Format1", "ABC{0}DEF", true)]
+ [TestCase("ABCFalseDEF", "Format1", "ABC{0}DEF", false)]
+ [TestCase("ABCXDEF", "Format1", "ABC{0}DEF", 'X')]
+ [TestCase("ABCXYZDEF", "Format1", "ABC{0}DEF", "XYZ")]
+ [TestCase("123ABCDEF", "Format1", "{0}ABCDEF", 123)]
+ [TestCase("ABCDEF123", "Format1", "ABCDEF{0}", 123)]
+ [TestCase("123ABC123DEF123", "Format1", "{0}ABC{0}DEF{0}", 123)]
+ [TestCase("ABCDEF", "Format1", "ABCDEF", 123)]
+ [TestCase("ABCDEF", "Format1", "ABC{0}DEF", "")]
+ [TestCase("ABCDEF", "Format1", "ABC{0}DEF", null)]
public static string Format1(string format, object value0)
{
return string.Format(format, value0);
}
+ [TestCase("ABCXYZDEF", "Format11_Custom", "ABC{0}DEF", IncludeTypes = new[] { typeof(Format11_CustomProducer) })]
+ [TestCase("ABCXYZDEF", "Format11_Custom", "ABC{0:}DEF", IncludeTypes = new[] { typeof(Format11_CustomProducer) })]
+ [TestCase("ABCXYZDEF", "Format11_Custom", "ABC{0:N}DEF", IncludeTypes = new[] { typeof(Format11_CustomProducer) })]
public static string Format11_Custom(string format)
{
var cp = new Format11_CustomProducer();
return string.Format(format, cp);
}
+ [TestCase("ABC333DEF", "Format12_Custom", "ABC{0}DEF", IncludeTypes = new[] { typeof(Format12_CustomProducer) })]
+ [TestCase("ABC333DEF", "Format12_Custom", "ABC{0:}DEF", IncludeTypes = new[] { typeof(Format12_CustomProducer) })]
+ [TestCase("ABC111DEF", "Format12_Custom", "ABC{0:N}DEF", IncludeTypes = new[] { typeof(Format12_CustomProducer) })]
public static string Format12_Custom(string format)
{
var cp = new Format12_CustomProducer();
return string.Format(format, cp);
}
+ [TestCase(true, "Format1_Exception", "ABC{", 123)]
+ [TestCase(true, "Format1_Exception", "ABC{0", 123)]
+ [TestCase(true, "Format1_Exception", "ABC{0:", 123)]
+ [TestCase(true, "Format1_Exception", "ABC{}DEF", 123)]
+ [TestCase(true, "Format1_Exception", "ABC{A}DEF", 123)]
+ [TestCase(true, "Format1_Exception", "ABC{:}DEF", 123)]
+ [TestCase(true, "Format1_Exception", "ABC{12345678901234}DEF", 123)]
+ [TestCase(true, "Format1_Exception", "ABC{1}DEF", 123)]
public static bool Format1_Exception(string format, object value0)
{
try
diff --git a/tests/IL2C.Core.Test.BasicTypes/System_String/System_String_Format2.cs b/tests/IL2C.Core.Test.BasicTypes/System_String/System_String_Format2.cs
index 7021c9ff..1b1388b0 100644
--- a/tests/IL2C.Core.Test.BasicTypes/System_String/System_String_Format2.cs
+++ b/tests/IL2C.Core.Test.BasicTypes/System_String/System_String_Format2.cs
@@ -19,7 +19,7 @@ public sealed class Format21_CustomProducer
public sealed class Format22_CustomProducer : IFormattable
{
- public string ToString(string format, IFormatProvider formatProvider)
+ public string ToString(string? format, IFormatProvider? formatProvider)
{
switch (format)
{
@@ -32,39 +32,34 @@ public string ToString(string format, IFormatProvider formatProvider)
}
[TestId("System_String")]
- [TestCase("AB123CD124EF", "Format2", "AB{0}CD{1}EF", (byte)123, (byte)124)]
- [TestCase("AB-123CD-124EF", "Format2", "AB{0}CD{1}EF", (sbyte)-123, (sbyte)-124)]
- [TestCase("AB-12345CD-12346EF", "Format2", "AB{0}CD{1}EF", (short)-12345, (short)-12346)]
- [TestCase("AB12345CD12346EF", "Format2", "AB{0}CD{1}EF", (ushort)12345, (ushort)12346)]
- [TestCase("AB1234567CD1234568EF", "Format2", "AB{0}CD{1}EF", 1234567, 1234568)]
- [TestCase("AB-1234567CD-1234568EF", "Format2", "AB{0}CD{1}EF", -1234567, -1234568)]
- [TestCase("AB1234567890123CD1234567890124EF", "Format2", "AB{0}CD{1}EF", 1234567890123, 1234567890124)]
- [TestCase("AB-1234567890123CD-1234567890124EF", "Format2", "AB{0}CD{1}EF", -1234567890123, -1234567890124)]
- [TestCase("AB123.456CD123.457EF", "Format2", "AB{0}CD{1}EF", 123.456f, 123.457f)]
- [TestCase("AB123.456789CD123.456788EF", "Format2", "AB{0}CD{1}EF", 123.456789, 123.456788)]
- [TestCase("ABTrueCDFalseEF", "Format2", "AB{0}CD{1}EF", true, false)]
- [TestCase("ABXCDYEF", "Format2", "AB{0}CD{1}EF", 'X', 'Y')]
- [TestCase("ABXYZCDPQREF", "Format2", "AB{0}CD{1}EF", "XYZ", "PQR")]
- [TestCase("ABXYZCDPQREF", "Format21_Custom", "AB{0}CD{1}EF", IncludeTypes = new[] { typeof(Format11_CustomProducer), typeof(Format21_CustomProducer) })]
- [TestCase("ABXYZCDPQREF", "Format21_Custom", "AB{0:}CD{1:}EF", IncludeTypes = new[] { typeof(Format11_CustomProducer), typeof(Format21_CustomProducer) })]
- [TestCase("ABXYZCDPQREF", "Format21_Custom", "AB{0:N}CD{1:N}EF", IncludeTypes = new[] { typeof(Format11_CustomProducer), typeof(Format21_CustomProducer) })]
- [TestCase("AB333CD666EF", "Format22_Custom", "AB{0}CD{1}EF", IncludeTypes = new[] { typeof(Format12_CustomProducer), typeof(Format22_CustomProducer) })]
- [TestCase("AB333CD666EF", "Format22_Custom", "AB{0:}CD{1:}EF", IncludeTypes = new[] { typeof(Format12_CustomProducer), typeof(Format22_CustomProducer) })]
- [TestCase("AB111CD444EF", "Format22_Custom", "AB{0:N}CD{1:N}EF", IncludeTypes = new[] { typeof(Format12_CustomProducer), typeof(Format22_CustomProducer) })]
- [TestCase("123ABCDEF124", "Format2", "{0}ABCDEF{1}", 123, 124)]
- [TestCase("123ABC124DEF123", "Format2", "{0}ABC{1}DEF{0}", 123, 124)]
- [TestCase("A333B111C666D444E", "Format22_Custom", "A{0}B{0:N}C{1}D{1:N}E", IncludeTypes = new[] { typeof(Format12_CustomProducer), typeof(Format22_CustomProducer) })]
- [TestCase("ABCDEF", "Format2", "ABCDEF", 123, 124)]
- [TestCase("ABCDEF", "Format2", "AB{0}CD{1}EF", "", "")]
- [TestCase("ABCDEF", "Format2", "AB{0}CD{1}EF", null, null)]
- [TestCase(true, "Format2_Exception", "ABC{2}DEF", 123, 124)]
public sealed class System_String_Format2
{
+ [TestCase("AB123CD124EF", "Format2", "AB{0}CD{1}EF", (byte)123, (byte)124)]
+ [TestCase("AB-123CD-124EF", "Format2", "AB{0}CD{1}EF", (sbyte)-123, (sbyte)-124)]
+ [TestCase("AB-12345CD-12346EF", "Format2", "AB{0}CD{1}EF", (short)-12345, (short)-12346)]
+ [TestCase("AB12345CD12346EF", "Format2", "AB{0}CD{1}EF", (ushort)12345, (ushort)12346)]
+ [TestCase("AB1234567CD1234568EF", "Format2", "AB{0}CD{1}EF", 1234567, 1234568)]
+ [TestCase("AB-1234567CD-1234568EF", "Format2", "AB{0}CD{1}EF", -1234567, -1234568)]
+ [TestCase("AB1234567890123CD1234567890124EF", "Format2", "AB{0}CD{1}EF", 1234567890123, 1234567890124)]
+ [TestCase("AB-1234567890123CD-1234567890124EF", "Format2", "AB{0}CD{1}EF", -1234567890123, -1234567890124)]
+ [TestCase("AB123.456CD123.457EF", "Format2", "AB{0}CD{1}EF", 123.456f, 123.457f)]
+ [TestCase("AB123.456789CD123.456788EF", "Format2", "AB{0}CD{1}EF", 123.456789, 123.456788)]
+ [TestCase("ABTrueCDFalseEF", "Format2", "AB{0}CD{1}EF", true, false)]
+ [TestCase("ABXCDYEF", "Format2", "AB{0}CD{1}EF", 'X', 'Y')]
+ [TestCase("ABXYZCDPQREF", "Format2", "AB{0}CD{1}EF", "XYZ", "PQR")]
+ [TestCase("123ABCDEF124", "Format2", "{0}ABCDEF{1}", 123, 124)]
+ [TestCase("123ABC124DEF123", "Format2", "{0}ABC{1}DEF{0}", 123, 124)]
+ [TestCase("ABCDEF", "Format2", "ABCDEF", 123, 124)]
+ [TestCase("ABCDEF", "Format2", "AB{0}CD{1}EF", "", "")]
+ [TestCase("ABCDEF", "Format2", "AB{0}CD{1}EF", null, null)]
public static string Format2(string format, object value0, object value1)
{
return string.Format(format, value0, value1);
}
+ [TestCase("ABXYZCDPQREF", "Format21_Custom", "AB{0}CD{1}EF", IncludeTypes = new[] { typeof(Format11_CustomProducer), typeof(Format21_CustomProducer) })]
+ [TestCase("ABXYZCDPQREF", "Format21_Custom", "AB{0:}CD{1:}EF", IncludeTypes = new[] { typeof(Format11_CustomProducer), typeof(Format21_CustomProducer) })]
+ [TestCase("ABXYZCDPQREF", "Format21_Custom", "AB{0:N}CD{1:N}EF", IncludeTypes = new[] { typeof(Format11_CustomProducer), typeof(Format21_CustomProducer) })]
public static string Format21_Custom(string format)
{
var cp1 = new Format11_CustomProducer();
@@ -72,6 +67,10 @@ public static string Format21_Custom(string format)
return string.Format(format, cp1, cp2);
}
+ [TestCase("AB333CD666EF", "Format22_Custom", "AB{0}CD{1}EF", IncludeTypes = new[] { typeof(Format12_CustomProducer), typeof(Format22_CustomProducer) })]
+ [TestCase("AB333CD666EF", "Format22_Custom", "AB{0:}CD{1:}EF", IncludeTypes = new[] { typeof(Format12_CustomProducer), typeof(Format22_CustomProducer) })]
+ [TestCase("AB111CD444EF", "Format22_Custom", "AB{0:N}CD{1:N}EF", IncludeTypes = new[] { typeof(Format12_CustomProducer), typeof(Format22_CustomProducer) })]
+ [TestCase("A333B111C666D444E", "Format22_Custom", "A{0}B{0:N}C{1}D{1:N}E", IncludeTypes = new[] { typeof(Format12_CustomProducer), typeof(Format22_CustomProducer) })]
public static string Format22_Custom(string format)
{
var cp1 = new Format12_CustomProducer();
@@ -79,6 +78,7 @@ public static string Format22_Custom(string format)
return string.Format(format, cp1, cp2);
}
+ [TestCase(true, "Format2_Exception", "ABC{2}DEF", 123, 124)]
public static bool Format2_Exception(string format, object value0, object value1)
{
try
diff --git a/tests/IL2C.Core.Test.BasicTypes/System_String/System_String_Format3.cs b/tests/IL2C.Core.Test.BasicTypes/System_String/System_String_Format3.cs
index 53415fb8..8bd3af36 100644
--- a/tests/IL2C.Core.Test.BasicTypes/System_String/System_String_Format3.cs
+++ b/tests/IL2C.Core.Test.BasicTypes/System_String/System_String_Format3.cs
@@ -19,7 +19,7 @@ public sealed class Format31_CustomProducer
public sealed class Format32_CustomProducer : IFormattable
{
- public string ToString(string format, IFormatProvider formatProvider)
+ public string ToString(string? format, IFormatProvider? formatProvider)
{
switch (format)
{
@@ -32,39 +32,34 @@ public string ToString(string format, IFormatProvider formatProvider)
}
[TestId("System_String")]
- [TestCase("A123BC124DE125F", "Format3", "A{0}BC{1}DE{2}F", (byte)123, (byte)124, (byte)125)]
- [TestCase("A-123BC-124DE-125F", "Format3", "A{0}BC{1}DE{2}F", (sbyte)-123, (sbyte)-124, (sbyte)-125)]
- [TestCase("A-12345BC-12346DE-12347F", "Format3", "A{0}BC{1}DE{2}F", (short)-12345, (short)-12346, (short)-12347)]
- [TestCase("A12345BC12346DE12347F", "Format3", "A{0}BC{1}DE{2}F", (ushort)12345, (ushort)12346, (ushort)12347)]
- [TestCase("A1234567BC1234568DE1234569F", "Format3", "A{0}BC{1}DE{2}F", 1234567, 1234568, 1234569)]
- [TestCase("A-1234567BC-1234568DE-1234569F", "Format3", "A{0}BC{1}DE{2}F", -1234567, -1234568, -1234569)]
- [TestCase("A1234567890123BC1234567890124DE1234567890125F", "Format3", "A{0}BC{1}DE{2}F", 1234567890123, 1234567890124, 1234567890125)]
- [TestCase("A-1234567890123BC-1234567890124DE-1234567890125F", "Format3", "A{0}BC{1}DE{2}F", -1234567890123, -1234567890124, -1234567890125)]
- [TestCase("A123.456BC123.457DE123.458F", "Format3", "A{0}BC{1}DE{2}F", 123.456f, 123.457f, 123.458f)]
- [TestCase("A123.456789BC123.456788DE123.456787F", "Format3", "A{0}BC{1}DE{2}F", 123.456789, 123.456788, 123.456787)]
- [TestCase("ATrueBCFalseDETrueF", "Format3", "A{0}BC{1}DE{2}F", true, false, true)]
- [TestCase("AXBCYDEZF", "Format3", "A{0}BC{1}DE{2}F", 'X', 'Y', 'Z')]
- [TestCase("AXYZBCPQRDESTUF", "Format3", "A{0}BC{1}DE{2}F", "XYZ", "PQR", "STU")]
- [TestCase("AXYZBCPQRDESTUF", "Format31_Custom", "A{0}BC{1}DE{2}F", IncludeTypes = new[] { typeof(Format11_CustomProducer), typeof(Format21_CustomProducer), typeof(Format31_CustomProducer) })]
- [TestCase("AXYZBCPQRDESTUF", "Format31_Custom", "A{0:}BC{1:}DE{2:}F", IncludeTypes = new[] { typeof(Format11_CustomProducer), typeof(Format21_CustomProducer), typeof(Format31_CustomProducer) })]
- [TestCase("AXYZBCPQRDESTUF", "Format31_Custom", "A{0:N}BC{1:N}DE{2:N}F", IncludeTypes = new[] { typeof(Format11_CustomProducer), typeof(Format21_CustomProducer), typeof(Format31_CustomProducer) })]
- [TestCase("A333BC666DE999F", "Format32_Custom", "A{0}BC{1}DE{2}F", IncludeTypes = new[] { typeof(Format12_CustomProducer), typeof(Format22_CustomProducer), typeof(Format32_CustomProducer) })]
- [TestCase("A333BC666DE999F", "Format32_Custom", "A{0:}BC{1:}DE{2:}F", IncludeTypes = new[] { typeof(Format12_CustomProducer), typeof(Format22_CustomProducer), typeof(Format32_CustomProducer) })]
- [TestCase("A111BC444DE777F", "Format32_Custom", "A{0:N}BC{1:N}DE{2:N}F", IncludeTypes = new[] { typeof(Format12_CustomProducer), typeof(Format22_CustomProducer), typeof(Format32_CustomProducer) })]
- [TestCase("123A123B124C124D125E125", "Format3", "{0}A{0}B{1}C{1}D{2}E{2}", 123, 124, 125)]
- [TestCase("A125BC124DE123F", "Format3", "A{2}BC{1}DE{0}F", 123, 124, 125)]
- [TestCase("A333B111C666D444E999F777G", "Format32_Custom", "A{0}B{0:N}C{1}D{1:N}E{2}F{2:N}G", IncludeTypes = new[] { typeof(Format12_CustomProducer), typeof(Format22_CustomProducer), typeof(Format32_CustomProducer) })]
- [TestCase("ABCDEF", "Format3", "ABCDEF", 123, 124, 125)]
- [TestCase("ABCDEF", "Format3", "A{0}BC{1}DE{2}F", "", "", "")]
- [TestCase("ABCDEF", "Format3", "A{0}BC{1}DE{2}F", null, null, null)]
- [TestCase(true, "Format3_Exception", "ABC{3}DEF", 123, 124, 125)]
public sealed class System_String_Format3
{
+ [TestCase("A123BC124DE125F", "Format3", "A{0}BC{1}DE{2}F", (byte)123, (byte)124, (byte)125)]
+ [TestCase("A-123BC-124DE-125F", "Format3", "A{0}BC{1}DE{2}F", (sbyte)-123, (sbyte)-124, (sbyte)-125)]
+ [TestCase("A-12345BC-12346DE-12347F", "Format3", "A{0}BC{1}DE{2}F", (short)-12345, (short)-12346, (short)-12347)]
+ [TestCase("A12345BC12346DE12347F", "Format3", "A{0}BC{1}DE{2}F", (ushort)12345, (ushort)12346, (ushort)12347)]
+ [TestCase("A1234567BC1234568DE1234569F", "Format3", "A{0}BC{1}DE{2}F", 1234567, 1234568, 1234569)]
+ [TestCase("A-1234567BC-1234568DE-1234569F", "Format3", "A{0}BC{1}DE{2}F", -1234567, -1234568, -1234569)]
+ [TestCase("A1234567890123BC1234567890124DE1234567890125F", "Format3", "A{0}BC{1}DE{2}F", 1234567890123, 1234567890124, 1234567890125)]
+ [TestCase("A-1234567890123BC-1234567890124DE-1234567890125F", "Format3", "A{0}BC{1}DE{2}F", -1234567890123, -1234567890124, -1234567890125)]
+ [TestCase("A123.456BC123.457DE123.458F", "Format3", "A{0}BC{1}DE{2}F", 123.456f, 123.457f, 123.458f)]
+ [TestCase("A123.456789BC123.456788DE123.456787F", "Format3", "A{0}BC{1}DE{2}F", 123.456789, 123.456788, 123.456787)]
+ [TestCase("ATrueBCFalseDETrueF", "Format3", "A{0}BC{1}DE{2}F", true, false, true)]
+ [TestCase("AXBCYDEZF", "Format3", "A{0}BC{1}DE{2}F", 'X', 'Y', 'Z')]
+ [TestCase("AXYZBCPQRDESTUF", "Format3", "A{0}BC{1}DE{2}F", "XYZ", "PQR", "STU")]
+ [TestCase("123A123B124C124D125E125", "Format3", "{0}A{0}B{1}C{1}D{2}E{2}", 123, 124, 125)]
+ [TestCase("A125BC124DE123F", "Format3", "A{2}BC{1}DE{0}F", 123, 124, 125)]
+ [TestCase("ABCDEF", "Format3", "ABCDEF", 123, 124, 125)]
+ [TestCase("ABCDEF", "Format3", "A{0}BC{1}DE{2}F", "", "", "")]
+ [TestCase("ABCDEF", "Format3", "A{0}BC{1}DE{2}F", null, null, null)]
public static string Format3(string format, object value0, object value1, object value2)
{
return string.Format(format, value0, value1, value2);
}
+ [TestCase("AXYZBCPQRDESTUF", "Format31_Custom", "A{0}BC{1}DE{2}F", IncludeTypes = new[] { typeof(Format11_CustomProducer), typeof(Format21_CustomProducer), typeof(Format31_CustomProducer) })]
+ [TestCase("AXYZBCPQRDESTUF", "Format31_Custom", "A{0:}BC{1:}DE{2:}F", IncludeTypes = new[] { typeof(Format11_CustomProducer), typeof(Format21_CustomProducer), typeof(Format31_CustomProducer) })]
+ [TestCase("AXYZBCPQRDESTUF", "Format31_Custom", "A{0:N}BC{1:N}DE{2:N}F", IncludeTypes = new[] { typeof(Format11_CustomProducer), typeof(Format21_CustomProducer), typeof(Format31_CustomProducer) })]
public static string Format31_Custom(string format)
{
var cp1 = new Format11_CustomProducer();
@@ -73,6 +68,10 @@ public static string Format31_Custom(string format)
return string.Format(format, cp1, cp2, cp3);
}
+ [TestCase("A333BC666DE999F", "Format32_Custom", "A{0}BC{1}DE{2}F", IncludeTypes = new[] { typeof(Format12_CustomProducer), typeof(Format22_CustomProducer), typeof(Format32_CustomProducer) })]
+ [TestCase("A333BC666DE999F", "Format32_Custom", "A{0:}BC{1:}DE{2:}F", IncludeTypes = new[] { typeof(Format12_CustomProducer), typeof(Format22_CustomProducer), typeof(Format32_CustomProducer) })]
+ [TestCase("A111BC444DE777F", "Format32_Custom", "A{0:N}BC{1:N}DE{2:N}F", IncludeTypes = new[] { typeof(Format12_CustomProducer), typeof(Format22_CustomProducer), typeof(Format32_CustomProducer) })]
+ [TestCase("A333B111C666D444E999F777G", "Format32_Custom", "A{0}B{0:N}C{1}D{1:N}E{2}F{2:N}G", IncludeTypes = new[] { typeof(Format12_CustomProducer), typeof(Format22_CustomProducer), typeof(Format32_CustomProducer) })]
public static string Format32_Custom(string format)
{
var cp1 = new Format12_CustomProducer();
@@ -81,6 +80,7 @@ public static string Format32_Custom(string format)
return string.Format(format, cp1, cp2, cp3);
}
+ [TestCase(true, "Format3_Exception", "ABC{3}DEF", 123, 124, 125)]
public static bool Format3_Exception(string format, object value0, object value1, object value2)
{
try
diff --git a/tests/IL2C.Core.Test.BasicTypes/System_String/System_String_Format_Params.cs b/tests/IL2C.Core.Test.BasicTypes/System_String/System_String_Format_Params.cs
index 2c77f749..625780da 100644
--- a/tests/IL2C.Core.Test.BasicTypes/System_String/System_String_Format_Params.cs
+++ b/tests/IL2C.Core.Test.BasicTypes/System_String/System_String_Format_Params.cs
@@ -19,7 +19,7 @@ public sealed class Format41_CustomProducer
public sealed class Format42_CustomProducer : IFormattable
{
- public string ToString(string format, IFormatProvider formatProvider)
+ public string ToString(string? format, IFormatProvider? formatProvider)
{
switch (format)
{
@@ -32,39 +32,34 @@ public string ToString(string format, IFormatProvider formatProvider)
}
[TestId("System_String")]
- [TestCase("A123BC124DE125FG126H", "Format_Params", "A{0}BC{1}DE{2}FG{3}H", (byte)123, (byte)124, (byte)125, (byte)126)]
- [TestCase("A-123BC-124DE-125FG-126H", "Format_Params", "A{0}BC{1}DE{2}FG{3}H", (sbyte)-123, (sbyte)-124, (sbyte)-125, (sbyte)-126)]
- [TestCase("A-12345BC-12346DE-12347FG-12348H", "Format_Params", "A{0}BC{1}DE{2}FG{3}H", (short)-12345, (short)-12346, (short)-12347, (short)-12348)]
- [TestCase("A12345BC12346DE12347FG12348H", "Format_Params", "A{0}BC{1}DE{2}FG{3}H", (ushort)12345, (ushort)12346, (ushort)12347, (ushort)12348)]
- [TestCase("A1234567BC1234568DE1234569FG1234570H", "Format_Params", "A{0}BC{1}DE{2}FG{3}H", 1234567, 1234568, 1234569, 1234570)]
- [TestCase("A-1234567BC-1234568DE-1234569FG-1234570H", "Format_Params", "A{0}BC{1}DE{2}FG{3}H", -1234567, -1234568, -1234569, -1234570)]
- [TestCase("A1234567890123BC1234567890124DE1234567890125FG1234567890126H", "Format_Params", "A{0}BC{1}DE{2}FG{3}H", 1234567890123, 1234567890124, 1234567890125, 1234567890126)]
- [TestCase("A-1234567890123BC-1234567890124DE-1234567890125FG-1234567890126H", "Format_Params", "A{0}BC{1}DE{2}FG{3}H", -1234567890123, -1234567890124, -1234567890125, -1234567890126)]
- [TestCase("A123.456BC123.457DE123.458FG123.459H", "Format_Params", "A{0}BC{1}DE{2}FG{3}H", 123.456f, 123.457f, 123.458f, 123.459f)]
- [TestCase("A123.456789BC123.456788DE123.456787FG123.456786H", "Format_Params", "A{0}BC{1}DE{2}FG{3}H", 123.456789, 123.456788, 123.456787, 123.456786)]
- [TestCase("ATrueBCFalseDETrueFGFalseH", "Format_Params", "A{0}BC{1}DE{2}FG{3}H", true, false, true, false)]
- [TestCase("AXBCYDEZFGPH", "Format_Params", "A{0}BC{1}DE{2}FG{3}H", 'X', 'Y', 'Z', 'P')]
- [TestCase("AXYZBCPQRDESTUFGFGHH", "Format_Params", "A{0}BC{1}DE{2}FG{3}H", "XYZ", "PQR", "STU", "FGH")]
- [TestCase("AXYZBCPQRDESTUFGFGHH", "Format_Params_Custom1", "A{0}BC{1}DE{2}FG{3}H", IncludeTypes = new[] { typeof(Format11_CustomProducer), typeof(Format21_CustomProducer), typeof(Format31_CustomProducer), typeof(Format41_CustomProducer) })]
- [TestCase("AXYZBCPQRDESTUFGFGHH", "Format_Params_Custom1", "A{0:}BC{1:}DE{2:}FG{3:}H", IncludeTypes = new[] { typeof(Format11_CustomProducer), typeof(Format21_CustomProducer), typeof(Format31_CustomProducer), typeof(Format41_CustomProducer) })]
- [TestCase("AXYZBCPQRDESTUFGFGHH", "Format_Params_Custom1", "A{0:N}BC{1:N}DE{2:N}FG{3:N}H", IncludeTypes = new[] { typeof(Format11_CustomProducer), typeof(Format21_CustomProducer), typeof(Format31_CustomProducer), typeof(Format41_CustomProducer) })]
- [TestCase("A333BC666DE999FGZZZH", "Format_Params_Custom2", "A{0}BC{1}DE{2}FG{3}H", IncludeTypes = new[] { typeof(Format12_CustomProducer), typeof(Format22_CustomProducer), typeof(Format32_CustomProducer), typeof(Format42_CustomProducer) })]
- [TestCase("A333BC666DE999FGZZZH", "Format_Params_Custom2", "A{0:}BC{1:}DE{2:}FG{3:}H", IncludeTypes = new[] { typeof(Format12_CustomProducer), typeof(Format22_CustomProducer), typeof(Format32_CustomProducer), typeof(Format42_CustomProducer) })]
- [TestCase("A111BC444DE777FGXXXH", "Format_Params_Custom2", "A{0:N}BC{1:N}DE{2:N}FG{3:N}H", IncludeTypes = new[] { typeof(Format12_CustomProducer), typeof(Format22_CustomProducer), typeof(Format32_CustomProducer), typeof(Format42_CustomProducer) })]
- [TestCase("123A123B124C124D125E125F126", "Format_Params", "{0}A{0}B{1}C{1}D{2}E{2}F{3}", 123, 124, 125, 126)]
- [TestCase("A126BC125DE124FG123H", "Format_Params", "A{3}BC{2}DE{1}FG{0}H", 123, 124, 125, 126)]
- [TestCase("A333B111C666D444E999F777GZZZHXXXI", "Format_Params_Custom2", "A{0}B{0:N}C{1}D{1:N}E{2}F{2:N}G{3}H{3:N}I", IncludeTypes = new[] { typeof(Format12_CustomProducer), typeof(Format22_CustomProducer), typeof(Format32_CustomProducer), typeof(Format42_CustomProducer) })]
- [TestCase("ABCDEF", "Format_Params", "ABCDEF", 123, 124, 125, 126)]
- [TestCase("ABCDEFGH", "Format_Params", "A{0}BC{1}DE{2}FG{3}H", "", "", "", "")]
- [TestCase("ABCDEFGH", "Format_Params", "A{0}BC{1}DE{2}FG{3}H", null, null, null, null)]
- [TestCase(true, "Format_Params_Exception", "ABC{4}DEF", 123, 124, 125, 126)]
public sealed class System_String_Format_Params
{
+ [TestCase("A123BC124DE125FG126H", "Format_Params", "A{0}BC{1}DE{2}FG{3}H", (byte)123, (byte)124, (byte)125, (byte)126)]
+ [TestCase("A-123BC-124DE-125FG-126H", "Format_Params", "A{0}BC{1}DE{2}FG{3}H", (sbyte)-123, (sbyte)-124, (sbyte)-125, (sbyte)-126)]
+ [TestCase("A-12345BC-12346DE-12347FG-12348H", "Format_Params", "A{0}BC{1}DE{2}FG{3}H", (short)-12345, (short)-12346, (short)-12347, (short)-12348)]
+ [TestCase("A12345BC12346DE12347FG12348H", "Format_Params", "A{0}BC{1}DE{2}FG{3}H", (ushort)12345, (ushort)12346, (ushort)12347, (ushort)12348)]
+ [TestCase("A1234567BC1234568DE1234569FG1234570H", "Format_Params", "A{0}BC{1}DE{2}FG{3}H", 1234567, 1234568, 1234569, 1234570)]
+ [TestCase("A-1234567BC-1234568DE-1234569FG-1234570H", "Format_Params", "A{0}BC{1}DE{2}FG{3}H", -1234567, -1234568, -1234569, -1234570)]
+ [TestCase("A1234567890123BC1234567890124DE1234567890125FG1234567890126H", "Format_Params", "A{0}BC{1}DE{2}FG{3}H", 1234567890123, 1234567890124, 1234567890125, 1234567890126)]
+ [TestCase("A-1234567890123BC-1234567890124DE-1234567890125FG-1234567890126H", "Format_Params", "A{0}BC{1}DE{2}FG{3}H", -1234567890123, -1234567890124, -1234567890125, -1234567890126)]
+ [TestCase("A123.456BC123.457DE123.458FG123.459H", "Format_Params", "A{0}BC{1}DE{2}FG{3}H", 123.456f, 123.457f, 123.458f, 123.459f)]
+ [TestCase("A123.456789BC123.456788DE123.456787FG123.456786H", "Format_Params", "A{0}BC{1}DE{2}FG{3}H", 123.456789, 123.456788, 123.456787, 123.456786)]
+ [TestCase("ATrueBCFalseDETrueFGFalseH", "Format_Params", "A{0}BC{1}DE{2}FG{3}H", true, false, true, false)]
+ [TestCase("AXBCYDEZFGPH", "Format_Params", "A{0}BC{1}DE{2}FG{3}H", 'X', 'Y', 'Z', 'P')]
+ [TestCase("AXYZBCPQRDESTUFGFGHH", "Format_Params", "A{0}BC{1}DE{2}FG{3}H", "XYZ", "PQR", "STU", "FGH")]
+ [TestCase("123A123B124C124D125E125F126", "Format_Params", "{0}A{0}B{1}C{1}D{2}E{2}F{3}", 123, 124, 125, 126)]
+ [TestCase("A126BC125DE124FG123H", "Format_Params", "A{3}BC{2}DE{1}FG{0}H", 123, 124, 125, 126)]
+ [TestCase("ABCDEF", "Format_Params", "ABCDEF", 123, 124, 125, 126)]
+ [TestCase("ABCDEFGH", "Format_Params", "A{0}BC{1}DE{2}FG{3}H", "", "", "", "")]
+ [TestCase("ABCDEFGH", "Format_Params", "A{0}BC{1}DE{2}FG{3}H", null, null, null, null)]
public static string Format_Params(string format, object value0, object value1, object value2, object value3)
{
return string.Format(format, value0, value1, value2, value3);
}
+ [TestCase("AXYZBCPQRDESTUFGFGHH", "Format_Params_Custom1", "A{0}BC{1}DE{2}FG{3}H", IncludeTypes = new[] { typeof(Format11_CustomProducer), typeof(Format21_CustomProducer), typeof(Format31_CustomProducer), typeof(Format41_CustomProducer) })]
+ [TestCase("AXYZBCPQRDESTUFGFGHH", "Format_Params_Custom1", "A{0:}BC{1:}DE{2:}FG{3:}H", IncludeTypes = new[] { typeof(Format11_CustomProducer), typeof(Format21_CustomProducer), typeof(Format31_CustomProducer), typeof(Format41_CustomProducer) })]
+ [TestCase("AXYZBCPQRDESTUFGFGHH", "Format_Params_Custom1", "A{0:N}BC{1:N}DE{2:N}FG{3:N}H", IncludeTypes = new[] { typeof(Format11_CustomProducer), typeof(Format21_CustomProducer), typeof(Format31_CustomProducer), typeof(Format41_CustomProducer) })]
public static string Format_Params_Custom1(string format)
{
var cp1 = new Format11_CustomProducer();
@@ -74,6 +69,10 @@ public static string Format_Params_Custom1(string format)
return string.Format(format, cp1, cp2, cp3, cp4);
}
+ [TestCase("A333BC666DE999FGZZZH", "Format_Params_Custom2", "A{0}BC{1}DE{2}FG{3}H", IncludeTypes = new[] { typeof(Format12_CustomProducer), typeof(Format22_CustomProducer), typeof(Format32_CustomProducer), typeof(Format42_CustomProducer) })]
+ [TestCase("A333BC666DE999FGZZZH", "Format_Params_Custom2", "A{0:}BC{1:}DE{2:}FG{3:}H", IncludeTypes = new[] { typeof(Format12_CustomProducer), typeof(Format22_CustomProducer), typeof(Format32_CustomProducer), typeof(Format42_CustomProducer) })]
+ [TestCase("A111BC444DE777FGXXXH", "Format_Params_Custom2", "A{0:N}BC{1:N}DE{2:N}FG{3:N}H", IncludeTypes = new[] { typeof(Format12_CustomProducer), typeof(Format22_CustomProducer), typeof(Format32_CustomProducer), typeof(Format42_CustomProducer) })]
+ [TestCase("A333B111C666D444E999F777GZZZHXXXI", "Format_Params_Custom2", "A{0}B{0:N}C{1}D{1:N}E{2}F{2:N}G{3}H{3:N}I", IncludeTypes = new[] { typeof(Format12_CustomProducer), typeof(Format22_CustomProducer), typeof(Format32_CustomProducer), typeof(Format42_CustomProducer) })]
public static string Format_Params_Custom2(string format)
{
var cp1 = new Format12_CustomProducer();
@@ -83,6 +82,7 @@ public static string Format_Params_Custom2(string format)
return string.Format(format, cp1, cp2, cp3, cp4);
}
+ [TestCase(true, "Format_Params_Exception", "ABC{4}DEF", 123, 124, 125, 126)]
public static bool Format_Params_Exception(string format, object value0, object value1, object value2, object value3)
{
try
diff --git a/tests/IL2C.Core.Test.BasicTypes/System_Type/System_Type.cs b/tests/IL2C.Core.Test.BasicTypes/System_Type/System_Type.cs
index a62a522d..51a6a7e6 100644
--- a/tests/IL2C.Core.Test.BasicTypes/System_Type/System_Type.cs
+++ b/tests/IL2C.Core.Test.BasicTypes/System_Type/System_Type.cs
@@ -11,36 +11,36 @@
namespace IL2C.BasicTypes
{
- [TestCase("System.Int32", "FullName", 123)]
- [TestCase("System.String", "FullName", "ABC")]
- // System.Type.ToString() implementation has concatenation for "Type: " header, but the System.RuntimeType do not.
- [TestCase("System.Int32", "ToString", 123)]
- [TestCase("System.String", "ToString", "ABC")]
- [TestCase("System.ValueType", "BaseType", 123)]
- [TestCase("System.Object", "BaseType", "ABC")]
- [TestCase(null, "Object_BaseType")]
public sealed class System_Type
{
+ // System.Type.ToString() implementation has concatenation for "Type: " header, but the System.RuntimeType do not.
+ [TestCase("System.Int32", "ToString", 123)]
+ [TestCase("System.String", "ToString", "ABC")]
public static string ToString(object value)
{
return value.GetType().ToString();
}
+ [TestCase("System.Int32", "FullName", 123)]
+ [TestCase("System.String", "FullName", "ABC")]
public static string FullName(object value)
{
- return value.GetType().FullName;
+ return value.GetType().FullName!;
}
+ [TestCase("System.ValueType", "BaseType", 123)]
+ [TestCase("System.Object", "BaseType", "ABC")]
public static string BaseType(object value)
{
- return value.GetType().BaseType.FullName;
+ return value.GetType().BaseType!.FullName!;
}
- public static Type Object_BaseType()
+ [TestCase(null, "Object_BaseType", Assert = TestCaseAsserts.PerfectMatch)]
+ public static Type? Object_BaseType()
{
// TODO: We have to handle GetTypeFromHandle.
//return typeof(object).BaseType;
- return 123.GetType().BaseType.BaseType.BaseType;
+ return 123.GetType().BaseType!.BaseType!.BaseType;
}
}
}
diff --git a/tests/IL2C.Core.Test.BasicTypes/System_UInt16/System_UInt16.cs b/tests/IL2C.Core.Test.BasicTypes/System_UInt16/System_UInt16.cs
index c89cf51f..bbe35efb 100644
--- a/tests/IL2C.Core.Test.BasicTypes/System_UInt16/System_UInt16.cs
+++ b/tests/IL2C.Core.Test.BasicTypes/System_UInt16/System_UInt16.cs
@@ -11,25 +11,25 @@
namespace IL2C.BasicTypes
{
- [TestCase(true, "IsValueType")]
- [TestCase(2, "SizeOf")]
- [TestCase("65535", "ToString", ushort.MaxValue)]
- [TestCase("0", "ToString", ushort.MinValue)]
- [TestCase(ushort.MaxValue, "TryParse", "65535")]
- [TestCase(ushort.MinValue, "TryParse", "0")]
public sealed class System_UInt16
{
+ [TestCase(true, "IsValueType")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool IsValueType();
+ [TestCase(2, "SizeOf")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int SizeOf();
+ [TestCase("65535", "ToString", ushort.MaxValue)]
+ [TestCase("0", "ToString", ushort.MinValue)]
public static string ToString(ushort value)
{
return value.ToString();
}
+ [TestCase(ushort.MaxValue, "TryParse", "65535")]
+ [TestCase(ushort.MinValue, "TryParse", "0")]
public static ushort TryParse(string str)
{
ushort.TryParse(str, out var value);
diff --git a/tests/IL2C.Core.Test.BasicTypes/System_UInt16/System_UInt16.il b/tests/IL2C.Core.Test.BasicTypes/System_UInt16/System_UInt16.il
index 42cdd775..c1bbdba5 100644
--- a/tests/IL2C.Core.Test.BasicTypes/System_UInt16/System_UInt16.il
+++ b/tests/IL2C.Core.Test.BasicTypes/System_UInt16/System_UInt16.il
@@ -6,7 +6,7 @@
ldc.i4 42345
box uint16
isinst [netstandard]System.ValueType
- brnull.s F1
+ brfalse.s F1
ldc.i4.1
ret
F1:
diff --git a/tests/IL2C.Core.Test.BasicTypes/System_UInt32/System_UInt32.cs b/tests/IL2C.Core.Test.BasicTypes/System_UInt32/System_UInt32.cs
index 93c7da37..1109c13a 100644
--- a/tests/IL2C.Core.Test.BasicTypes/System_UInt32/System_UInt32.cs
+++ b/tests/IL2C.Core.Test.BasicTypes/System_UInt32/System_UInt32.cs
@@ -11,25 +11,25 @@
namespace IL2C.BasicTypes
{
- [TestCase(true, "IsValueType")]
- [TestCase(4, "SizeOf")]
- [TestCase("4294967295", "ToString", uint.MaxValue)]
- [TestCase("0", "ToString", uint.MinValue)]
- [TestCase(uint.MaxValue, "TryParse", "4294967295")]
- [TestCase(uint.MinValue, "TryParse", "0")]
public sealed class System_UInt32
{
+ [TestCase(true, "IsValueType")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool IsValueType();
+ [TestCase(4, "SizeOf")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int SizeOf();
+ [TestCase("4294967295", "ToString", uint.MaxValue)]
+ [TestCase("0", "ToString", uint.MinValue)]
public static string ToString(uint value)
{
return value.ToString();
}
+ [TestCase(uint.MaxValue, "TryParse", "4294967295")]
+ [TestCase(uint.MinValue, "TryParse", "0")]
public static uint TryParse(string str)
{
uint.TryParse(str, out var value);
diff --git a/tests/IL2C.Core.Test.BasicTypes/System_UInt32/System_UInt32.il b/tests/IL2C.Core.Test.BasicTypes/System_UInt32/System_UInt32.il
index eb752fec..482b73ae 100644
--- a/tests/IL2C.Core.Test.BasicTypes/System_UInt32/System_UInt32.il
+++ b/tests/IL2C.Core.Test.BasicTypes/System_UInt32/System_UInt32.il
@@ -6,7 +6,7 @@
ldc.i4 1234567
box uint32
isinst [netstandard]System.ValueType
- brnull.s F1
+ brfalse.s F1
ldc.i4.1
ret
F1:
diff --git a/tests/IL2C.Core.Test.BasicTypes/System_UInt64/System_UInt64.cs b/tests/IL2C.Core.Test.BasicTypes/System_UInt64/System_UInt64.cs
index 28dfd893..20289967 100644
--- a/tests/IL2C.Core.Test.BasicTypes/System_UInt64/System_UInt64.cs
+++ b/tests/IL2C.Core.Test.BasicTypes/System_UInt64/System_UInt64.cs
@@ -11,25 +11,25 @@
namespace IL2C.BasicTypes
{
- [TestCase(true, "IsValueType")]
- [TestCase(8, "SizeOf")]
- [TestCase("18446744073709551615", "ToString", ulong.MaxValue)]
- [TestCase("0", "ToString", ulong.MinValue)]
- [TestCase(ulong.MaxValue, "TryParse", "18446744073709551615")]
- [TestCase(ulong.MinValue, "TryParse", "0")]
public sealed class System_UInt64
{
+ [TestCase(true, "IsValueType")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool IsValueType();
+ [TestCase(8, "SizeOf")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int SizeOf();
+ [TestCase("18446744073709551615", "ToString", ulong.MaxValue)]
+ [TestCase("0", "ToString", ulong.MinValue)]
public static string ToString(ulong value)
{
return value.ToString();
}
+ [TestCase(ulong.MaxValue, "TryParse", "18446744073709551615")]
+ [TestCase(ulong.MinValue, "TryParse", "0")]
public static ulong TryParse(string str)
{
ulong.TryParse(str, out var value);
diff --git a/tests/IL2C.Core.Test.BasicTypes/System_UInt64/System_UInt64.il b/tests/IL2C.Core.Test.BasicTypes/System_UInt64/System_UInt64.il
index 50f216f6..7a7da674 100644
--- a/tests/IL2C.Core.Test.BasicTypes/System_UInt64/System_UInt64.il
+++ b/tests/IL2C.Core.Test.BasicTypes/System_UInt64/System_UInt64.il
@@ -6,7 +6,7 @@
ldc.i8 1234567890123
box uint64
isinst [netstandard]System.ValueType
- brnull.s F1
+ brfalse.s F1
ldc.i4.1
ret
F1:
diff --git a/tests/IL2C.Core.Test.BasicTypes/System_UIntPtr/System_UIntPtr.cs b/tests/IL2C.Core.Test.BasicTypes/System_UIntPtr/System_UIntPtr.cs
index 11987779..d45076ab 100644
--- a/tests/IL2C.Core.Test.BasicTypes/System_UIntPtr/System_UIntPtr.cs
+++ b/tests/IL2C.Core.Test.BasicTypes/System_UIntPtr/System_UIntPtr.cs
@@ -12,21 +12,38 @@
namespace IL2C.BasicTypes
{
- [TestCase(true, "IsValueType")]
- [TestCase(4, "SizeOf", Assert = TestCaseAsserts.IgnoreValidateInvokeResult)] // Unit test environment is unknown, gcc is 32bit
- [TestCase("4294967295", "ToString", uint.MaxValue)]
- [TestCase("0", "ToString", uint.MinValue)]
public sealed class System_UIntPtr
{
+ [TestCase(true, "IsValueType")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool IsValueType();
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern int SizeOf();
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern int SizeOfImpl();
+
+ [TestCase(true, "SizeOf")]
+ public static bool SizeOf() =>
+ UIntPtr.Size == SizeOfImpl();
+
+ [TestCase("4294967295", "ToString", uint.MaxValue)]
+ [TestCase("0", "ToString", uint.MinValue)]
+ public static string ToString(uint value)
+ {
+ return ((UIntPtr)value).ToString();
+ }
+
+ [TestCase(123U, "ToUInt32", 123U)]
+ public static uint ToUInt32(uint v)
+ {
+ var ip = (UIntPtr)v;
+ return ip.ToUInt32();
+ }
- public static string ToString(UIntPtr value)
+ [TestCase(123UL, "ToUInt64", 123UL)]
+ public static ulong ToUInt64(ulong v)
{
- return value.ToString();
+ var ip = (UIntPtr)v;
+ return ip.ToUInt64();
}
}
}
diff --git a/tests/IL2C.Core.Test.BasicTypes/System_UIntPtr/System_UIntPtr.il b/tests/IL2C.Core.Test.BasicTypes/System_UIntPtr/System_UIntPtr.il
index d3232cd3..27485368 100644
--- a/tests/IL2C.Core.Test.BasicTypes/System_UIntPtr/System_UIntPtr.il
+++ b/tests/IL2C.Core.Test.BasicTypes/System_UIntPtr/System_UIntPtr.il
@@ -7,7 +7,7 @@
conv.u
box native uint
isinst [netstandard]System.ValueType
- brnull.s F1
+ brfalse.s F1
ldc.i4.1
ret
F1:
@@ -15,7 +15,7 @@
ret
}
- .method public static int32 SizeOf() cil managed
+ .method public static int32 SizeOfImpl() cil managed
{
.maxstack 1
sizeof native uint
diff --git a/tests/IL2C.Core.Test.Common/IL2C.Core.Test.Common.csproj b/tests/IL2C.Core.Test.Common/IL2C.Core.Test.Common.csproj
deleted file mode 100644
index 15b8eb78..00000000
--- a/tests/IL2C.Core.Test.Common/IL2C.Core.Test.Common.csproj
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
- net48;netstandard2.0
- Library
- enable
-
- IL2C.Core.Test.Common
-
-
-
diff --git a/tests/IL2C.Core.Test.Common/ILSupport.Standard.targets b/tests/IL2C.Core.Test.Common/ILSupport.Standard.targets
deleted file mode 100644
index 9cf5b11d..00000000
--- a/tests/IL2C.Core.Test.Common/ILSupport.Standard.targets
+++ /dev/null
@@ -1,192 +0,0 @@
-
-
-
-
-
-
-
-
- <_runtime>$(NETCoreSdkPortableRuntimeIdentifier)
- <_runtime Condition="'$(_runtime)' == ''">$(NETCoreSdkRuntimeIdentifier)
- $(_runtime)
-
-
- 6.0.0-rc.2.21480.5
- 5.0.0
-
- runtime.$(MicrosoftNetCoreIlasmPackageRuntimeId).microsoft.netcore.ilasm
- runtime.$(MicrosoftNetCoreIlasmPackageRuntimeId).microsoft.netcore.ildasm
- dotnet-ilverify
-
-
- <_IlasmDir Condition="'$(ILAsmToolPath)' != ''">$([MSBuild]::NormalizeDirectory($(ILAsmToolPath)))
- <_IldasmDir Condition="'$(ILAsmToolPath)' != ''">$([MSBuild]::NormalizeDirectory($(ILAsmToolPath)))
- <_IlverifyDir Condition="'$(ILAsmToolPath)' != ''">$([MSBuild]::NormalizeDirectory($(ILAsmToolPath)))
- $(CoreCompileDependsOn);ResolveIlAsmToolPaths
-
-
- <_IlasmPackageReference Include="$(MicrosoftNetCoreIlasmPackageName)" Version="$(MicrosoftNETCoreToolingVersion)" />
- <_IldasmPackageReference Include="$(MicrosoftNetCoreIldasmPackageName)" Version="$(MicrosoftNETCoreToolingVersion)" />
- <_IlverifyPackageReference Include="$(MicrosoftNetCoreIlverifyPackageName)" Version="$(ILVerifyPackageVersion)" />
-
-
-
-
-
-
-
-
- <_IlasmPackageReference NativePath="$(NuGetPackageRoot)\%(Identity)\%(Version)\runtimes\$(MicrosoftNetCoreIlasmPackageRuntimeId)\native" />
- <_IlasmSourceFiles Include="%(_IlasmPackageReference.NativePath)\**\*" />
- <_IldasmPackageReference NativePath="$(NuGetPackageRoot)\%(Identity)\%(Version)\runtimes\$(MicrosoftNetCoreIlasmPackageRuntimeId)\native" />
- <_IldasmSourceFiles Include="%(_IldasmPackageReference.NativePath)\**\*" />
- <_IlverifyPackageReference AssemblyPath="$(NuGetPackageRoot)\%(Identity)\%(Version)\tools\netcoreapp3.1\any" />
- <_IlverifySourceFiles Include="%(_IlverifyPackageReference.AssemblyPath)\**\*" />
-
-
-
-
-
- <_IlasmDir Condition="'$(_IlasmDir)' == '' and '%(_IlasmPackageReference.Identity)' == '$(MicrosoftNetCoreIlasmPackageName)'">%(_IlasmPackageReference.NativePath)/
- <_IldasmDir Condition="'$(_IldasmDir)' == '' and '%(_IldasmPackageReference.Identity)' == '$(MicrosoftNetCoreIldasmPackageName)'">%(_IldasmPackageReference.NativePath)/
- <_IlverifyDir Condition="'$(_IlverifyDir)' == '' and '%(_IlverifyPackageReference.Identity)' == '$(MicrosoftNetCoreIlverifyPackageName)'">%(_IlverifyPackageReference.AssemblyPath)/
-
-
- $([System.IO.Path]::Combine('$(_IlasmDir)','ilasm'))
- $([System.IO.Path]::Combine('$(_IldasmDir)','ildasm'))
- $([System.IO.Path]::Combine('$(_IlverifyDir)','ILVerify.dll'))
-
-
-
-
-
-
-
-
-
-
-
-
-
- @(IntermediateAssembly->'%(RootDir)%(Directory)%(Filename).il', ' ')
- @(IntermediateAssembly->'%(RootDir)%(Directory)%(Filename).res', ' ')
-
-
-
-
-
-
- "$(ILDasmPath)" -linenum -utf8 -output="$(ILFile)" @(IntermediateAssembly->'"%(FullPath)"', ' ')
-
-
-
-
-
-
-
- $([System.IO.File]::ReadAllText($(ILFile)))
-
- // method ${method} forwardref removed for IL import
- \.method [^{}]+ cil managed forwardref[^}]+} // end of method (?<method>[^ \r\t\n]+)
- $([System.Text.RegularExpressions.Regex]::Replace($(ILSource), $(Pattern), $(Replacement)))
- \.method [^{}]+ cil managed[^\a]+"extern was not given a DllImport attribute"[^}]+} // end of method (?<method>[^ \r\t\n]+)
- $([System.Text.RegularExpressions.Regex]::Replace($(ILSource), $(Pattern), $(Replacement)))
-
-
-
-
-
-
-
-
-
-
-
- "$(ILAsmPath)" -nologo -quite -output=@(IntermediateAssembly->'"%(FullPath)"', ' ')
- $([System.IO.Path]::Combine('$(MSBuildProjectDirectory)','$(IntermediateOutputPath)','Merged.il'))
-
-
- $(ILAsm) -alignment=$(FileAlignment)
-
-
- $(ILAsm) -base=$(BaseAddress)
-
-
- $(ILAsm) -dll
-
-
-
- $(ILAsm) -debug=opt -pdbfmt=portable
-
-
-
- $(ILAsm) -debug=impl -pdbfmt=portable
-
-
-
- $(ILAsm) -debug -pdbfmt=portable
-
-
-
- $(ILAsm) -debug -pdbfmt=portable
-
-
- $(ILAsm) -optimize
-
-
- $(ILAsm) -pe64 -itanium
-
-
- $(ILAsm) -key:"$(AssemblyOriginatorKeyFile)"
-
-
-
- $(ILAsm) "$(ILFile)"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- @(IntermediateAssembly->'"%(FullPath)"', ' ')
- @(ReferencePath->'"%(FullPath)"', ' ')
-
-
-
-
-
-
-
-
diff --git a/tests/IL2C.Core.Test.Common/SetCultureAttribute.cs b/tests/IL2C.Core.Test.Common/SetCultureAttribute.cs
new file mode 100644
index 00000000..ba99fc53
--- /dev/null
+++ b/tests/IL2C.Core.Test.Common/SetCultureAttribute.cs
@@ -0,0 +1,35 @@
+////////////////////////////////////////////////////////////////////////////
+//
+// IL2C - A translator for ECMA-335 CIL/MSIL to C language.
+// Copyright (c) Kouji Matsui (@kozy_kekyo, @kekyo@mastodon.cloud)
+//
+// Licensed under Apache-v2: https://opensource.org/licenses/Apache-2.0
+//
+////////////////////////////////////////////////////////////////////////////
+
+using System;
+using System.Runtime.InteropServices;
+
+using NUnit.Framework;
+using NUnit.Framework.Interfaces;
+using NUnit.Framework.Internal;
+
+namespace IL2C
+{
+ [IgnoreTranslation]
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Assembly, AllowMultiple = false, Inherited = true)]
+ public sealed class SetCultureAttribute : PropertyAttribute, IApplyToContext
+ {
+ public readonly string CultureName;
+
+ public SetCultureAttribute(string cultureName) =>
+ this.CultureName = cultureName;
+
+ public void ApplyToContext(TestExecutionContext context)
+ {
+ var culture = new System.Globalization.CultureInfo(this.CultureName, false);
+ context.CurrentCulture = culture;
+ context.CurrentUICulture = culture;
+ }
+ }
+}
diff --git a/tests/IL2C.Core.Test.Common/Templates/TestMain.cs b/tests/IL2C.Core.Test.Common/Templates/TestMain.cs
new file mode 100644
index 00000000..87fd6f3d
--- /dev/null
+++ b/tests/IL2C.Core.Test.Common/Templates/TestMain.cs
@@ -0,0 +1,50 @@
+////////////////////////////////////////////////////////////////////////////
+//
+// IL2C - A translator for ECMA-335 CIL/MSIL to C language.
+// Copyright (c) Kouji Matsui (@kozy_kekyo, @kekyo@mastodon.cloud)
+//
+// Licensed under Apache-v2: https://opensource.org/licenses/Apache-2.0
+//
+////////////////////////////////////////////////////////////////////////////
+
+using System;
+
+namespace IL2C.Tests
+{
+ public static class TestMain
+ {
+ public static int Main()
+ {
+ try
+ {
+#if {mainIsVoid}
+ ////////////////////////
+ // Execute target function.
+
+ {mainSymbol}();
+#else
+ ////////////////////////
+ // Execute target function.
+
+ var actual = {mainSymbol}();
+
+ ////////////////////////
+ // Check result.
+
+ if (actual != {expected})
+ {
+ Console.WriteLine(actual?.ToString());
+ return 1;
+ }
+#endif
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine(ex.ToString());
+ return 2;
+ }
+
+ return 0;
+ }
+ }
+}
diff --git a/tests/IL2C.Core.Test.Common/TestCaseAttribute.cs b/tests/IL2C.Core.Test.Common/TestCaseAttribute.cs
index 31cc7051..048d505a 100644
--- a/tests/IL2C.Core.Test.Common/TestCaseAttribute.cs
+++ b/tests/IL2C.Core.Test.Common/TestCaseAttribute.cs
@@ -7,11 +7,17 @@
//
////////////////////////////////////////////////////////////////////////////
+#nullable enable
+
using System;
+using System.Collections.Generic;
using System.Linq;
+using System.Runtime.InteropServices;
+using NUnit.Framework.Interfaces;
namespace IL2C
{
+ [IgnoreTranslation]
public enum TestCaseAsserts
{
PerfectMatch,
@@ -19,43 +25,217 @@ public enum TestCaseAsserts
CauseBreak
}
- // It's test case attribute contains expected value, method name and argument values at overall.
- [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
- public sealed class TestCaseAttribute : Attribute
+ [IgnoreTranslation]
+ [Flags]
+ public enum RunOnOSs
{
- public TestCaseAttribute(object? expected, string methodName, params object?[] args)
+ None = 0x00,
+ Windows = 0x01,
+ Posix = 0x02, // (Except Windows)
+ All = 0xff,
+ }
+
+ [IgnoreTranslation]
+ [Flags]
+ public enum RunOnPlatforms
+ {
+ None = 0x00,
+ DotNet = 0x04, // .NET Framework / .NET Core / .NET 5 or upper
+ Mono = 0x08,
+ All = 0xff,
+ }
+
+ [IgnoreTranslation]
+ [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
+ public sealed class TestCaseAttribute :
+ NUnit.Framework.TestCaseAttribute, NUnit.Framework.ITestAction
+ {
+ // HACK: Modified the tests that were realized using non-public knowledge of NUnit to be tested in an official way.
+ // In doing so, to minimize the amount of refactoring, a condition that is difficult to understand was required:
+ // * If a valid value is specified for `expected`, store the value in `ExpectedResult` and let NUnit check it.
+ // * If `expected` is null, we don't know if we want to compare with null or ignore the result.
+ // * If we had access to `MethodInfo` at construction time, we could distinguish by looking at `ReturnType`, but we don't.
+ // * The value of `TestCaseAsserts` is called separately at constructor completion, so it cannot be determined in the constructor.
+ // * If you do not collate the result values, do not set any value to `ExpectedResult`.
+ private TestCaseAsserts assert;
+ private RunOnOSs runOnOSs = RunOnOSs.All;
+ private RunOnPlatforms runOnPlatforms = RunOnPlatforms.All;
+ private readonly bool isExpectedNull;
+ private bool isSetAssert;
+ private bool isSetRunOnOSs;
+ private bool isSetRunOnPlatforms;
+
+ public TestCaseAttribute(
+ object? expected, string methodName, params object?[] args) :
+ base(args ?? new object?[] { null }) // HACK
{
+ if (expected != null)
+ {
+ base.ExpectedResult = expected;
+ this.assert = TestCaseAsserts.PerfectMatch;
+ }
+ else
+ {
+ this.isExpectedNull = true;
+ this.assert = TestCaseAsserts.IgnoreValidateInvokeResult;
+ }
+
this.MethodName = methodName;
this.AdditionalMethodNames = new string[0];
- this.Expected = expected;
- this.Arguments = args ?? new object?[] { null }; // HACK
- this.Assert = TestCaseAsserts.PerfectMatch;
+
this.IncludeBaseTypes = false;
this.IncludeTypes = Type.EmptyTypes;
- this.IgnoreILErrors = Array.Empty();
+ this.IgnoreILErrors = new string[0];
}
// This overload contains additional methods, those are used from the test method (first methodName is target.)
- public TestCaseAttribute(object? expected, string[] methodNames, params object?[] args)
+ public TestCaseAttribute(
+ object? expected, string[] methodNames, params object?[] args) :
+ base(args ?? new object?[] { null }) // HACK
{
+ if (expected != null)
+ {
+ base.ExpectedResult = expected;
+ this.assert = TestCaseAsserts.PerfectMatch;
+ }
+ else
+ {
+ this.isExpectedNull = true;
+ this.assert = TestCaseAsserts.IgnoreValidateInvokeResult;
+ }
+
this.MethodName = methodNames[0]; // test method
- this.AdditionalMethodNames = methodNames.Skip(1).ToArray(); // additionals
- this.Expected = expected;
- this.Arguments = args ?? new object?[] { null }; // HACK
- this.Assert = TestCaseAsserts.PerfectMatch;
+ this.AdditionalMethodNames = GetAdditionalMethodNames(methodNames); // additionals
+
this.IncludeBaseTypes = false;
this.IncludeTypes = Type.EmptyTypes;
- this.IgnoreILErrors = Array.Empty();
+ 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; }
public string[] AdditionalMethodNames { get; }
- public object? Expected { get; }
- public object?[] Arguments { get; }
- public TestCaseAsserts Assert { get; set; }
+ public TestCaseAsserts Assert
+ {
+ get => this.assert;
+ set
+ {
+ if (!this.isSetAssert)
+ {
+ this.isSetAssert = true;
+ this.assert = value;
+
+ if (this.isExpectedNull &&
+ value == TestCaseAsserts.PerfectMatch)
+ {
+ this.ExpectedResult = null;
+ }
+ }
+ else if (value != this.assert)
+ {
+ throw new InvalidOperationException();
+ }
+ }
+ }
+
+ public RunOnOSs RunOnOSs
+ {
+ get => this.runOnOSs;
+ set
+ {
+ if (!this.isSetRunOnOSs)
+ {
+ this.isSetRunOnOSs = true;
+ this.runOnOSs = value;
+
+ var ignores = new List();
+ if (TestUtilities.IsRunningOnWindows &&
+ !value.HasFlag(RunOnOSs.Windows))
+ {
+ ignores.Add("NotWindows");
+ }
+ if (!TestUtilities.IsRunningOnWindows &&
+ !value.HasFlag(RunOnOSs.Posix))
+ {
+ ignores.Add("NotPosix");
+ }
+
+ if (ignores.Count >= 1)
+ {
+ this.Ignore = string.IsNullOrWhiteSpace(this.Ignore) ?
+ string.Join(" | ", ignores) :
+ string.Join(" | ", new[] { this.Ignore }.Concat(ignores));
+ }
+ }
+ else if (value != this.runOnOSs)
+ {
+ throw new InvalidOperationException();
+ }
+ }
+ }
+
+ public RunOnPlatforms RunOnPlatforms
+ {
+ get => this.runOnPlatforms;
+ set
+ {
+ if (!this.isSetRunOnPlatforms)
+ {
+ this.isSetRunOnPlatforms = true;
+ this.runOnPlatforms = value;
+
+ var ignores = new List();
+ if (!TestUtilities.IsRunningOnMono &&
+ !value.HasFlag(RunOnPlatforms.DotNet))
+ {
+ ignores.Add("NotDotNet");
+ }
+ if (TestUtilities.IsRunningOnMono &&
+ !value.HasFlag(RunOnPlatforms.Mono))
+ {
+ ignores.Add("NotMono");
+ }
+
+ if (ignores.Count >= 1)
+ {
+ this.Ignore = string.IsNullOrWhiteSpace(this.Ignore) ?
+ string.Join(" | ", ignores) :
+ string.Join(" | ", new[] { this.Ignore }.Concat(ignores));
+ }
+ }
+ else if (value != this.runOnPlatforms)
+ {
+ throw new InvalidOperationException();
+ }
+ }
+ }
+
public bool IncludeBaseTypes { get; set; }
public Type[] IncludeTypes { get; set; }
public string[] IgnoreILErrors { get; set; }
+
+ public NUnit.Framework.ActionTargets Targets =>
+ NUnit.Framework.ActionTargets.Default;
+
+ public void BeforeTest(ITest test)
+ {
+ // TRANSITIVE DEBUG CODE: Check whether method name is equal.
+ NUnit.Framework.Assert.AreEqual(test.Method?.Name, this.MethodName);
+ }
+
+ public void AfterTest(ITest test)
+ {
+ // TODO: delegates to test native code.
+ }
}
}
diff --git a/tests/IL2C.Core.Test.Common/TestIdAttribute.cs b/tests/IL2C.Core.Test.Common/TestIdAttribute.cs
index 548d52e2..64b81350 100644
--- a/tests/IL2C.Core.Test.Common/TestIdAttribute.cs
+++ b/tests/IL2C.Core.Test.Common/TestIdAttribute.cs
@@ -8,9 +8,11 @@
////////////////////////////////////////////////////////////////////////////
using System;
+using System.Runtime.InteropServices;
namespace IL2C
{
+ [IgnoreTranslation]
[AttributeUsage(AttributeTargets.Class)]
public sealed class TestIdAttribute : Attribute
{
diff --git a/tests/IL2C.Core.Test.Common/TestUtilities.cs b/tests/IL2C.Core.Test.Common/TestUtilities.cs
new file mode 100644
index 00000000..3ac9c549
--- /dev/null
+++ b/tests/IL2C.Core.Test.Common/TestUtilities.cs
@@ -0,0 +1,26 @@
+////////////////////////////////////////////////////////////////////////////
+//
+// IL2C - A translator for ECMA-335 CIL/MSIL to C language.
+// Copyright (c) Kouji Matsui (@kozy_kekyo, @kekyo@mastodon.cloud)
+//
+// Licensed under Apache-v2: https://opensource.org/licenses/Apache-2.0
+//
+////////////////////////////////////////////////////////////////////////////
+
+#nullable enable
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace IL2C
+{
+ [IgnoreTranslation]
+ public static class TestUtilities
+ {
+ public static readonly bool IsRunningOnWindows =
+ Environment.OSVersion.Platform == PlatformID.Win32NT;
+
+ public static readonly bool IsRunningOnMono =
+ Type.GetType("Mono.Runtime") != null;
+ }
+}
diff --git a/tests/IL2C.Core.Test.Fixture/IL2C.Core.Test.Fixture.csproj b/tests/IL2C.Core.Test.Fixture/IL2C.Core.Test.Fixture.csproj
index 3385005f..b2fad96b 100644
--- a/tests/IL2C.Core.Test.Fixture/IL2C.Core.Test.Fixture.csproj
+++ b/tests/IL2C.Core.Test.Fixture/IL2C.Core.Test.Fixture.csproj
@@ -11,9 +11,11 @@
-
-
-
+
+
@@ -24,9 +26,11 @@
+
@@ -45,4 +49,12 @@
+
+
+
+
+
+
+
+
diff --git a/tests/IL2C.Core.Test.Fixture/TestUtilities.cs b/tests/IL2C.Core.Test.Fixture/TestUtilities.cs
index 8390a27b..673b74de 100644
--- a/tests/IL2C.Core.Test.Fixture/TestUtilities.cs
+++ b/tests/IL2C.Core.Test.Fixture/TestUtilities.cs
@@ -75,6 +75,8 @@ private static object ConvertToArgumentType(object value, Type argumentType)
}
public static IReadOnlyDictionary> ExtractTestCasesFromCoreTestTarget() =>
+ new Dictionary>();
+#if false
typeof(BasicTypes.System_Boolean).Assembly.GetTypes(). // BasicTypes
Concat(typeof(ILConverters.Add).Assembly.GetTypes()). // ILConverters
Concat(typeof(RuntimeSystems.ArrayTypes).Assembly.GetTypes()). // RuntimeSystems
@@ -83,17 +85,18 @@ public static IReadOnlyDictionary g.Key,
g => (IReadOnlyDictionary)g.ToDictionary(type => type, TestUtilities.GetTestCaseInformations));
+#endif
public static TestCaseInformation CreateTestCaseInformation(
string categoryName, string id, string name, string uniqueName, string description,
- MethodInfo method, MethodBase[] additionalMethods, TestCaseAttribute caseAttribute) =>
+ MethodInfo method, MethodBase[] additionalMethods, TestCaseAttributeBase caseAttribute) =>
new TestCaseInformation(
categoryName,
id,
name,
uniqueName,
description,
- ConvertToArgumentType(caseAttribute.Expected, method.ReturnType),
+ ConvertToArgumentType(caseAttribute.ExpectedResult, method.ReturnType),
caseAttribute.Assert,
method,
(caseAttribute.IncludeBaseTypes ?
@@ -120,7 +123,7 @@ public static TestCaseInformation[] GetTestCaseInformations(Type targetType)
targetType.Name;
var caseInfos =
- (from testCase in targetType.GetCustomAttributes(true)
+ (from testCase in targetType.GetCustomAttributes(true)
let method = targetType.GetMethod(
testCase.MethodName,
BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly) // Static method only for test entry
@@ -154,9 +157,9 @@ public static TestCaseInformation[] GetTestCaseInformations(Type targetType)
ToArray();
return caseInfos;
}
- #endregion
+#endregion
- #region IO related
+#region IO related
public static readonly bool IsWindows =
Environment.OSVersion.Platform == PlatformID.Win32NT;
@@ -402,6 +405,6 @@ public static Task CopyResourceToTextFileAsync(
return (exitCode, sb.ToString());
}
}
- #endregion
+#endregion
}
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Add/Add.cs b/tests/IL2C.Core.Test.ILConverters/Add/Add.cs
index 27bf027a..7ef0748a 100644
--- a/tests/IL2C.Core.Test.ILConverters/Add/Add.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Add/Add.cs
@@ -12,69 +12,78 @@
namespace IL2C.ILConverters
{
- [TestCase(36, "Int32_Int32", 12, 24)]
- [TestCase(36, "Int32_IntPtr", 12, 24)]
- [TestCase(123, new[] { "Int32_IntRef", "Add_Int32_IntRef" }, 123)]
- [TestCase(36L, "Int64_Int64", 12L, 24L)]
- [TestCase(36, "IntPtr_Int32", 12, 24)]
- [TestCase(36, "IntPtr_IntPtr", 12, 24)]
- [TestCase(123, new[] { "IntPtr_IntRef", "Add_IntPtr_IntRef" }, 123)]
- [TestCase(0.45f + 123.0f, "Single_Single", 0.45f, 123.0f)]
- [TestCase(0.45f + 123.0, "Single_Double", 0.45f, 123.0)]
- [TestCase(0.45 + 123.0f, "Double_Single", 0.45, 123.0f)]
- [TestCase(0.45 + 123.0, "Double_Double", 0.45, 123.0)]
- [TestCase(123, new[] { "IntRef_Int32", "Add_IntRef_Int32" }, 123)]
- [TestCase(123, new[] { "IntRef_IntPtr", "Add_IntRef_IntPtr" }, 123)]
public sealed class Add
{
+ [TestCase(36, "Int32_Int32", 12, 24)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Int32_Int32(int lhs, int rhs);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr Int32_IntPtr(int lhs, IntPtr rhs);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr Int32_IntPtrImpl(int lhs, IntPtr rhs);
+
+ [TestCase(36, "Int32_IntPtr", 12, 24)]
+ public static int Int32_IntPtr(int lhs, int rhs) =>
+ Int32_IntPtrImpl(lhs, (IntPtr)rhs).ToInt32();
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern ref int Add_Int32_IntRef(int lhs, ref int rhs);
+ [TestCase(123, new[] { "Int32_IntRef", "Add_Int32_IntRef" }, 123)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Int32_IntRef(int value);
+ [TestCase(36L, "Int64_Int64", 12L, 24L)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern long Int64_Int64(long lhs, long rhs);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr IntPtr_Int32(IntPtr lhs, int rhs);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr IntPtr_Int32Impl(IntPtr lhs, int rhs);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr IntPtr_IntPtr(IntPtr lhs, IntPtr rhs);
+ [TestCase(36, "IntPtr_Int32", 12, 24)]
+ public static int IntPtr_Int32(int lhs, int rhs) =>
+ IntPtr_Int32Impl((IntPtr)lhs, rhs).ToInt32();
+
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr IntPtr_IntPtrImpl(IntPtr lhs, IntPtr rhs);
+
+ [TestCase(36, "IntPtr_IntPtr", 12, 24)]
+ public static int IntPtr_IntPtr(int lhs, int rhs) =>
+ IntPtr_IntPtrImpl((IntPtr)lhs, (IntPtr)rhs).ToInt32();
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern ref int Add_IntPtr_IntRef(IntPtr lhs, ref int rhs);
+ [TestCase(123, new[] { "IntPtr_IntRef", "Add_IntPtr_IntRef" }, 123)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int IntPtr_IntRef(int value);
+ [TestCase(0.45f + 123.0f, "Single_Single", 0.45f, 123.0f)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern float Single_Single(float lhs, float rhs);
+ [TestCase(0.45f + 123.0, "Add_Single_Double", 0.45f, 123.0)]
[MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern double Single_Double(float lhs, double rhs);
+ public static extern double Add_Single_Double(float lhs, double rhs);
+ [TestCase(0.45 + 123.0f, "Add_Double_Single", 0.45, 123.0f)]
[MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern double Double_Single(double lhs, float rhs);
+ public static extern double Add_Double_Single(double lhs, float rhs);
+ [TestCase(0.45 + 123.0, "Double_Double", 0.45, 123.0)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern double Double_Double(double lhs, double rhs);
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern ref int Add_IntRef_Int32(ref int lhs, int rhs);
+ [TestCase(123, new[] { "IntRef_Int32", "Add_IntRef_Int32" }, 123)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int IntRef_Int32(int value);
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern ref int Add_IntRef_IntPtr(ref int lhs, IntPtr rhs);
+ [TestCase(123, new[] { "IntRef_IntPtr", "Add_IntRef_IntPtr" }, 123)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int IntRef_IntPtr(int value);
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Add/Add.il b/tests/IL2C.Core.Test.ILConverters/Add/Add.il
index 384a9d08..c42b1ac0 100644
--- a/tests/IL2C.Core.Test.ILConverters/Add/Add.il
+++ b/tests/IL2C.Core.Test.ILConverters/Add/Add.il
@@ -1,35 +1,35 @@
.class public IL2C.ILConverters.Add
{
- .method public static int32 Int32_Int32(int32 lhs, int32 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- add
- ret
- }
+ .method public static int32 Int32_Int32(int32 lhs, int32 rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ add
+ ret
+ }
- .method public static native int Int32_IntPtr(int32 lhs, native int rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- add
- ret
- }
+ .method private static native int Int32_IntPtrImpl(int32 lhs, native int rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ add
+ ret
+ }
.method private static int32& Add_Int32_IntRef(int32 lhs, int32& rhs) cil managed
- {
- .maxstack 2
+ {
+ .maxstack 2
ldarg.0
- ldarg.1
- add
- ret
- }
+ ldarg.1
+ add
+ ret
+ }
.method public static int32 Int32_IntRef(int32 v) cil managed
- {
- .maxstack 3
+ {
+ .maxstack 3
.locals init (
[0] int32
)
@@ -41,48 +41,48 @@
call int32& IL2C.ILConverters.Add::Add_Int32_IntRef(int32, int32&)
call int32& IL2C.ILConverters.Add::Add_Int32_IntRef(int32, int32&)
ldind.i4
- ret
- }
+ ret
+ }
.method public static int64 Int64_Int64(int64 lhs, int64 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- add
- ret
- }
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ add
+ ret
+ }
- .method public static native int IntPtr_Int32(native int lhs, int32 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- add
- ret
- }
+ .method private static native int IntPtr_Int32Impl(native int lhs, int32 rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ add
+ ret
+ }
- .method public static native int IntPtr_IntPtr(native int lhs, native int rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- add
- ret
- }
+ .method private static native int IntPtr_IntPtrImpl(native int lhs, native int rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ add
+ ret
+ }
.method private static int32& Add_IntPtr_IntRef(native int lhs, int32& rhs) cil managed
- {
- .maxstack 2
+ {
+ .maxstack 2
ldarg.0
- ldarg.1
- add
- ret
- }
+ ldarg.1
+ add
+ ret
+ }
.method public static int32 IntPtr_IntRef(int32 v) cil managed
- {
- .maxstack 3
+ {
+ .maxstack 3
.locals init (
[0] int32
)
@@ -96,57 +96,57 @@
call int32& IL2C.ILConverters.Add::Add_IntPtr_IntRef(native int, int32&)
call int32& IL2C.ILConverters.Add::Add_IntPtr_IntRef(native int, int32&)
ldind.i4
- ret
- }
+ ret
+ }
- .method public static float32 Single_Single(float32 lhs, float32 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- add
- ret
- }
+ .method public static float32 Single_Single(float32 lhs, float32 rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ add
+ ret
+ }
- .method public static float64 Single_Double(float32 lhs, float64 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- add
- ret
- }
+ .method public static float64 Add_Single_Double(float32 lhs, float64 rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ add
+ ret
+ }
- .method public static float64 Double_Single(float64 lhs, float32 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- add
- ret
- }
+ .method public static float64 Add_Double_Single(float64 lhs, float32 rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ add
+ ret
+ }
- .method public static float64 Double_Double(float64 lhs, float64 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- add
- ret
- }
+ .method public static float64 Double_Double(float64 lhs, float64 rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ add
+ ret
+ }
.method private static int32& Add_IntRef_Int32(int32& lhs, int32 rhs) cil managed
- {
- .maxstack 2
+ {
+ .maxstack 2
ldarg.0
- ldarg.1
- add
- ret
- }
+ ldarg.1
+ add
+ ret
+ }
.method public static int32 IntRef_Int32(int32 v) cil managed
- {
- .maxstack 3
+ {
+ .maxstack 3
.locals init (
[0] int32
)
@@ -158,21 +158,21 @@
ldc.i4.m1
call int32& IL2C.ILConverters.Add::Add_IntRef_Int32(int32&, int32)
ldind.i4
- ret
- }
+ ret
+ }
.method private static int32& Add_IntRef_IntPtr(int32& lhs, native int rhs) cil managed
- {
- .maxstack 2
+ {
+ .maxstack 2
ldarg.0
- ldarg.1
- add
- ret
- }
+ ldarg.1
+ add
+ ret
+ }
.method public static int32 IntRef_IntPtr(int32 v) cil managed
- {
- .maxstack 3
+ {
+ .maxstack 3
.locals init (
[0] int32
)
@@ -186,6 +186,6 @@
conv.i
call int32& IL2C.ILConverters.Add::Add_IntRef_IntPtr(int32&, native int)
ldind.i4
- ret
- }
+ ret
+ }
}
diff --git a/tests/IL2C.Core.Test.ILConverters/And/And.cs b/tests/IL2C.Core.Test.ILConverters/And/And.cs
index b67b76e3..81af68f1 100644
--- a/tests/IL2C.Core.Test.ILConverters/And/And.cs
+++ b/tests/IL2C.Core.Test.ILConverters/And/And.cs
@@ -12,26 +12,35 @@
namespace IL2C.ILConverters
{
- [TestCase(0x12345678 & 0x55555555, "Int32_Int32", 0x12345678, 0x55555555)]
- [TestCase(0x12345678 & 0x55555555, "Int32_IntPtr", 0x12345678, 0x55555555)]
- [TestCase(0x123456789abcdef & 0x55555555aaaaaaaa, "Int64_Int64", 0x123456789abcdef, 0x55555555aaaaaaaa)]
- [TestCase(0x12345678 & 0x55555555, "IntPtr_Int32", 0x12345678, 0x55555555)]
- [TestCase(0x12345678 & 0x55555555, "IntPtr_IntPtr", 0x12345678, 0x55555555)]
public sealed class And
{
+ [TestCase(0x12345678 & 0x55555555, "Int32_Int32", 0x12345678, 0x55555555)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Int32_Int32(int lhs, int rhs);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr Int32_IntPtr(int lhs, IntPtr rhs);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr Int32_IntPtrImpl(int lhs, IntPtr rhs);
+
+ [TestCase(0x12345678 & 0x55555555, "Int32_IntPtr", 0x12345678, 0x55555555)]
+ public static int Int32_IntPtr(int lhs, int rhs) =>
+ Int32_IntPtrImpl(lhs, (IntPtr)rhs).ToInt32();
+ [TestCase(0x123456789abcdef & 0x55555555aaaaaaaa, "Int64_Int64", 0x123456789abcdef, 0x55555555aaaaaaaa)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern long Int64_Int64(long lhs, long rhs);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr IntPtr_Int32(IntPtr lhs, int rhs);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr IntPtr_Int32Impl(IntPtr lhs, int rhs);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr IntPtr_IntPtr(IntPtr lhs, IntPtr rhs);
+ [TestCase(0x12345678 & 0x55555555, "IntPtr_Int32", 0x12345678, 0x55555555)]
+ public static int IntPtr_Int32(int lhs, int rhs) =>
+ IntPtr_Int32Impl((IntPtr)lhs, rhs).ToInt32();
+
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr IntPtr_IntPtrImpl(IntPtr lhs, IntPtr rhs);
+
+ [TestCase(0x12345678 & 0x55555555, "IntPtr_IntPtr", 0x12345678, 0x55555555)]
+ public static int IntPtr_IntPtr(int lhs, int rhs) =>
+ IntPtr_IntPtrImpl((IntPtr)lhs, (IntPtr)rhs).ToInt32();
}
}
diff --git a/tests/IL2C.Core.Test.ILConverters/And/And.il b/tests/IL2C.Core.Test.ILConverters/And/And.il
index 8d84beba..3a3b749d 100644
--- a/tests/IL2C.Core.Test.ILConverters/And/And.il
+++ b/tests/IL2C.Core.Test.ILConverters/And/And.il
@@ -1,47 +1,47 @@
.class public IL2C.ILConverters.And
{
- .method public static int32 Int32_Int32(int32 lhs, int32 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- and
- ret
- }
+ .method public static int32 Int32_Int32(int32 lhs, int32 rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ and
+ ret
+ }
- .method public static native int Int32_IntPtr(int32 lhs, native int rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- and
- ret
- }
+ .method private static native int Int32_IntPtrImpl(int32 lhs, native int rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ and
+ ret
+ }
.method public static int64 Int64_Int64(int64 lhs, int64 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- and
- ret
- }
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ and
+ ret
+ }
- .method public static native int IntPtr_Int32(native int lhs, int32 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- and
- ret
- }
+ .method private static native int IntPtr_Int32Impl(native int lhs, int32 rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ and
+ ret
+ }
- .method public static native int IntPtr_IntPtr(native int lhs, native int rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- and
- ret
- }
+ .method private static native int IntPtr_IntPtrImpl(native int lhs, native int rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ and
+ ret
+ }
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Box/Box.cs b/tests/IL2C.Core.Test.ILConverters/Box/Box.cs
index 9f85c060..145157df 100644
--- a/tests/IL2C.Core.Test.ILConverters/Box/Box.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Box/Box.cs
@@ -23,152 +23,140 @@ public override string ToString()
}
}
- [TestCase("124", new[] { "Byte", "Box_Byte" }, 123)]
- [TestCase("12346", new[] { "Int16", "Box_Int16" }, 12345)]
- [TestCase("1234568", new[] { "Int32", "Box_Int32" }, 1234567)]
- [TestCase("12345678901235", new[] { "Int64", "Box_Int64" }, 12345678901234)]
- [TestCase("124", new[] { "SByte", "Box_SByte" }, 123)]
- [TestCase("12346", new[] { "UInt16", "Box_UInt16" }, 12345)]
- [TestCase("1234568", new[] { "UInt32", "Box_UInt32" }, 1234567)]
- [TestCase("12345678901235", new[] { "UInt64", "Box_UInt64" }, 12345678901234)]
- [TestCase("1234567", new[] { "IntPtr", "Box_IntPtr" }, 1234567)]
- [TestCase("1234567", new[] { "UIntPtr", "Box_UIntPtr" }, 1234567U)]
- [TestCase("123.456", new[] { "Single", "Box_Single" }, 123.456f)]
- [TestCase("123.45678901234", new[] { "Double", "Box_Double" }, 123.45678901234)]
- [TestCase("True", new[] { "Boolean", "Box_Boolean" }, true)]
- [TestCase("False", new[] { "Boolean", "Box_Boolean" }, false)]
- [TestCase("A", new[] { "Char", "Box_Char" }, 'A')]
- [TestCase("12345679901234", new[] { "UInt64ToInt64", "Box_UInt64ToInt64" }, 12345678901234)]
- [TestCase("123ABC", new[] { "ValueType", "ToString" }, 123, "ABC", IncludeTypes = new[] { typeof(Box_Target_ValueType) })]
public sealed class Box
{
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern object Box_Byte(byte value);
+ [TestCase("124", new[] { "Byte", "Box_Byte" }, 123)]
public static string Byte(byte value)
{
- return Box_Byte((byte)(value + 1)).ToString();
+ return Box_Byte((byte)(value + 1)).ToString()!;
}
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern object Box_Int16(short value);
+ [TestCase("12346", new[] { "Int16", "Box_Int16" }, 12345)]
public static string Int16(short value)
{
- return Box_Int16((short)(value + 1)).ToString();
+ return Box_Int16((short)(value + 1)).ToString()!;
}
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern object Box_Int32(int value);
+ [TestCase("1234568", new[] { "Int32", "Box_Int32" }, 1234567)]
public static string Int32(int value)
{
- return Box_Int32(value + 1).ToString();
+ return Box_Int32(value + 1).ToString()!;
}
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern object Box_Int64(long value);
+ [TestCase("12345678901235", new[] { "Int64", "Box_Int64" }, 12345678901234)]
public static string Int64(long value)
{
- return Box_Int64(value + 1).ToString();
+ return Box_Int64(value + 1).ToString()!;
}
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern object Box_SByte(sbyte value);
+ [TestCase("124", new[] { "SByte", "Box_SByte" }, 123)]
public static string SByte(sbyte value)
{
- return Box_SByte((sbyte)(value + 1)).ToString();
+ return Box_SByte((sbyte)(value + 1)).ToString()!;
}
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern object Box_UInt16(ushort value);
- public static string UInt16(ushort value)
- {
- return Box_UInt16((ushort)(value + 1)).ToString();
- }
+ [TestCase("12346", new[] { "UInt16", "Box_UInt16" }, (ushort)12345)]
+ public static string UInt16(ushort value) =>
+ Box_UInt16((ushort)(value + 1)).ToString()!;
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern object Box_UInt32(uint value);
- public static string UInt32(uint value)
- {
- return Box_UInt32(value + 1).ToString();
- }
+ [TestCase("1234568", new[] { "UInt32", "Box_UInt32" }, 1234567U)]
+ public static string UInt32(uint value) =>
+ Box_UInt32(value + 1).ToString()!;
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern object Box_UInt64(ulong value);
- public static string UInt64(ulong value)
- {
- return Box_UInt64(value + 1).ToString();
- }
+ [TestCase("12345678901235", new[] { "UInt64", "Box_UInt64" }, 12345678901234UL)]
+ public static string UInt64(ulong value) =>
+ Box_UInt64(value + 1).ToString()!;
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern object Box_IntPtr(IntPtr value);
- public static string IntPtr(IntPtr value)
- {
- return Box_IntPtr(value).ToString();
- }
+ [TestCase("1234567", new[] { "IntPtr", "Box_IntPtr" }, 1234567)]
+ public static string IntPtr(int value) =>
+ Box_IntPtr((IntPtr)value).ToString()!;
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern object Box_UIntPtr(UIntPtr value);
- public static string UIntPtr(UIntPtr value)
- {
- return Box_UIntPtr(value).ToString();
- }
+ [TestCase("1234567", new[] { "UIntPtr", "Box_UIntPtr" }, 1234567U)]
+ public static string UIntPtr(uint value) =>
+ Box_UIntPtr((UIntPtr)value).ToString()!;
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern object Box_Single(float value);
+ [TestCase("123.456", new[] { "Single", "Box_Single" }, 123.456f)]
public static string Single(float value)
{
- return Box_Single(value).ToString();
+ return Box_Single(value).ToString()!;
}
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern object Box_Double(double value);
+ [TestCase("123.45678901234", new[] { "Double", "Box_Double" }, 123.45678901234)]
public static string Double(double value)
{
- return Box_Double(value).ToString();
+ return Box_Double(value).ToString()!;
}
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern object Box_Boolean(bool value);
+ [TestCase("True", new[] { "Boolean", "Box_Boolean" }, true)]
+ [TestCase("False", new[] { "Boolean", "Box_Boolean" }, false)]
public static string Boolean(bool value)
{
- return Box_Boolean(value).ToString();
+ return Box_Boolean(value).ToString()!;
}
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern object Box_Char(char value);
+ [TestCase("A", new[] { "Char", "Box_Char" }, 'A')]
public static string Char(char value)
{
- return Box_Char(value).ToString();
+ return Box_Char(value).ToString()!;
}
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern object Box_UInt64ToInt64(ulong value);
- public static long UInt64ToInt64(ulong value)
- {
- return (long)Box_UInt64ToInt64(value) + 1000000;
- }
+ [TestCase("12345679901234", new[] { "UInt64ToInt64", "Box_UInt64ToInt64" }, 12345678901234UL)]
+ public static long UInt64ToInt64(ulong value) =>
+ (long)Box_UInt64ToInt64(value) + 1000000;
+ [TestCase("123ABC", new[] { "ValueType", "ToString" }, 123, "ABC", IncludeTypes = new[] { typeof(Box_Target_ValueType) })]
public static string ValueType(int value1, string value2)
{
var v = new Box_Target_ValueType();
v.Int32Value = value1;
v.StringValue = value2;
object ov = v;
- return ov.ToString();
+ return ov.ToString()!;
}
}
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Box/Box_Enum.cs b/tests/IL2C.Core.Test.ILConverters/Box/Box_Enum.cs
index 56359c9d..68f07997 100644
--- a/tests/IL2C.Core.Test.ILConverters/Box/Box_Enum.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Box/Box_Enum.cs
@@ -69,35 +69,14 @@ public enum Box_Enum_UInt64_Type : ulong
}
[TestId("Box")]
- [TestCase(Box_Enum_Byte_Type.Min, new[] { "Enum_Byte", "Box_Enum_Byte" }, byte.MinValue, IncludeTypes = new[] { typeof(Box_Enum_Byte_Type) })]
- [TestCase(Box_Enum_Byte_Type.One, new[] { "Enum_Byte", "Box_Enum_Byte" }, 1, IncludeTypes = new[] { typeof(Box_Enum_Byte_Type) })]
- [TestCase(Box_Enum_Byte_Type.Max, new[] { "Enum_Byte", "Box_Enum_Byte" }, byte.MaxValue, IncludeTypes = new[] { typeof(Box_Enum_Byte_Type) })]
- [TestCase(Box_Enum_Int16_Type.Min, new[] { "Enum_Int16", "Box_Enum_Int16" }, short.MinValue, IncludeTypes = new[] { typeof(Box_Enum_Int16_Type) })]
- [TestCase(Box_Enum_Int16_Type.Zero, new[] { "Enum_Int16", "Box_Enum_Int16" }, 0, IncludeTypes = new[] { typeof(Box_Enum_Int16_Type) })]
- [TestCase(Box_Enum_Int16_Type.Max, new[] { "Enum_Int16", "Box_Enum_Int16" }, short.MaxValue, IncludeTypes = new[] { typeof(Box_Enum_Int16_Type) })]
- [TestCase(Box_Enum_Int32_Type.Min, new[] { "Enum_Int32", "Box_Enum_Int32" }, int.MinValue, IncludeTypes = new[] { typeof(Box_Enum_Int32_Type) })]
- [TestCase(Box_Enum_Int32_Type.Zero, new[] { "Enum_Int32", "Box_Enum_Int32" }, 0, IncludeTypes = new[] { typeof(Box_Enum_Int32_Type) })]
- [TestCase(Box_Enum_Int32_Type.Max, new[] { "Enum_Int32", "Box_Enum_Int32" }, int.MaxValue, IncludeTypes = new[] { typeof(Box_Enum_Int32_Type) })]
- [TestCase(Box_Enum_Int64_Type.Min, new[] { "Enum_Int64", "Box_Enum_Int64" }, long.MinValue, IncludeTypes = new[] { typeof(Box_Enum_Int64_Type) })]
- [TestCase(Box_Enum_Int64_Type.Zero, new[] { "Enum_Int64", "Box_Enum_Int64" }, 0L, IncludeTypes = new[] { typeof(Box_Enum_Int64_Type) })]
- [TestCase(Box_Enum_Int64_Type.Max, new[] { "Enum_Int64", "Box_Enum_Int64" }, long.MaxValue, IncludeTypes = new[] { typeof(Box_Enum_Int64_Type) })]
- [TestCase(Box_Enum_SByte_Type.Min, new[] { "Enum_SByte", "Box_Enum_SByte" }, sbyte.MinValue, IncludeTypes = new[] { typeof(Box_Enum_SByte_Type) })]
- [TestCase(Box_Enum_SByte_Type.Zero, new[] { "Enum_SByte", "Box_Enum_SByte" }, 0, IncludeTypes = new[] { typeof(Box_Enum_SByte_Type) })]
- [TestCase(Box_Enum_SByte_Type.Max, new[] { "Enum_SByte", "Box_Enum_SByte" }, sbyte.MaxValue, IncludeTypes = new[] { typeof(Box_Enum_SByte_Type) })]
- [TestCase(Box_Enum_UInt16_Type.Min, new[] { "Enum_UInt16", "Box_Enum_UInt16" }, ushort.MinValue, IncludeTypes = new[] { typeof(Box_Enum_UInt16_Type) })]
- [TestCase(Box_Enum_UInt16_Type.One, new[] { "Enum_UInt16", "Box_Enum_UInt16" }, 1, IncludeTypes = new[] { typeof(Box_Enum_UInt16_Type) })]
- [TestCase(Box_Enum_UInt16_Type.Max, new[] { "Enum_UInt16", "Box_Enum_UInt16" }, ushort.MaxValue, IncludeTypes = new[] { typeof(Box_Enum_UInt16_Type) })]
- [TestCase(Box_Enum_UInt32_Type.Min, new[] { "Enum_UInt32", "Box_Enum_UInt32" }, uint.MinValue, IncludeTypes = new[] { typeof(Box_Enum_UInt32_Type) })]
- [TestCase(Box_Enum_UInt32_Type.One, new[] { "Enum_UInt32", "Box_Enum_UInt32" }, 1, IncludeTypes = new[] { typeof(Box_Enum_UInt32_Type) })]
- [TestCase(Box_Enum_UInt32_Type.Max, new[] { "Enum_UInt32", "Box_Enum_UInt32" }, uint.MaxValue, IncludeTypes = new[] { typeof(Box_Enum_UInt32_Type) })]
- [TestCase(Box_Enum_UInt64_Type.Min, new[] { "Enum_UInt64", "Box_Enum_UInt64" }, ulong.MinValue, IncludeTypes = new[] { typeof(Box_Enum_UInt64_Type) })]
- [TestCase(Box_Enum_UInt64_Type.One, new[] { "Enum_UInt64", "Box_Enum_UInt64" }, 1UL, IncludeTypes = new[] { typeof(Box_Enum_UInt64_Type) })]
- [TestCase(Box_Enum_UInt64_Type.Max, new[] { "Enum_UInt64", "Box_Enum_UInt64" }, ulong.MaxValue, IncludeTypes = new[] { typeof(Box_Enum_UInt64_Type) })]
public sealed class Box_Enum
{
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern object Box_Enum_Byte(byte value);
+ [TestCase(Box_Enum_Byte_Type.Min, new[] { "Enum_Byte", "Box_Enum_Byte" }, byte.MinValue, IncludeTypes = new[] { typeof(Box_Enum_Byte_Type) })]
+ [TestCase(Box_Enum_Byte_Type.One, new[] { "Enum_Byte", "Box_Enum_Byte" }, 1, IncludeTypes = new[] { typeof(Box_Enum_Byte_Type) })]
+ [TestCase(Box_Enum_Byte_Type.Max, new[] { "Enum_Byte", "Box_Enum_Byte" }, byte.MaxValue, IncludeTypes = new[] { typeof(Box_Enum_Byte_Type) })]
public static Box_Enum_Byte_Type Enum_Byte(byte value)
{
return (Box_Enum_Byte_Type)Box_Enum_Byte(value);
@@ -106,6 +85,9 @@ public static Box_Enum_Byte_Type Enum_Byte(byte value)
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern object Box_Enum_Int16(short value);
+ [TestCase(Box_Enum_Int16_Type.Min, new[] { "Enum_Int16", "Box_Enum_Int16" }, short.MinValue, IncludeTypes = new[] { typeof(Box_Enum_Int16_Type) })]
+ [TestCase(Box_Enum_Int16_Type.Zero, new[] { "Enum_Int16", "Box_Enum_Int16" }, 0, IncludeTypes = new[] { typeof(Box_Enum_Int16_Type) })]
+ [TestCase(Box_Enum_Int16_Type.Max, new[] { "Enum_Int16", "Box_Enum_Int16" }, short.MaxValue, IncludeTypes = new[] { typeof(Box_Enum_Int16_Type) })]
public static Box_Enum_Int16_Type Enum_Int16(short value)
{
return (Box_Enum_Int16_Type)Box_Enum_Int16(value);
@@ -114,6 +96,9 @@ public static Box_Enum_Int16_Type Enum_Int16(short value)
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern object Box_Enum_Int32(int value);
+ [TestCase(Box_Enum_Int32_Type.Min, new[] { "Enum_Int32", "Box_Enum_Int32" }, int.MinValue, IncludeTypes = new[] { typeof(Box_Enum_Int32_Type) })]
+ [TestCase(Box_Enum_Int32_Type.Zero, new[] { "Enum_Int32", "Box_Enum_Int32" }, 0, IncludeTypes = new[] { typeof(Box_Enum_Int32_Type) })]
+ [TestCase(Box_Enum_Int32_Type.Max, new[] { "Enum_Int32", "Box_Enum_Int32" }, int.MaxValue, IncludeTypes = new[] { typeof(Box_Enum_Int32_Type) })]
public static Box_Enum_Int32_Type Enum_Int32(int value)
{
return (Box_Enum_Int32_Type)Box_Enum_Int32(value);
@@ -122,6 +107,9 @@ public static Box_Enum_Int32_Type Enum_Int32(int value)
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern object Box_Enum_Int64(long value);
+ [TestCase(Box_Enum_Int64_Type.Min, new[] { "Enum_Int64", "Box_Enum_Int64" }, long.MinValue, IncludeTypes = new[] { typeof(Box_Enum_Int64_Type) })]
+ [TestCase(Box_Enum_Int64_Type.Zero, new[] { "Enum_Int64", "Box_Enum_Int64" }, 0L, IncludeTypes = new[] { typeof(Box_Enum_Int64_Type) })]
+ [TestCase(Box_Enum_Int64_Type.Max, new[] { "Enum_Int64", "Box_Enum_Int64" }, long.MaxValue, IncludeTypes = new[] { typeof(Box_Enum_Int64_Type) })]
public static Box_Enum_Int64_Type Enum_Int64(long value)
{
return (Box_Enum_Int64_Type)Box_Enum_Int64(value);
@@ -130,6 +118,9 @@ public static Box_Enum_Int64_Type Enum_Int64(long value)
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern object Box_Enum_SByte(sbyte value);
+ [TestCase(Box_Enum_SByte_Type.Min, new[] { "Enum_SByte", "Box_Enum_SByte" }, sbyte.MinValue, IncludeTypes = new[] { typeof(Box_Enum_SByte_Type) })]
+ [TestCase(Box_Enum_SByte_Type.Zero, new[] { "Enum_SByte", "Box_Enum_SByte" }, 0, IncludeTypes = new[] { typeof(Box_Enum_SByte_Type) })]
+ [TestCase(Box_Enum_SByte_Type.Max, new[] { "Enum_SByte", "Box_Enum_SByte" }, sbyte.MaxValue, IncludeTypes = new[] { typeof(Box_Enum_SByte_Type) })]
public static Box_Enum_SByte_Type Enum_SByte(sbyte value)
{
return (Box_Enum_SByte_Type)Box_Enum_SByte(value);
@@ -138,22 +129,27 @@ public static Box_Enum_SByte_Type Enum_SByte(sbyte value)
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern object Box_Enum_UInt16(ushort value);
- public static Box_Enum_UInt16_Type Enum_UInt16(ushort value)
- {
- return (Box_Enum_UInt16_Type)Box_Enum_UInt16(value);
- }
+ [TestCase(Box_Enum_UInt16_Type.Min, new[] { "Enum_UInt16", "Box_Enum_UInt16" }, ushort.MinValue, IncludeTypes = new[] { typeof(Box_Enum_UInt16_Type) })]
+ [TestCase(Box_Enum_UInt16_Type.One, new[] { "Enum_UInt16", "Box_Enum_UInt16" }, (ushort)1, IncludeTypes = new[] { typeof(Box_Enum_UInt16_Type) })]
+ [TestCase(Box_Enum_UInt16_Type.Max, new[] { "Enum_UInt16", "Box_Enum_UInt16" }, ushort.MaxValue, IncludeTypes = new[] { typeof(Box_Enum_UInt16_Type) })]
+ public static Box_Enum_UInt16_Type Enum_UInt16(ushort value) =>
+ (Box_Enum_UInt16_Type)Box_Enum_UInt16(value);
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern object Box_Enum_UInt32(uint value);
- public static Box_Enum_UInt32_Type Enum_UInt32(uint value)
- {
- return (Box_Enum_UInt32_Type)Box_Enum_UInt32(value);
- }
+ [TestCase(Box_Enum_UInt32_Type.Min, new[] { "Enum_UInt32", "Box_Enum_UInt32" }, uint.MinValue, IncludeTypes = new[] { typeof(Box_Enum_UInt32_Type) })]
+ [TestCase(Box_Enum_UInt32_Type.One, new[] { "Enum_UInt32", "Box_Enum_UInt32" }, 1U, IncludeTypes = new[] { typeof(Box_Enum_UInt32_Type) })]
+ [TestCase(Box_Enum_UInt32_Type.Max, new[] { "Enum_UInt32", "Box_Enum_UInt32" }, uint.MaxValue, IncludeTypes = new[] { typeof(Box_Enum_UInt32_Type) })]
+ public static Box_Enum_UInt32_Type Enum_UInt32(uint value) =>
+ (Box_Enum_UInt32_Type)Box_Enum_UInt32(value);
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern object Box_Enum_UInt64(ulong value);
+ [TestCase(Box_Enum_UInt64_Type.Min, new[] { "Enum_UInt64", "Box_Enum_UInt64" }, ulong.MinValue, IncludeTypes = new[] { typeof(Box_Enum_UInt64_Type) })]
+ [TestCase(Box_Enum_UInt64_Type.One, new[] { "Enum_UInt64", "Box_Enum_UInt64" }, 1UL, IncludeTypes = new[] { typeof(Box_Enum_UInt64_Type) })]
+ [TestCase(Box_Enum_UInt64_Type.Max, new[] { "Enum_UInt64", "Box_Enum_UInt64" }, ulong.MaxValue, IncludeTypes = new[] { typeof(Box_Enum_UInt64_Type) })]
public static Box_Enum_UInt64_Type Enum_UInt64(ulong value)
{
return (Box_Enum_UInt64_Type)Box_Enum_UInt64(value);
diff --git a/tests/IL2C.Core.Test.ILConverters/Box/Box_Enum.il b/tests/IL2C.Core.Test.ILConverters/Box/Box_Enum.il
index d05d300c..05aa9dfd 100644
--- a/tests/IL2C.Core.Test.ILConverters/Box/Box_Enum.il
+++ b/tests/IL2C.Core.Test.ILConverters/Box/Box_Enum.il
@@ -4,7 +4,7 @@
{
.maxstack 1
ldarg.0
- box IL2C.ILConverters.Box_Enum_Byte_Type
+ box [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Box_Enum_Byte_Type
ret
}
@@ -12,7 +12,7 @@
{
.maxstack 1
ldarg.0
- box IL2C.ILConverters.Box_Enum_Int16_Type
+ box [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Box_Enum_Int16_Type
ret
}
@@ -20,7 +20,7 @@
{
.maxstack 1
ldarg.0
- box IL2C.ILConverters.Box_Enum_Int32_Type
+ box [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Box_Enum_Int32_Type
ret
}
@@ -28,7 +28,7 @@
{
.maxstack 1
ldarg.0
- box IL2C.ILConverters.Box_Enum_Int64_Type
+ box [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Box_Enum_Int64_Type
ret
}
@@ -36,7 +36,7 @@
{
.maxstack 1
ldarg.0
- box IL2C.ILConverters.Box_Enum_SByte_Type
+ box [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Box_Enum_SByte_Type
ret
}
@@ -44,7 +44,7 @@
{
.maxstack 1
ldarg.0
- box IL2C.ILConverters.Box_Enum_UInt16_Type
+ box [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Box_Enum_UInt16_Type
ret
}
@@ -52,7 +52,7 @@
{
.maxstack 1
ldarg.0
- box IL2C.ILConverters.Box_Enum_UInt32_Type
+ box [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Box_Enum_UInt32_Type
ret
}
@@ -60,7 +60,7 @@
{
.maxstack 1
ldarg.0
- box IL2C.ILConverters.Box_Enum_UInt64_Type
+ box [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Box_Enum_UInt64_Type
ret
}
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Box/Box_Enum_Narrowing.cs b/tests/IL2C.Core.Test.ILConverters/Box/Box_Enum_Narrowing.cs
index c154f529..385e64e6 100644
--- a/tests/IL2C.Core.Test.ILConverters/Box/Box_Enum_Narrowing.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Box/Box_Enum_Narrowing.cs
@@ -13,23 +13,14 @@
namespace IL2C.ILConverters
{
[TestId("Box")]
- [TestCase((Box_Enum_Byte_Type)byte.MinValue, new[] { "Enum_Byte_From_Int32", "Box_Enum_Byte_From_Int32" }, byte.MinValue, IncludeTypes = new[] { typeof(Box_Enum_Byte_Type) })]
- [TestCase((Box_Enum_Byte_Type)1, new[] { "Enum_Byte_From_Int32", "Box_Enum_Byte_From_Int32" }, 1, IncludeTypes = new[] { typeof(Box_Enum_Byte_Type) })]
- [TestCase((Box_Enum_Byte_Type)byte.MaxValue, new[] { "Enum_Byte_From_Int32", "Box_Enum_Byte_From_Int32" }, byte.MaxValue, IncludeTypes = new[] { typeof(Box_Enum_Byte_Type) })]
- [TestCase((Box_Enum_Int16_Type)short.MinValue, new[] { "Enum_Int16_From_Int32", "Box_Enum_Int16_From_Int32" }, short.MinValue, IncludeTypes = new[] { typeof(Box_Enum_Int16_Type) })]
- [TestCase((Box_Enum_Int16_Type)0, new[] { "Enum_Int16_From_Int32", "Box_Enum_Int16_From_Int32" }, 0, IncludeTypes = new[] { typeof(Box_Enum_Int16_Type) })]
- [TestCase((Box_Enum_Int16_Type)short.MaxValue, new[] { "Enum_Int16_From_Int32", "Box_Enum_Int16_From_Int32" }, short.MaxValue, IncludeTypes = new[] { typeof(Box_Enum_Int16_Type) })]
- [TestCase((Box_Enum_SByte_Type)sbyte.MinValue, new[] { "Enum_SByte_From_Int32", "Box_Enum_SByte_From_Int32" }, sbyte.MinValue, IncludeTypes = new[] { typeof(Box_Enum_SByte_Type) })]
- [TestCase((Box_Enum_SByte_Type)0, new[] { "Enum_SByte_From_Int32", "Box_Enum_SByte_From_Int32" }, 0, IncludeTypes = new[] { typeof(Box_Enum_SByte_Type) })]
- [TestCase((Box_Enum_SByte_Type)sbyte.MaxValue, new[] { "Enum_SByte_From_Int32", "Box_Enum_SByte_From_Int32" }, sbyte.MaxValue, IncludeTypes = new[] { typeof(Box_Enum_SByte_Type) })]
- [TestCase((Box_Enum_UInt16_Type)ushort.MinValue, new[] { "Enum_UInt16_From_Int32", "Box_Enum_UInt16_From_Int32" }, ushort.MinValue, IncludeTypes = new[] { typeof(Box_Enum_UInt16_Type) })]
- [TestCase((Box_Enum_UInt16_Type)1, new[] { "Enum_UInt16_From_Int32", "Box_Enum_UInt16_From_Int32" }, 1, IncludeTypes = new[] { typeof(Box_Enum_UInt16_Type) })]
- [TestCase((Box_Enum_UInt16_Type)ushort.MaxValue, new[] { "Enum_UInt16_From_Int32", "Box_Enum_UInt16_From_Int32" }, ushort.MaxValue, IncludeTypes = new[] { typeof(Box_Enum_UInt16_Type) })]
public sealed class Box_Enum_Narrowing
{
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern object Box_Enum_Byte_From_Int32(int value);
+ [TestCase((Box_Enum_Byte_Type)byte.MinValue, new[] { "Enum_Byte_From_Int32", "Box_Enum_Byte_From_Int32" }, byte.MinValue, IncludeTypes = new[] { typeof(Box_Enum_Byte_Type) })]
+ [TestCase((Box_Enum_Byte_Type)1, new[] { "Enum_Byte_From_Int32", "Box_Enum_Byte_From_Int32" }, 1, IncludeTypes = new[] { typeof(Box_Enum_Byte_Type) })]
+ [TestCase((Box_Enum_Byte_Type)byte.MaxValue, new[] { "Enum_Byte_From_Int32", "Box_Enum_Byte_From_Int32" }, byte.MaxValue, IncludeTypes = new[] { typeof(Box_Enum_Byte_Type) })]
public static Box_Enum_Byte_Type Enum_Byte_From_Int32(int value)
{
return (Box_Enum_Byte_Type)Box_Enum_Byte_From_Int32(value);
@@ -38,6 +29,9 @@ public static Box_Enum_Byte_Type Enum_Byte_From_Int32(int value)
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern object Box_Enum_Int16_From_Int32(int value);
+ [TestCase((Box_Enum_Int16_Type)short.MinValue, new[] { "Enum_Int16_From_Int32", "Box_Enum_Int16_From_Int32" }, short.MinValue, IncludeTypes = new[] { typeof(Box_Enum_Int16_Type) })]
+ [TestCase((Box_Enum_Int16_Type)0, new[] { "Enum_Int16_From_Int32", "Box_Enum_Int16_From_Int32" }, 0, IncludeTypes = new[] { typeof(Box_Enum_Int16_Type) })]
+ [TestCase((Box_Enum_Int16_Type)short.MaxValue, new[] { "Enum_Int16_From_Int32", "Box_Enum_Int16_From_Int32" }, short.MaxValue, IncludeTypes = new[] { typeof(Box_Enum_Int16_Type) })]
public static Box_Enum_Int16_Type Enum_Int16_From_Int32(int value)
{
return (Box_Enum_Int16_Type)Box_Enum_Int16_From_Int32(value);
@@ -46,6 +40,9 @@ public static Box_Enum_Int16_Type Enum_Int16_From_Int32(int value)
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern object Box_Enum_SByte_From_Int32(int value);
+ [TestCase((Box_Enum_SByte_Type)sbyte.MinValue, new[] { "Enum_SByte_From_Int32", "Box_Enum_SByte_From_Int32" }, sbyte.MinValue, IncludeTypes = new[] { typeof(Box_Enum_SByte_Type) })]
+ [TestCase((Box_Enum_SByte_Type)0, new[] { "Enum_SByte_From_Int32", "Box_Enum_SByte_From_Int32" }, 0, IncludeTypes = new[] { typeof(Box_Enum_SByte_Type) })]
+ [TestCase((Box_Enum_SByte_Type)sbyte.MaxValue, new[] { "Enum_SByte_From_Int32", "Box_Enum_SByte_From_Int32" }, sbyte.MaxValue, IncludeTypes = new[] { typeof(Box_Enum_SByte_Type) })]
public static Box_Enum_SByte_Type Enum_SByte_From_Int32(int value)
{
return (Box_Enum_SByte_Type)Box_Enum_SByte_From_Int32(value);
@@ -54,6 +51,9 @@ public static Box_Enum_SByte_Type Enum_SByte_From_Int32(int value)
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern object Box_Enum_UInt16_From_Int32(int value);
+ [TestCase((Box_Enum_UInt16_Type)ushort.MinValue, new[] { "Enum_UInt16_From_Int32", "Box_Enum_UInt16_From_Int32" }, ushort.MinValue, IncludeTypes = new[] { typeof(Box_Enum_UInt16_Type) })]
+ [TestCase((Box_Enum_UInt16_Type)1, new[] { "Enum_UInt16_From_Int32", "Box_Enum_UInt16_From_Int32" }, 1, IncludeTypes = new[] { typeof(Box_Enum_UInt16_Type) })]
+ [TestCase((Box_Enum_UInt16_Type)ushort.MaxValue, new[] { "Enum_UInt16_From_Int32", "Box_Enum_UInt16_From_Int32" }, ushort.MaxValue, IncludeTypes = new[] { typeof(Box_Enum_UInt16_Type) })]
public static Box_Enum_UInt16_Type Enum_UInt16_From_Int32(int value)
{
return (Box_Enum_UInt16_Type)Box_Enum_UInt16_From_Int32(value);
diff --git a/tests/IL2C.Core.Test.ILConverters/Box/Box_Enum_Narrowing.il b/tests/IL2C.Core.Test.ILConverters/Box/Box_Enum_Narrowing.il
index 932d24a0..2142eb34 100644
--- a/tests/IL2C.Core.Test.ILConverters/Box/Box_Enum_Narrowing.il
+++ b/tests/IL2C.Core.Test.ILConverters/Box/Box_Enum_Narrowing.il
@@ -4,7 +4,7 @@
{
.maxstack 1
ldarg.0
- box IL2C.ILConverters.Box_Enum_Byte_Type
+ box [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Box_Enum_Byte_Type
ret
}
@@ -12,7 +12,7 @@
{
.maxstack 1
ldarg.0
- box IL2C.ILConverters.Box_Enum_Int16_Type
+ box [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Box_Enum_Int16_Type
ret
}
@@ -20,7 +20,7 @@
{
.maxstack 1
ldarg.0
- box IL2C.ILConverters.Box_Enum_SByte_Type
+ box [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Box_Enum_SByte_Type
ret
}
@@ -28,7 +28,7 @@
{
.maxstack 1
ldarg.0
- box IL2C.ILConverters.Box_Enum_UInt16_Type
+ box [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Box_Enum_UInt16_Type
ret
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Box/Box_Enum_Widing.cs b/tests/IL2C.Core.Test.ILConverters/Box/Box_Enum_Widing.cs
index 1905b4b7..105348cd 100644
--- a/tests/IL2C.Core.Test.ILConverters/Box/Box_Enum_Widing.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Box/Box_Enum_Widing.cs
@@ -13,23 +13,14 @@
namespace IL2C.ILConverters
{
[TestId("Box")]
- [TestCase((Box_Enum_Int32_Type)byte.MinValue, new[] { "Enum_Int32_From_Byte", "Box_Enum_Int32_From_Byte" }, byte.MinValue, IncludeTypes = new[] { typeof(Box_Enum_Int32_Type) })]
- [TestCase((Box_Enum_Int32_Type)1, new[] { "Enum_Int32_From_Byte", "Box_Enum_Int32_From_Byte" }, 1, IncludeTypes = new[] { typeof(Box_Enum_Int32_Type) })]
- [TestCase((Box_Enum_Int32_Type)byte.MaxValue, new[] { "Enum_Int32_From_Byte", "Box_Enum_Int32_From_Byte" }, byte.MaxValue, IncludeTypes = new[] { typeof(Box_Enum_Int32_Type) })]
- [TestCase((Box_Enum_Int32_Type)short.MinValue, new[] { "Enum_Int32_From_Int16", "Box_Enum_Int32_From_Int16" }, short.MinValue, IncludeTypes = new[] { typeof(Box_Enum_Int32_Type) })]
- [TestCase((Box_Enum_Int32_Type)0, new[] { "Enum_Int32_From_Int16", "Box_Enum_Int32_From_Int16" }, 0, IncludeTypes = new[] { typeof(Box_Enum_Int32_Type) })]
- [TestCase((Box_Enum_Int32_Type)short.MaxValue, new[] { "Enum_Int32_From_Int16", "Box_Enum_Int32_From_Int16" }, short.MaxValue, IncludeTypes = new[] { typeof(Box_Enum_Int32_Type) })]
- [TestCase((Box_Enum_Int32_Type)sbyte.MinValue, new[] { "Enum_Int32_From_SByte", "Box_Enum_Int32_From_SByte" }, sbyte.MinValue, IncludeTypes = new[] { typeof(Box_Enum_Int32_Type) })]
- [TestCase((Box_Enum_Int32_Type)0, new[] { "Enum_Int32_From_SByte", "Box_Enum_Int32_From_SByte" }, 0, IncludeTypes = new[] { typeof(Box_Enum_Int32_Type) })]
- [TestCase((Box_Enum_Int32_Type)sbyte.MaxValue, new[] { "Enum_Int32_From_SByte", "Box_Enum_Int32_From_SByte" }, sbyte.MaxValue, IncludeTypes = new[] { typeof(Box_Enum_Int32_Type) })]
- [TestCase((Box_Enum_Int32_Type)ushort.MinValue, new[] { "Enum_Int32_From_UInt16", "Box_Enum_Int32_From_UInt16" }, ushort.MinValue, IncludeTypes = new[] { typeof(Box_Enum_Int32_Type) })]
- [TestCase((Box_Enum_Int32_Type)1, new[] { "Enum_Int32_From_UInt16", "Box_Enum_Int32_From_UInt16" }, 1, IncludeTypes = new[] { typeof(Box_Enum_Int32_Type) })]
- [TestCase((Box_Enum_Int32_Type)ushort.MaxValue, new[] { "Enum_Int32_From_UInt16", "Box_Enum_Int32_From_UInt16" }, ushort.MaxValue, IncludeTypes = new[] { typeof(Box_Enum_Int32_Type) })]
public sealed class Box_Enum_Widing
{
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern object Box_Enum_Int32_From_Byte(byte value);
+ [TestCase((Box_Enum_Int32_Type)byte.MinValue, new[] { "Enum_Int32_From_Byte", "Box_Enum_Int32_From_Byte" }, byte.MinValue, IncludeTypes = new[] { typeof(Box_Enum_Int32_Type) })]
+ [TestCase((Box_Enum_Int32_Type)1, new[] { "Enum_Int32_From_Byte", "Box_Enum_Int32_From_Byte" }, 1, IncludeTypes = new[] { typeof(Box_Enum_Int32_Type) })]
+ [TestCase((Box_Enum_Int32_Type)byte.MaxValue, new[] { "Enum_Int32_From_Byte", "Box_Enum_Int32_From_Byte" }, byte.MaxValue, IncludeTypes = new[] { typeof(Box_Enum_Int32_Type) })]
public static Box_Enum_Int32_Type Enum_Int32_From_Byte(byte value)
{
return (Box_Enum_Int32_Type)Box_Enum_Int32_From_Byte(value);
@@ -38,6 +29,9 @@ public static Box_Enum_Int32_Type Enum_Int32_From_Byte(byte value)
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern object Box_Enum_Int32_From_Int16(short value);
+ [TestCase((Box_Enum_Int32_Type)short.MinValue, new[] { "Enum_Int32_From_Int16", "Box_Enum_Int32_From_Int16" }, short.MinValue, IncludeTypes = new[] { typeof(Box_Enum_Int32_Type) })]
+ [TestCase((Box_Enum_Int32_Type)0, new[] { "Enum_Int32_From_Int16", "Box_Enum_Int32_From_Int16" }, 0, IncludeTypes = new[] { typeof(Box_Enum_Int32_Type) })]
+ [TestCase((Box_Enum_Int32_Type)short.MaxValue, new[] { "Enum_Int32_From_Int16", "Box_Enum_Int32_From_Int16" }, short.MaxValue, IncludeTypes = new[] { typeof(Box_Enum_Int32_Type) })]
public static Box_Enum_Int32_Type Enum_Int32_From_Int16(short value)
{
return (Box_Enum_Int32_Type)Box_Enum_Int32_From_Int16(value);
@@ -46,6 +40,9 @@ public static Box_Enum_Int32_Type Enum_Int32_From_Int16(short value)
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern object Box_Enum_Int32_From_SByte(sbyte value);
+ [TestCase((Box_Enum_Int32_Type)sbyte.MinValue, new[] { "Enum_Int32_From_SByte", "Box_Enum_Int32_From_SByte" }, sbyte.MinValue, IncludeTypes = new[] { typeof(Box_Enum_Int32_Type) })]
+ [TestCase((Box_Enum_Int32_Type)0, new[] { "Enum_Int32_From_SByte", "Box_Enum_Int32_From_SByte" }, 0, IncludeTypes = new[] { typeof(Box_Enum_Int32_Type) })]
+ [TestCase((Box_Enum_Int32_Type)sbyte.MaxValue, new[] { "Enum_Int32_From_SByte", "Box_Enum_Int32_From_SByte" }, sbyte.MaxValue, IncludeTypes = new[] { typeof(Box_Enum_Int32_Type) })]
public static Box_Enum_Int32_Type Enum_Int32_From_SByte(sbyte value)
{
return (Box_Enum_Int32_Type)Box_Enum_Int32_From_SByte(value);
@@ -54,9 +51,10 @@ public static Box_Enum_Int32_Type Enum_Int32_From_SByte(sbyte value)
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern object Box_Enum_Int32_From_UInt16(ushort value);
- public static Box_Enum_Int32_Type Enum_Int32_From_UInt16(ushort value)
- {
- return (Box_Enum_Int32_Type)Box_Enum_Int32_From_UInt16(value);
- }
+ [TestCase((Box_Enum_Int32_Type)ushort.MinValue, new[] { "Enum_Int32_From_UInt16", "Box_Enum_Int32_From_UInt16" }, ushort.MinValue, IncludeTypes = new[] { typeof(Box_Enum_Int32_Type) })]
+ [TestCase((Box_Enum_Int32_Type)1, new[] { "Enum_Int32_From_UInt16", "Box_Enum_Int32_From_UInt16" }, (ushort)1, IncludeTypes = new[] { typeof(Box_Enum_Int32_Type) })]
+ [TestCase((Box_Enum_Int32_Type)ushort.MaxValue, new[] { "Enum_Int32_From_UInt16", "Box_Enum_Int32_From_UInt16" }, ushort.MaxValue, IncludeTypes = new[] { typeof(Box_Enum_Int32_Type) })]
+ public static Box_Enum_Int32_Type Enum_Int32_From_UInt16(ushort value) =>
+ (Box_Enum_Int32_Type)Box_Enum_Int32_From_UInt16(value);
}
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Box/Box_Enum_Widing.il b/tests/IL2C.Core.Test.ILConverters/Box/Box_Enum_Widing.il
index 794a6a45..227de922 100644
--- a/tests/IL2C.Core.Test.ILConverters/Box/Box_Enum_Widing.il
+++ b/tests/IL2C.Core.Test.ILConverters/Box/Box_Enum_Widing.il
@@ -4,7 +4,7 @@
{
.maxstack 1
ldarg.0
- box IL2C.ILConverters.Box_Enum_Int32_Type
+ box [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Box_Enum_Int32_Type
ret
}
@@ -12,7 +12,7 @@
{
.maxstack 1
ldarg.0
- box IL2C.ILConverters.Box_Enum_Int32_Type
+ box [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Box_Enum_Int32_Type
ret
}
@@ -20,7 +20,7 @@
{
.maxstack 1
ldarg.0
- box IL2C.ILConverters.Box_Enum_Int32_Type
+ box [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Box_Enum_Int32_Type
ret
}
@@ -28,7 +28,7 @@
{
.maxstack 1
ldarg.0
- box IL2C.ILConverters.Box_Enum_Int32_Type
+ box [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Box_Enum_Int32_Type
ret
}
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Box/Box_Narrowing.cs b/tests/IL2C.Core.Test.ILConverters/Box/Box_Narrowing.cs
index 80df4b4f..516bb7de 100644
--- a/tests/IL2C.Core.Test.ILConverters/Box/Box_Narrowing.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Box/Box_Narrowing.cs
@@ -13,17 +13,12 @@
namespace IL2C.ILConverters
{
[TestId("Box")]
- [TestCase(124, new[] { "Int32ToByte", "Box_Int32ToByte" }, 123)]
- [TestCase(12346, new[] { "Int32ToInt16", "Box_Int32ToInt16" }, 12345)]
- [TestCase(true, new[] { "Int32ToBool", "Box_Int32ToBool" }, 1)]
- [TestCase(false, new[] { "Int32ToBool", "Box_Int32ToBool" }, 0)]
- [TestCase('A', new[] { "Int32ToChar", "Box_Int32ToChar" }, 0x41)]
- [TestCase(12345678U, new[] { "Int64ToUInt32", "Box_Int64ToUInt32" }, 12345678L)]
public sealed class Box_Narrowing
{
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern object Box_Int32ToByte(int value);
+ [TestCase(124, new[] { "Int32ToByte", "Box_Int32ToByte" }, 123)]
public static byte Int32ToByte(int value)
{
return (byte)((byte)Box_Int32ToByte(value) + 1);
@@ -32,6 +27,7 @@ public static byte Int32ToByte(int value)
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern object Box_Int32ToInt16(int value);
+ [TestCase(12346, new[] { "Int32ToInt16", "Box_Int32ToInt16" }, 12345)]
public static short Int32ToInt16(int value)
{
return (short)((short)Box_Int32ToInt16(value) + 1);
@@ -40,6 +36,8 @@ public static short Int32ToInt16(int value)
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern object Box_Int32ToBool(int value);
+ [TestCase(true, new[] { "Int32ToBool", "Box_Int32ToBool" }, 1)]
+ [TestCase(false, new[] { "Int32ToBool", "Box_Int32ToBool" }, 0)]
public static bool Int32ToBool(int value)
{
return (bool)Box_Int32ToBool(value);
@@ -48,6 +46,7 @@ public static bool Int32ToBool(int value)
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern object Box_Int32ToChar(int value);
+ [TestCase('A', new[] { "Int32ToChar", "Box_Int32ToChar" }, 0x41)]
public static char Int32ToChar(int value)
{
return (char)Box_Int32ToChar(value);
@@ -56,6 +55,10 @@ public static char Int32ToChar(int value)
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern object Box_Int64ToUInt32(long value);
+ // TODO: Unknown failure on mono linux x64
+ // System.InvalidProgramException : Invalid IL code in IL2C.ILConverters.Box_Narrowing:Box_Int64ToUInt32 (long): IL_0001: box 0x01000028
+ [TestCase(12345678U, new[] { "Int64ToUInt32", "Box_Int64ToUInt32" }, 12345678L,
+ RunOnPlatforms = RunOnPlatforms.DotNet)]
public static uint Int64ToUInt32(long value)
{
return (uint)Box_Int64ToUInt32(value);
diff --git a/tests/IL2C.Core.Test.ILConverters/Box/Box_Widing.cs b/tests/IL2C.Core.Test.ILConverters/Box/Box_Widing.cs
index 4f9cbc31..4ff0e5b4 100644
--- a/tests/IL2C.Core.Test.ILConverters/Box/Box_Widing.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Box/Box_Widing.cs
@@ -13,18 +13,12 @@
namespace IL2C.ILConverters
{
[TestId("Box")]
- [TestCase(1000123, new[] { "ByteToInt32", "Box_ByteToInt32" }, 123)]
- [TestCase(1012345, new[] { "Int16ToInt32", "Box_Int16ToInt32" }, 12345)]
- [TestCase(1000123, new[] { "SByteToInt32", "Box_SByteToInt32" }, 123)]
- [TestCase(1012345, new[] { "UInt16ToInt32", "Box_UInt16ToInt32" }, 12345)]
- [TestCase(1, new[] { "BoolToInt32", "Box_BoolToInt32" }, true)]
- [TestCase(0, new[] { "BoolToInt32", "Box_BoolToInt32" }, false)]
- [TestCase(0x41, new[] { "CharToInt32", "Box_CharToInt32" }, 'A')]
public sealed class Box_Widing
{
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern object Box_ByteToInt32(byte value);
+ [TestCase(1000123, new[] { "ByteToInt32", "Box_ByteToInt32" }, 123)]
public static int ByteToInt32(byte value)
{
return (int)Box_ByteToInt32(value) + 1000000;
@@ -33,6 +27,7 @@ public static int ByteToInt32(byte value)
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern object Box_Int16ToInt32(short value);
+ [TestCase(1012345, new[] { "Int16ToInt32", "Box_Int16ToInt32" }, 12345)]
public static int Int16ToInt32(short value)
{
return (int)Box_Int16ToInt32(value) + 1000000;
@@ -41,6 +36,7 @@ public static int Int16ToInt32(short value)
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern object Box_SByteToInt32(sbyte value);
+ [TestCase(1000123, new[] { "SByteToInt32", "Box_SByteToInt32" }, 123)]
public static int SByteToInt32(sbyte value)
{
return (int)Box_SByteToInt32(value) + 1000000;
@@ -49,14 +45,15 @@ public static int SByteToInt32(sbyte value)
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern object Box_UInt16ToInt32(ushort value);
- public static int UInt16ToInt32(ushort value)
- {
- return (int)Box_UInt16ToInt32(value) + 1000000;
- }
+ [TestCase(1012345, new[] { "UInt16ToInt32", "Box_UInt16ToInt32" }, (ushort)12345)]
+ public static int UInt16ToInt32(ushort value) =>
+ (int)Box_UInt16ToInt32(value) + 1000000;
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern object Box_BoolToInt32(bool value);
+ [TestCase(1, new[] { "BoolToInt32", "Box_BoolToInt32" }, true)]
+ [TestCase(0, new[] { "BoolToInt32", "Box_BoolToInt32" }, false)]
public static int BoolToInt32(bool value)
{
return (int)Box_BoolToInt32(value);
@@ -65,6 +62,7 @@ public static int BoolToInt32(bool value)
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern object Box_CharToInt32(char value);
+ [TestCase(0x41, new[] { "CharToInt32", "Box_CharToInt32" }, 'A')]
public static int CharToInt32(char value)
{
return (int)Box_CharToInt32(value);
diff --git a/tests/IL2C.Core.Test.ILConverters/Br/Br.cs b/tests/IL2C.Core.Test.ILConverters/Br/Br.cs
index d70173a7..b997e0c3 100644
--- a/tests/IL2C.Core.Test.ILConverters/Br/Br.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Br/Br.cs
@@ -12,9 +12,12 @@
namespace IL2C.ILConverters
{
- [TestCase(5, "Rem2", 12345, 47, 26)]
public sealed class Br
{
+ // TODO: Unknown failure on mono linux x64
+ // System.InvalidProgramException : System.InvalidProgramException : Invalid IL code in IL2C.ILConverters.Br:Rem2 (int,int,int): IL_0007: rem
+ [TestCase(5, "Rem2", 12345, 47, 26,
+ RunOnPlatforms = RunOnPlatforms.DotNet)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Rem2(int v, int d1, int d2);
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Br_s/Br_s.cs b/tests/IL2C.Core.Test.ILConverters/Br_s/Br_s.cs
index 8f97107a..acd91c9b 100644
--- a/tests/IL2C.Core.Test.ILConverters/Br_s/Br_s.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Br_s/Br_s.cs
@@ -12,9 +12,12 @@
namespace IL2C.ILConverters
{
- [TestCase(5, "Rem2", 12345, 47, 26)]
public sealed class Br_s
{
+ // TODO: Unknown failure on mono linux x64
+ // System.InvalidProgramException : System.InvalidProgramException : Invalid IL code in IL2C.ILConverters.Br:Rem2 (int,int,int): IL_0007: rem
+ [TestCase(5, "Rem2", 12345, 47, 26,
+ RunOnPlatforms = RunOnPlatforms.DotNet)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Rem2(int v, int d1, int d2);
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Break/Break.cs b/tests/IL2C.Core.Test.ILConverters/Break/Break.cs
index 42dfbc63..00ff9ce4 100644
--- a/tests/IL2C.Core.Test.ILConverters/Break/Break.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Break/Break.cs
@@ -9,13 +9,18 @@
using System;
using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
namespace IL2C.ILConverters
{
- [TestCase(0, "CauseBreak", 100, 23, Assert = TestCaseAsserts.CauseBreak)]
public sealed class Break
{
[MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern int CauseBreak(int v1, int v2);
+ private static extern int CauseBreakImpl(int v1, int v2);
+
+ [TestCase(0, "CauseBreak", 100, 23, Assert = TestCaseAsserts.CauseBreak)]
+ public static int CauseBreak(int v1, int v2) =>
+ // In CoreCLR, break opcode will be ignored.
+ IL2CServices.IsInNativeExecution ? CauseBreakImpl(v1, v2) : 0;
}
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Break/Break.il b/tests/IL2C.Core.Test.ILConverters/Break/Break.il
index eeac71b4..04fe9058 100644
--- a/tests/IL2C.Core.Test.ILConverters/Break/Break.il
+++ b/tests/IL2C.Core.Test.ILConverters/Break/Break.il
@@ -1,6 +1,6 @@
.class public IL2C.ILConverters.Break
{
- .method public static int32 CauseBreak(int32 v1, int32 v2) cil managed
+ .method private static int32 CauseBreakImpl(int32 v1, int32 v2) cil managed
{
.maxstack 2
ldarg.0
diff --git a/tests/IL2C.Core.Test.ILConverters/Brfalse/Brfalse.cs b/tests/IL2C.Core.Test.ILConverters/Brfalse/Brfalse.cs
index b410b96c..fb296c31 100644
--- a/tests/IL2C.Core.Test.ILConverters/Brfalse/Brfalse.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Brfalse/Brfalse.cs
@@ -12,25 +12,31 @@
namespace IL2C.ILConverters
{
- [TestCase("ABC", "FlagValue", true)]
- [TestCase("DEF", "FlagValue", false)]
- [TestCase("ABC", "Int32Value", 100)]
- [TestCase("DEF", "Int32Value", 0)]
- [TestCase("ABC", "Int32Value", -100)]
- [TestCase("ABC", "IntPtrValue", 100)]
- [TestCase("DEF", "IntPtrValue", 0)]
- [TestCase("ABC", "IntPtrValue", -100)]
- [TestCase("ABC", "ObjectValue", "")]
- [TestCase("DEF", "ObjectValue", null!)]
public sealed class Brfalse
{
+ [TestCase("ABC", "FlagValue", true)]
+ [TestCase("DEF", "FlagValue", false)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string FlagValue(bool v);
+ [TestCase("ABC", "Int32Value", 100)]
+ [TestCase("DEF", "Int32Value", 0)]
+ [TestCase("ABC", "Int32Value", -100)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Int32Value(int v);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern string IntPtrValueImpl(IntPtr v);
+
+ [TestCase("ABC", "IntPtrValue", 100)]
+ [TestCase("DEF", "IntPtrValue", 0)]
+ [TestCase("ABC", "IntPtrValue", -100)]
+ public static string IntPtrValue(int v) =>
+ IntPtrValueImpl((IntPtr)v);
+
+ [TestCase("ABC", "ObjectValue", "")]
+ [TestCase("DEF", "ObjectValue", null!)]
[MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern string IntPtrValue(IntPtr v);
+ public static extern string ObjectValue(object v);
}
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Brfalse/Brfalse.il b/tests/IL2C.Core.Test.ILConverters/Brfalse/Brfalse.il
index cb735037..317203af 100644
--- a/tests/IL2C.Core.Test.ILConverters/Brfalse/Brfalse.il
+++ b/tests/IL2C.Core.Test.ILConverters/Brfalse/Brfalse.il
@@ -24,7 +24,7 @@
ret
}
- .method public static string IntPtrValue(native int v) cil managed
+ .method private static string IntPtrValueImpl(native int v) cil managed
{
.maxstack 2
ldarg.0
diff --git a/tests/IL2C.Core.Test.ILConverters/Brfalse_s/Brfalse_s.cs b/tests/IL2C.Core.Test.ILConverters/Brfalse_s/Brfalse_s.cs
index 35db9937..87928c3c 100644
--- a/tests/IL2C.Core.Test.ILConverters/Brfalse_s/Brfalse_s.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Brfalse_s/Brfalse_s.cs
@@ -12,25 +12,31 @@
namespace IL2C.ILConverters
{
- [TestCase("ABC", "FlagValue", true)]
- [TestCase("DEF", "FlagValue", false)]
- [TestCase("ABC", "Int32Value", 100)]
- [TestCase("DEF", "Int32Value", 0)]
- [TestCase("ABC", "Int32Value", -100)]
- [TestCase("ABC", "IntPtrValue", 100)]
- [TestCase("DEF", "IntPtrValue", 0)]
- [TestCase("ABC", "IntPtrValue", -100)]
- [TestCase("ABC", "ObjectValue", "")]
- [TestCase("DEF", "ObjectValue", null!)]
public sealed class Brfalse_s
{
+ [TestCase("ABC", "FlagValue", true)]
+ [TestCase("DEF", "FlagValue", false)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string FlagValue(bool v);
+ [TestCase("ABC", "Int32Value", 100)]
+ [TestCase("DEF", "Int32Value", 0)]
+ [TestCase("ABC", "Int32Value", -100)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Int32Value(int v);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern string IntPtrValueImpl(IntPtr v);
+
+ [TestCase("ABC", "IntPtrValue", 100)]
+ [TestCase("DEF", "IntPtrValue", 0)]
+ [TestCase("ABC", "IntPtrValue", -100)]
+ public static string IntPtrValue(int v) =>
+ IntPtrValueImpl((IntPtr)v);
+
+ [TestCase("ABC", "ObjectValue", "")]
+ [TestCase("DEF", "ObjectValue", null!)]
[MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern string IntPtrValue(IntPtr v);
+ public static extern string ObjectValue(object v);
}
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Brfalse_s/Brfalse_s.il b/tests/IL2C.Core.Test.ILConverters/Brfalse_s/Brfalse_s.il
index 22e43aed..c0e6ca76 100644
--- a/tests/IL2C.Core.Test.ILConverters/Brfalse_s/Brfalse_s.il
+++ b/tests/IL2C.Core.Test.ILConverters/Brfalse_s/Brfalse_s.il
@@ -24,7 +24,7 @@
ret
}
- .method public static string IntPtrValue(native int v) cil managed
+ .method private static string IntPtrValueImpl(native int v) cil managed
{
.maxstack 2
ldarg.0
diff --git a/tests/IL2C.Core.Test.ILConverters/Brtrue/Brtrue.cs b/tests/IL2C.Core.Test.ILConverters/Brtrue/Brtrue.cs
index 1bb52911..4b396259 100644
--- a/tests/IL2C.Core.Test.ILConverters/Brtrue/Brtrue.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Brtrue/Brtrue.cs
@@ -12,27 +12,30 @@
namespace IL2C.ILConverters
{
- [TestCase("ABC", "FlagValue", true)]
- [TestCase("DEF", "FlagValue", false)]
- [TestCase("ABC", "Int32Value", 100)]
- [TestCase("DEF", "Int32Value", 0)]
- [TestCase("ABC", "Int32Value", -100)]
- [TestCase("ABC", "IntPtrValue", 100)]
- [TestCase("DEF", "IntPtrValue", 0)]
- [TestCase("ABC", "IntPtrValue", -100)]
- [TestCase("ABC", "ObjectValue", "")]
- [TestCase("DEF", "ObjectValue", null!)]
public sealed class Brtrue
{
+ [TestCase("ABC", "FlagValue", true)]
+ [TestCase("DEF", "FlagValue", false)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string FlagValue(bool v);
+ [TestCase("ABC", "Int32Value", 100)]
+ [TestCase("DEF", "Int32Value", 0)]
+ [TestCase("ABC", "Int32Value", -100)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Int32Value(int v);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern string IntPtrValue(IntPtr v);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern string IntPtrValueImpl(IntPtr v);
+
+ [TestCase("ABC", "IntPtrValue", 100)]
+ [TestCase("DEF", "IntPtrValue", 0)]
+ [TestCase("ABC", "IntPtrValue", -100)]
+ public static string IntPtrValue(int v) =>
+ IntPtrValueImpl((IntPtr)v);
+ [TestCase("ABC", "ObjectValue", "")]
+ [TestCase("DEF", "ObjectValue", null!)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string ObjectValue(object v);
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Brtrue/Brtrue.il b/tests/IL2C.Core.Test.ILConverters/Brtrue/Brtrue.il
index b04ea0bd..df905c96 100644
--- a/tests/IL2C.Core.Test.ILConverters/Brtrue/Brtrue.il
+++ b/tests/IL2C.Core.Test.ILConverters/Brtrue/Brtrue.il
@@ -24,7 +24,7 @@
ret
}
- .method public static string IntPtrValue(native int v) cil managed
+ .method private static string IntPtrValueImpl(native int v) cil managed
{
.maxstack 2
ldarg.0
diff --git a/tests/IL2C.Core.Test.ILConverters/Brtrue_s/Brtrue_s.cs b/tests/IL2C.Core.Test.ILConverters/Brtrue_s/Brtrue_s.cs
index fae5abcb..5a62111a 100644
--- a/tests/IL2C.Core.Test.ILConverters/Brtrue_s/Brtrue_s.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Brtrue_s/Brtrue_s.cs
@@ -12,27 +12,30 @@
namespace IL2C.ILConverters
{
- [TestCase("ABC", "FlagValue", true)]
- [TestCase("DEF", "FlagValue", false)]
- [TestCase("ABC", "Int32Value", 100)]
- [TestCase("DEF", "Int32Value", 0)]
- [TestCase("ABC", "Int32Value", -100)]
- [TestCase("ABC", "IntPtrValue", 100)]
- [TestCase("DEF", "IntPtrValue", 0)]
- [TestCase("ABC", "IntPtrValue", -100)]
- [TestCase("ABC", "ObjectValue", "")]
- [TestCase("DEF", "ObjectValue", null!)]
public sealed class Brtrue_s
{
+ [TestCase("ABC", "FlagValue", true)]
+ [TestCase("DEF", "FlagValue", false)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string FlagValue(bool v);
+ [TestCase("ABC", "Int32Value", 100)]
+ [TestCase("DEF", "Int32Value", 0)]
+ [TestCase("ABC", "Int32Value", -100)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Int32Value(int v);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern string IntPtrValue(IntPtr v);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern string IntPtrValueImpl(IntPtr v);
+
+ [TestCase("ABC", "IntPtrValue", 100)]
+ [TestCase("DEF", "IntPtrValue", 0)]
+ [TestCase("ABC", "IntPtrValue", -100)]
+ public static string IntPtrValue(int v) =>
+ IntPtrValueImpl((IntPtr)v);
+ [TestCase("ABC", "ObjectValue", "")]
+ [TestCase("DEF", "ObjectValue", null!)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string ObjectValue(object v);
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Brtrue_s/Brtrue_s.il b/tests/IL2C.Core.Test.ILConverters/Brtrue_s/Brtrue_s.il
index cf522f32..2fd26108 100644
--- a/tests/IL2C.Core.Test.ILConverters/Brtrue_s/Brtrue_s.il
+++ b/tests/IL2C.Core.Test.ILConverters/Brtrue_s/Brtrue_s.il
@@ -24,7 +24,7 @@
ret
}
- .method public static string IntPtrValue(native int v) cil managed
+ .method private static string IntPtrValueImpl(native int v) cil managed
{
.maxstack 2
ldarg.0
diff --git a/tests/IL2C.Core.Test.ILConverters/Call/Call.cs b/tests/IL2C.Core.Test.ILConverters/Call/Call.cs
index dd051215..bfcb89c8 100644
--- a/tests/IL2C.Core.Test.ILConverters/Call/Call.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Call/Call.cs
@@ -12,11 +12,6 @@
namespace IL2C.ILConverters
{
- [TestCase(123, new[] { "Static_Int32_Int32", "Add_Static_Int32_Int32" }, 100, 23)]
- [TestCase("ABCDEF", new[] { "Static_String_String", "Concat_Static_String_String" }, "ABC", "DEF")]
- [TestCase(123, new[] { "Static_RefInt_RefInt", "Store_Static_RefInt_RefInt" })]
- [TestCase(679, new[] { "Instance_Int32_ThisInt32", "Add_Instance_Int32_ThisInt32" }, 123, 456)]
- [TestCase("ABCGHIDEFGHI", new[] { "Instance_String_ThisString", "Concat_Instance_String_ThisString" }, "ABC", "DEF")]
public sealed class Call
{
#region Static
@@ -25,6 +20,7 @@ private static int Add_Static_Int32_Int32(int lhs, int rhs)
return lhs + rhs;
}
+ [TestCase(123, new[] { "Static_Int32_Int32", "Add_Static_Int32_Int32" }, 100, 23)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Static_Int32_Int32(int lhs, int rhs);
@@ -33,6 +29,7 @@ private static string Concat_Static_String_String(string lhs, string rhs)
return lhs + rhs;
}
+ [TestCase("ABCDEF", new[] { "Static_String_String", "Concat_Static_String_String" }, "ABC", "DEF")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Static_String_String(string lhs, string rhs);
@@ -42,6 +39,7 @@ private static void Store_Static_RefInt_RefInt(ref int lhs, ref int rhs)
rhs = 23;
}
+ [TestCase(123, new[] { "Static_RefInt_RefInt", "Store_Static_RefInt_RefInt" })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Static_RefInt_RefInt();
#endregion
@@ -54,6 +52,7 @@ private int Add_Instance_Int32_ThisInt32(int v1, int v2)
return v0 + v1 + v2;
}
+ [TestCase(679, new[] { "Instance_Int32_ThisInt32", "Add_Instance_Int32_ThisInt32" }, 123, 456)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Instance_Int32_ThisInt32(int v1, int v2);
@@ -64,6 +63,7 @@ private string Concat_Instance_String_ThisString(string v)
return v + v3;
}
+ [TestCase("ABCGHIDEFGHI", new[] { "Instance_String_ThisString", "Concat_Instance_String_ThisString" }, "ABC", "DEF")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Instance_String_ThisString(string v1, string v2);
#endregion
diff --git a/tests/IL2C.Core.Test.ILConverters/Call/Call_Newslot.cs b/tests/IL2C.Core.Test.ILConverters/Call/Call_Newslot.cs
index 43d8e9d4..734b50eb 100644
--- a/tests/IL2C.Core.Test.ILConverters/Call/Call_Newslot.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Call/Call_Newslot.cs
@@ -13,8 +13,6 @@
namespace IL2C.ILConverters
{
[TestId("Call")]
- [TestCase("IL2C.ILConverters.Call_Newslot", new[] { "Instance_Newslot_ToString_System_Object", "ToString" })]
- [TestCase("CallTest", new[] { "Instance_Newslot_ToString_IL2C_ILConverters_Call", "ToString" })]
public sealed class Call_Newslot
{
public new string ToString()
@@ -22,9 +20,11 @@ public sealed class Call_Newslot
return "CallTest";
}
+ [TestCase("IL2C.ILConverters.Call_Newslot", new[] { "Instance_Newslot_ToString_System_Object", "ToString" })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Instance_Newslot_ToString_System_Object();
+ [TestCase("CallTest", new[] { "Instance_Newslot_ToString_IL2C_ILConverters_Call", "ToString" })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Instance_Newslot_ToString_IL2C_ILConverters_Call();
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Call/Call_Newslot_Virtual.cs b/tests/IL2C.Core.Test.ILConverters/Call/Call_Newslot_Virtual.cs
index e26ef9f4..73d69792 100644
--- a/tests/IL2C.Core.Test.ILConverters/Call/Call_Newslot_Virtual.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Call/Call_Newslot_Virtual.cs
@@ -13,8 +13,6 @@
namespace IL2C.ILConverters
{
[TestId("Call")]
- [TestCase("IL2C.ILConverters.Call_Newslot_Virtual", new[] { "Instance_Newslot_Virtual_ToString_System_Object", "ToString" })]
- [TestCase("CallTest", new[] { "Instance_Newslot_Virtual_ToString_IL2C_ILConverters_Call", "ToString" })]
public class Call_Newslot_Virtual
{
public new virtual string ToString()
@@ -22,9 +20,11 @@ public class Call_Newslot_Virtual
return "CallTest";
}
+ [TestCase("IL2C.ILConverters.Call_Newslot_Virtual", new[] { "Instance_Newslot_Virtual_ToString_System_Object", "ToString" })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Instance_Newslot_Virtual_ToString_System_Object();
+ [TestCase("CallTest", new[] { "Instance_Newslot_Virtual_ToString_IL2C_ILConverters_Call", "ToString" })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Instance_Newslot_Virtual_ToString_IL2C_ILConverters_Call();
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Call/Call_Overload.cs b/tests/IL2C.Core.Test.ILConverters/Call/Call_Overload.cs
index a20ae98f..f0a63714 100644
--- a/tests/IL2C.Core.Test.ILConverters/Call/Call_Overload.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Call/Call_Overload.cs
@@ -13,8 +13,6 @@
namespace IL2C.ILConverters
{
[TestId("Call")]
- [TestCase("IL2C.ILConverters.Call_Overload", new[] { "Instance_Overload_ToString_System_Object", "ToString" })]
- [TestCase("CallTestABC", new[] { "Instance_Overload_ToString_IL2C_ILConverters_Call", "ToString" }, "ABC")]
public class Call_Overload
{
public string ToString(string value)
@@ -22,9 +20,11 @@ public string ToString(string value)
return "CallTest" + value;
}
+ [TestCase("IL2C.ILConverters.Call_Overload", new[] { "Instance_Overload_ToString_System_Object", "ToString" })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Instance_Overload_ToString_System_Object();
+ [TestCase("CallTestABC", new[] { "Instance_Overload_ToString_IL2C_ILConverters_Call", "ToString" }, "ABC")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Instance_Overload_ToString_IL2C_ILConverters_Call(string value);
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Call/Call_Overload_Newslot_Virtual.cs b/tests/IL2C.Core.Test.ILConverters/Call/Call_Overload_Newslot_Virtual.cs
index 1e544617..381fbc34 100644
--- a/tests/IL2C.Core.Test.ILConverters/Call/Call_Overload_Newslot_Virtual.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Call/Call_Overload_Newslot_Virtual.cs
@@ -13,9 +13,6 @@
namespace IL2C.ILConverters
{
[TestId("Call")]
- [TestCase("IL2C.ILConverters.Call_Overload_Newslot_Virtual", new[] { "Instance_Overload_Newslot_Virtual_ToString_System_Object", "ToString" }, IgnoreILErrors = new[] { "ThisMismatch" })]
- [TestCase("CallTest", new[] { "Instance_Overload_Newslot_Virtual_ToString_NoArgument_IL2C_ILConverters_Call", "ToString" })]
- [TestCase("CallTestABC", new[] { "Instance_Overload_Newslot_Virtual_ToString_IL2C_ILConverters_Call", "ToString" }, "ABC")]
public class Call_Overload_Newslot_Virtual
{
public new virtual string ToString()
@@ -28,12 +25,15 @@ public string ToString(string value)
return "CallTest" + value;
}
+ [TestCase("IL2C.ILConverters.Call_Overload_Newslot_Virtual", new[] { "Instance_Overload_Newslot_Virtual_ToString_System_Object", "ToString" }, IgnoreILErrors = new[] { "ThisMismatch" })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Instance_Overload_Newslot_Virtual_ToString_System_Object();
+ [TestCase("CallTest", new[] { "Instance_Overload_Newslot_Virtual_ToString_NoArgument_IL2C_ILConverters_Call", "ToString" })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Instance_Overload_Newslot_Virtual_ToString_NoArgument_IL2C_ILConverters_Call();
+ [TestCase("CallTestABC", new[] { "Instance_Overload_Newslot_Virtual_ToString_IL2C_ILConverters_Call", "ToString" }, "ABC")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Instance_Overload_Newslot_Virtual_ToString_IL2C_ILConverters_Call(string value);
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Call/Call_Overload_Virtual.cs b/tests/IL2C.Core.Test.ILConverters/Call/Call_Overload_Virtual.cs
index 3e48ed46..26aca947 100644
--- a/tests/IL2C.Core.Test.ILConverters/Call/Call_Overload_Virtual.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Call/Call_Overload_Virtual.cs
@@ -13,9 +13,6 @@
namespace IL2C.ILConverters
{
[TestId("Call")]
- [TestCase("IL2C.ILConverters.Call_Overload_Virtual", new[] { "Instance_Overload_Virtual_ToString_System_Object", "ToString" }, IgnoreILErrors = new[] { "ThisMismatch" })]
- [TestCase("CallTest", new[] { "Instance_Overload_Virtual_ToString_NoArgument_IL2C_ILConverters_Call", "ToString" })]
- [TestCase("CallTestABC", new[] { "Instance_Overload_Virtual_ToString_IL2C_ILConverters_Call", "ToString" }, "ABC")]
public class Call_Overload_Virtual
{
public override string ToString()
@@ -28,12 +25,15 @@ public string ToString(string value)
return "CallTest" + value;
}
+ [TestCase("IL2C.ILConverters.Call_Overload_Virtual", new[] { "Instance_Overload_Virtual_ToString_System_Object", "ToString" }, IgnoreILErrors = new[] { "ThisMismatch" })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Instance_Overload_Virtual_ToString_System_Object();
+ [TestCase("CallTest", new[] { "Instance_Overload_Virtual_ToString_NoArgument_IL2C_ILConverters_Call", "ToString" })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Instance_Overload_Virtual_ToString_NoArgument_IL2C_ILConverters_Call();
+ [TestCase("CallTestABC", new[] { "Instance_Overload_Virtual_ToString_IL2C_ILConverters_Call", "ToString" }, "ABC")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Instance_Overload_Virtual_ToString_IL2C_ILConverters_Call(string value);
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Call/Call_Virtual.cs b/tests/IL2C.Core.Test.ILConverters/Call/Call_Virtual.cs
index a4562b5d..68641a39 100644
--- a/tests/IL2C.Core.Test.ILConverters/Call/Call_Virtual.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Call/Call_Virtual.cs
@@ -13,8 +13,6 @@
namespace IL2C.ILConverters
{
[TestId("Call")]
- [TestCase("IL2C.ILConverters.Call_Virtual", new[] { "Instance_ToString_System_Object", "ToString" }, IgnoreILErrors = new[] { "ThisMismatch" })]
- [TestCase("CallTest", new[] { "Instance_ToString_IL2C_ILConverters_Call", "ToString" })]
public sealed class Call_Virtual
{
// NOTE: Splitted these tests from Call class because it contains virtual method, cause undefined ToString function in this case.
@@ -26,9 +24,11 @@ public override string ToString()
return "CallTest";
}
+ [TestCase("IL2C.ILConverters.Call_Virtual", new[] { "Instance_ToString_System_Object", "ToString" }, IgnoreILErrors = new[] { "ThisMismatch" })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Instance_ToString_System_Object();
+ [TestCase("CallTest", new[] { "Instance_ToString_IL2C_ILConverters_Call", "ToString" })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Instance_ToString_IL2C_ILConverters_Call();
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt.cs b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt.cs
index 47f914c0..abef7b05 100644
--- a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt.cs
@@ -12,7 +12,6 @@
namespace IL2C.ILConverters
{
- [TestCase("123ABC", new[] { "NonVirtual_Callvirt", "NonVirtual" }, 123, "ABC")]
public sealed class Callvirt
{
private string NonVirtual(int value1, string value2)
@@ -20,6 +19,7 @@ private string NonVirtual(int value1, string value2)
return value1 + value2;
}
+ [TestCase("123ABC", new[] { "NonVirtual_Callvirt", "NonVirtual" }, 123, "ABC")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string NonVirtual_Callvirt(int value1, string value2);
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived1.cs b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived1.cs
index 875c53f6..b2ac1f12 100644
--- a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived1.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived1.cs
@@ -13,8 +13,6 @@
namespace IL2C.ILConverters
{
[TestId("Callvirt")]
- [TestCase("CallvirtTest", new[] { "Derived1_ToString_System_Object", "ToString" })]
- [TestCase("CallvirtTest", new[] { "Derived1_ToString_IL2C_ILConverters_Callvirt", "ToString" })]
public sealed class Callvirt_Derived1
{
public override string ToString()
@@ -22,9 +20,11 @@ public override string ToString()
return "CallvirtTest";
}
+ [TestCase("CallvirtTest", new[] { "Derived1_ToString_System_Object", "ToString" })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Derived1_ToString_System_Object();
+ [TestCase("CallvirtTest", new[] { "Derived1_ToString_IL2C_ILConverters_Callvirt", "ToString" })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Derived1_ToString_IL2C_ILConverters_Callvirt();
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived1_Newslot.cs b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived1_Newslot.cs
index dda21d02..1ff39831 100644
--- a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived1_Newslot.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived1_Newslot.cs
@@ -13,8 +13,6 @@
namespace IL2C.ILConverters
{
[TestId("Callvirt")]
- [TestCase("IL2C.ILConverters.Callvirt_Derived1_Newslot", new[] { "Derived1_Newslot_ToString_System_Object", "ToString" })]
- [TestCase("CallvirtTest", new[] { "Derived1_Newslot_ToString_IL2C_ILConverters_Callvirt", "ToString" })]
public sealed class Callvirt_Derived1_Newslot
{
public new string ToString()
@@ -22,9 +20,11 @@ public sealed class Callvirt_Derived1_Newslot
return "CallvirtTest";
}
+ [TestCase("IL2C.ILConverters.Callvirt_Derived1_Newslot", new[] { "Derived1_Newslot_ToString_System_Object", "ToString" })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Derived1_Newslot_ToString_System_Object();
+ [TestCase("CallvirtTest", new[] { "Derived1_Newslot_ToString_IL2C_ILConverters_Callvirt", "ToString" })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Derived1_Newslot_ToString_IL2C_ILConverters_Callvirt();
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived1_Newslot_Virtual.cs b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived1_Newslot_Virtual.cs
index 84a5b226..ab597646 100644
--- a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived1_Newslot_Virtual.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived1_Newslot_Virtual.cs
@@ -13,8 +13,6 @@
namespace IL2C.ILConverters
{
[TestId("Callvirt")]
- [TestCase("IL2C.ILConverters.Callvirt_Derived1_Newslot_Virtual", new[] { "Derived1_Newslot_Virtual_ToString_System_Object", "ToString" })]
- [TestCase("CallvirtTest", new[] { "Derived1_Newslot_Virtual_ToString_IL2C_ILConverters_Callvirt", "ToString" })]
public class Callvirt_Derived1_Newslot_Virtual
{
public new virtual string ToString()
@@ -22,9 +20,11 @@ public class Callvirt_Derived1_Newslot_Virtual
return "CallvirtTest";
}
+ [TestCase("IL2C.ILConverters.Callvirt_Derived1_Newslot_Virtual", new[] { "Derived1_Newslot_Virtual_ToString_System_Object", "ToString" })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Derived1_Newslot_Virtual_ToString_System_Object();
+ [TestCase("CallvirtTest", new[] { "Derived1_Newslot_Virtual_ToString_IL2C_ILConverters_Callvirt", "ToString" })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Derived1_Newslot_Virtual_ToString_IL2C_ILConverters_Callvirt();
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived2.cs b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived2.cs
index fe6e37e6..3706dc83 100644
--- a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived2.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived2.cs
@@ -25,8 +25,6 @@ public override string ToString()
}
[TestId("Callvirt")]
- [TestCase("CallvirtTest", new[] { "Derived2_ToString_System_Object", "ToString" }, IncludeBaseTypes = true)]
- [TestCase("CallvirtTest", new[] { "Derived2_ToString_IL2C_ILConverters_Callvirt", "ToString" }, IncludeBaseTypes = true)]
public sealed class Callvirt_Derived2 : Callvirt_Derived2_Base
{
public override string ToString()
@@ -34,9 +32,11 @@ public override string ToString()
return "CallvirtTest";
}
+ [TestCase("CallvirtTest", new[] { "Derived2_ToString_System_Object", "ToString" }, IncludeBaseTypes = true)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Derived2_ToString_System_Object();
+ [TestCase("CallvirtTest", new[] { "Derived2_ToString_IL2C_ILConverters_Callvirt", "ToString" }, IncludeBaseTypes = true)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Derived2_ToString_IL2C_ILConverters_Callvirt();
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived2.il b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived2.il
index a3d94395..19194d54 100644
--- a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived2.il
+++ b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived2.il
@@ -3,7 +3,7 @@
.method public static string Derived2_ToString_System_Object() cil managed
{
.maxstack 1
- newobj instance void class IL2C.ILConverters.Callvirt_Derived2::.ctor()
+ newobj instance void class [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Callvirt_Derived2::.ctor()
callvirt instance string object::ToString()
ret
}
@@ -11,8 +11,8 @@
.method public static string Derived2_ToString_IL2C_ILConverters_Callvirt() cil managed
{
.maxstack 1
- newobj instance void class IL2C.ILConverters.Callvirt_Derived2::.ctor()
- callvirt instance string IL2C.ILConverters.Callvirt_Derived2::ToString()
+ newobj instance void class [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Callvirt_Derived2::.ctor()
+ callvirt instance string [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Callvirt_Derived2::ToString()
ret
}
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived2_Newslot.cs b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived2_Newslot.cs
index b2e1479f..b65e0bc1 100644
--- a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived2_Newslot.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived2_Newslot.cs
@@ -25,9 +25,6 @@ protected Callvirt_Derived2_Newslot_Base()
}
[TestId("Callvirt")]
- [TestCase("IL2C.ILConverters.Callvirt_Derived2_Newslot", new[] { "Derived2_Newslot_ToString_System_Object", "ToString" }, IncludeBaseTypes = true)]
- [TestCase("Callvirt_Derived_Base", new[] { "Derived2_Newslot_ToString_IL2C_ILConverters_Callvirt_Base", "ToString" }, IncludeBaseTypes = true)]
- [TestCase("CallvirtTest", new[] { "Derived2_Newslot_ToString_IL2C_ILConverters_Callvirt", "ToString" }, IncludeBaseTypes = true)]
public sealed class Callvirt_Derived2_Newslot : Callvirt_Derived2_Newslot_Base
{
public new string ToString()
@@ -35,12 +32,15 @@ public sealed class Callvirt_Derived2_Newslot : Callvirt_Derived2_Newslot_Base
return "CallvirtTest";
}
+ [TestCase("IL2C.ILConverters.Callvirt_Derived2_Newslot", new[] { "Derived2_Newslot_ToString_System_Object", "ToString" }, IncludeBaseTypes = true)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Derived2_Newslot_ToString_System_Object();
+ [TestCase("Callvirt_Derived_Base", new[] { "Derived2_Newslot_ToString_IL2C_ILConverters_Callvirt_Base", "ToString" }, IncludeBaseTypes = true)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Derived2_Newslot_ToString_IL2C_ILConverters_Callvirt_Base();
+ [TestCase("CallvirtTest", new[] { "Derived2_Newslot_ToString_IL2C_ILConverters_Callvirt", "ToString" }, IncludeBaseTypes = true)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Derived2_Newslot_ToString_IL2C_ILConverters_Callvirt();
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived2_Newslot.il b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived2_Newslot.il
index 141a600c..c1d0236a 100644
--- a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived2_Newslot.il
+++ b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived2_Newslot.il
@@ -3,7 +3,7 @@
.method public static string Derived2_Newslot_ToString_System_Object() cil managed
{
.maxstack 1
- newobj instance void class IL2C.ILConverters.Callvirt_Derived2_Newslot::.ctor()
+ newobj instance void class [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Callvirt_Derived2_Newslot::.ctor()
callvirt instance string object::ToString()
ret
}
@@ -11,16 +11,16 @@
.method public static string Derived2_Newslot_ToString_IL2C_ILConverters_Callvirt_Base() cil managed
{
.maxstack 1
- newobj instance void class IL2C.ILConverters.Callvirt_Derived2_Newslot::.ctor()
- callvirt instance string IL2C.ILConverters.Callvirt_Derived2_Newslot_Base::ToString()
+ newobj instance void class [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Callvirt_Derived2_Newslot::.ctor()
+ callvirt instance string [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Callvirt_Derived2_Newslot_Base::ToString()
ret
}
.method public static string Derived2_Newslot_ToString_IL2C_ILConverters_Callvirt() cil managed
{
.maxstack 1
- newobj instance void class IL2C.ILConverters.Callvirt_Derived2_Newslot::.ctor()
- callvirt instance string IL2C.ILConverters.Callvirt_Derived2_Newslot::ToString()
+ newobj instance void class [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Callvirt_Derived2_Newslot::.ctor()
+ callvirt instance string [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Callvirt_Derived2_Newslot::ToString()
ret
}
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived2_Newslot_Virtual.cs b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived2_Newslot_Virtual.cs
index 3fac0485..512c0c28 100644
--- a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived2_Newslot_Virtual.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived2_Newslot_Virtual.cs
@@ -25,9 +25,6 @@ protected Callvirt_Derived2_Newslot_Virtual_Base()
}
[TestId("Callvirt")]
- [TestCase("IL2C.ILConverters.Callvirt_Derived2_Newslot_Virtual", new[] { "Derived2_Newslot_Virtual_ToString_System_Object", "ToString" }, IncludeBaseTypes = true)]
- [TestCase("CallvirtTest", new[] { "Derived2_Newslot_Virtual_ToString_IL2C_ILConverters_Callvirt_Base", "ToString" }, IncludeBaseTypes = true)]
- [TestCase("CallvirtTest", new[] { "Derived2_Newslot_Virtual_ToString_IL2C_ILConverters_Callvirt", "ToString" }, IncludeBaseTypes = true)]
public class Callvirt_Derived2_Newslot_Virtual : Callvirt_Derived2_Newslot_Virtual_Base
{
public override string ToString()
@@ -35,12 +32,15 @@ public override string ToString()
return "CallvirtTest";
}
+ [TestCase("IL2C.ILConverters.Callvirt_Derived2_Newslot_Virtual", new[] { "Derived2_Newslot_Virtual_ToString_System_Object", "ToString" }, IncludeBaseTypes = true)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Derived2_Newslot_Virtual_ToString_System_Object();
+ [TestCase("CallvirtTest", new[] { "Derived2_Newslot_Virtual_ToString_IL2C_ILConverters_Callvirt_Base", "ToString" }, IncludeBaseTypes = true)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Derived2_Newslot_Virtual_ToString_IL2C_ILConverters_Callvirt_Base();
+ [TestCase("CallvirtTest", new[] { "Derived2_Newslot_Virtual_ToString_IL2C_ILConverters_Callvirt", "ToString" }, IncludeBaseTypes = true)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Derived2_Newslot_Virtual_ToString_IL2C_ILConverters_Callvirt();
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived2_Newslot_Virtual.il b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived2_Newslot_Virtual.il
index ec3f4acb..bba0c8a2 100644
--- a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived2_Newslot_Virtual.il
+++ b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived2_Newslot_Virtual.il
@@ -3,7 +3,7 @@
.method public static string Derived2_Newslot_Virtual_ToString_System_Object() cil managed
{
.maxstack 1
- newobj instance void class IL2C.ILConverters.Callvirt_Derived2_Newslot_Virtual::.ctor()
+ newobj instance void class [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Callvirt_Derived2_Newslot_Virtual::.ctor()
callvirt instance string object::ToString()
ret
}
@@ -11,16 +11,16 @@
.method public static string Derived2_Newslot_Virtual_ToString_IL2C_ILConverters_Callvirt_Base() cil managed
{
.maxstack 1
- newobj instance void class IL2C.ILConverters.Callvirt_Derived2_Newslot_Virtual::.ctor()
- callvirt instance string IL2C.ILConverters.Callvirt_Derived2_Newslot_Virtual_Base::ToString()
+ newobj instance void class [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Callvirt_Derived2_Newslot_Virtual::.ctor()
+ callvirt instance string [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Callvirt_Derived2_Newslot_Virtual_Base::ToString()
ret
}
.method public static string Derived2_Newslot_Virtual_ToString_IL2C_ILConverters_Callvirt() cil managed
{
.maxstack 1
- newobj instance void class IL2C.ILConverters.Callvirt_Derived2_Newslot_Virtual::.ctor()
- callvirt instance string IL2C.ILConverters.Callvirt_Derived2_Newslot_Virtual::ToString()
+ newobj instance void class [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Callvirt_Derived2_Newslot_Virtual::.ctor()
+ callvirt instance string [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Callvirt_Derived2_Newslot_Virtual::ToString()
ret
}
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived3_Newslot.cs b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived3_Newslot.cs
index 0a3ab7d9..5bfd65fb 100644
--- a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived3_Newslot.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived3_Newslot.cs
@@ -37,10 +37,6 @@ protected Callvirt_Derived3_Newslot_Base2()
}
[TestId("Callvirt")]
- [TestCase("Callvirt_Derived_Base1", new[] { "Derived3_Newslot_ToString_System_Object", "ToString" }, IncludeBaseTypes = true)]
- [TestCase("Callvirt_Derived_Base1", new[] { "Derived3_Newslot_ToString_IL2C_ILConverters_Callvirt_Base1", "ToString" }, IncludeBaseTypes = true)]
- [TestCase("Callvirt_Derived_Base2", new[] { "Derived3_Newslot_ToString_IL2C_ILConverters_Callvirt_Base2", "ToString" }, IncludeBaseTypes = true)]
- [TestCase("CallvirtTest", new[] { "Derived3_Newslot_ToString_IL2C_ILConverters_Callvirt", "ToString" }, IncludeBaseTypes = true)]
public sealed class Callvirt_Derived3_Newslot : Callvirt_Derived3_Newslot_Base2
{
public new string ToString()
@@ -48,15 +44,19 @@ public sealed class Callvirt_Derived3_Newslot : Callvirt_Derived3_Newslot_Base2
return "CallvirtTest";
}
+ [TestCase("Callvirt_Derived_Base1", new[] { "Derived3_Newslot_ToString_System_Object", "ToString" }, IncludeBaseTypes = true)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Derived3_Newslot_ToString_System_Object();
+ [TestCase("Callvirt_Derived_Base1", new[] { "Derived3_Newslot_ToString_IL2C_ILConverters_Callvirt_Base1", "ToString" }, IncludeBaseTypes = true)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Derived3_Newslot_ToString_IL2C_ILConverters_Callvirt_Base1();
+ [TestCase("Callvirt_Derived_Base2", new[] { "Derived3_Newslot_ToString_IL2C_ILConverters_Callvirt_Base2", "ToString" }, IncludeBaseTypes = true)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Derived3_Newslot_ToString_IL2C_ILConverters_Callvirt_Base2();
+ [TestCase("CallvirtTest", new[] { "Derived3_Newslot_ToString_IL2C_ILConverters_Callvirt", "ToString" }, IncludeBaseTypes = true)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Derived3_Newslot_ToString_IL2C_ILConverters_Callvirt();
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived3_Newslot.il b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived3_Newslot.il
index cfaa42bb..8f1b7bf7 100644
--- a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived3_Newslot.il
+++ b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived3_Newslot.il
@@ -3,7 +3,7 @@
.method public static string Derived3_Newslot_ToString_System_Object() cil managed
{
.maxstack 1
- newobj instance void class IL2C.ILConverters.Callvirt_Derived3_Newslot::.ctor()
+ newobj instance void class [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Callvirt_Derived3_Newslot::.ctor()
callvirt instance string object::ToString()
ret
}
@@ -11,24 +11,24 @@
.method public static string Derived3_Newslot_ToString_IL2C_ILConverters_Callvirt_Base1() cil managed
{
.maxstack 1
- newobj instance void class IL2C.ILConverters.Callvirt_Derived3_Newslot::.ctor()
- callvirt instance string IL2C.ILConverters.Callvirt_Derived3_Newslot_Base1::ToString()
+ newobj instance void class [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Callvirt_Derived3_Newslot::.ctor()
+ callvirt instance string [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Callvirt_Derived3_Newslot_Base1::ToString()
ret
}
.method public static string Derived3_Newslot_ToString_IL2C_ILConverters_Callvirt_Base2() cil managed
{
.maxstack 1
- newobj instance void class IL2C.ILConverters.Callvirt_Derived3_Newslot::.ctor()
- callvirt instance string IL2C.ILConverters.Callvirt_Derived3_Newslot_Base2::ToString()
+ newobj instance void class [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Callvirt_Derived3_Newslot::.ctor()
+ callvirt instance string [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Callvirt_Derived3_Newslot_Base2::ToString()
ret
}
.method public static string Derived3_Newslot_ToString_IL2C_ILConverters_Callvirt() cil managed
{
.maxstack 1
- newobj instance void class IL2C.ILConverters.Callvirt_Derived3_Newslot::.ctor()
- callvirt instance string IL2C.ILConverters.Callvirt_Derived3_Newslot::ToString()
+ newobj instance void class [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Callvirt_Derived3_Newslot::.ctor()
+ callvirt instance string [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Callvirt_Derived3_Newslot::ToString()
ret
}
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived3_Newslot_Virtual.cs b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived3_Newslot_Virtual.cs
index eaca689e..cdbf5e0c 100644
--- a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived3_Newslot_Virtual.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived3_Newslot_Virtual.cs
@@ -37,10 +37,6 @@ protected Callvirt_Derived3_Newslot_Virtual_Base2()
}
[TestId("Callvirt")]
- [TestCase("Callvirt_Derived_Base1", new[] { "Derived3_Newslot_Virtual_ToString_System_Object", "ToString" }, IncludeBaseTypes = true)]
- [TestCase("Callvirt_Derived_Base1", new[] { "Derived3_Newslot_Virtual_ToString_IL2C_ILConverters_Callvirt_Base1", "ToString" }, IncludeBaseTypes = true)]
- [TestCase("CallvirtTest", new[] { "Derived3_Newslot_Virtual_ToString_IL2C_ILConverters_Callvirt_Base2", "ToString" }, IncludeBaseTypes = true)]
- [TestCase("CallvirtTest", new[] { "Derived3_Newslot_Virtual_ToString_IL2C_ILConverters_Callvirt", "ToString" }, IncludeBaseTypes = true)]
public sealed class Callvirt_Derived3_Newslot_Virtual : Callvirt_Derived3_Newslot_Virtual_Base2
{
public override string ToString()
@@ -48,15 +44,19 @@ public override string ToString()
return "CallvirtTest";
}
+ [TestCase("Callvirt_Derived_Base1", new[] { "Derived3_Newslot_Virtual_ToString_System_Object", "ToString" }, IncludeBaseTypes = true)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Derived3_Newslot_Virtual_ToString_System_Object();
+ [TestCase("Callvirt_Derived_Base1", new[] { "Derived3_Newslot_Virtual_ToString_IL2C_ILConverters_Callvirt_Base1", "ToString" }, IncludeBaseTypes = true)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Derived3_Newslot_Virtual_ToString_IL2C_ILConverters_Callvirt_Base1();
+ [TestCase("CallvirtTest", new[] { "Derived3_Newslot_Virtual_ToString_IL2C_ILConverters_Callvirt_Base2", "ToString" }, IncludeBaseTypes = true)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Derived3_Newslot_Virtual_ToString_IL2C_ILConverters_Callvirt_Base2();
+ [TestCase("CallvirtTest", new[] { "Derived3_Newslot_Virtual_ToString_IL2C_ILConverters_Callvirt", "ToString" }, IncludeBaseTypes = true)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Derived3_Newslot_Virtual_ToString_IL2C_ILConverters_Callvirt();
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived3_Newslot_Virtual.il b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived3_Newslot_Virtual.il
index 5a4915f9..55258a3c 100644
--- a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived3_Newslot_Virtual.il
+++ b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived3_Newslot_Virtual.il
@@ -3,7 +3,7 @@
.method public static string Derived3_Newslot_Virtual_ToString_System_Object() cil managed
{
.maxstack 1
- newobj instance void class IL2C.ILConverters.Callvirt_Derived3_Newslot_Virtual::.ctor()
+ newobj instance void class [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Callvirt_Derived3_Newslot_Virtual::.ctor()
callvirt instance string object::ToString()
ret
}
@@ -11,24 +11,24 @@
.method public static string Derived3_Newslot_Virtual_ToString_IL2C_ILConverters_Callvirt_Base1() cil managed
{
.maxstack 1
- newobj instance void class IL2C.ILConverters.Callvirt_Derived3_Newslot_Virtual::.ctor()
- callvirt instance string IL2C.ILConverters.Callvirt_Derived3_Newslot_Virtual_Base1::ToString()
+ newobj instance void class [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Callvirt_Derived3_Newslot_Virtual::.ctor()
+ callvirt instance string [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Callvirt_Derived3_Newslot_Virtual_Base1::ToString()
ret
}
.method public static string Derived3_Newslot_Virtual_ToString_IL2C_ILConverters_Callvirt_Base2() cil managed
{
.maxstack 1
- newobj instance void class IL2C.ILConverters.Callvirt_Derived3_Newslot_Virtual::.ctor()
- callvirt instance string IL2C.ILConverters.Callvirt_Derived3_Newslot_Virtual_Base2::ToString()
+ newobj instance void class [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Callvirt_Derived3_Newslot_Virtual::.ctor()
+ callvirt instance string [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Callvirt_Derived3_Newslot_Virtual_Base2::ToString()
ret
}
.method public static string Derived3_Newslot_Virtual_ToString_IL2C_ILConverters_Callvirt() cil managed
{
.maxstack 1
- newobj instance void class IL2C.ILConverters.Callvirt_Derived3_Newslot_Virtual::.ctor()
- callvirt instance string IL2C.ILConverters.Callvirt_Derived3_Newslot_Virtual::ToString()
+ newobj instance void class [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Callvirt_Derived3_Newslot_Virtual::.ctor()
+ callvirt instance string [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Callvirt_Derived3_Newslot_Virtual::ToString()
ret
}
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Conv_i/Conv_i.cs b/tests/IL2C.Core.Test.ILConverters/Conv_i/Conv_i.cs
index 132835fd..11246195 100644
--- a/tests/IL2C.Core.Test.ILConverters/Conv_i/Conv_i.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Conv_i/Conv_i.cs
@@ -12,54 +12,90 @@
namespace IL2C.ILConverters
{
- [TestCase(123, "SByte", (sbyte)123)]
- [TestCase(12345, "Int16", (short)12345)]
- [TestCase(12345, "Int32", 12345)]
- [TestCase(12345, "Int64", 12345L)]
- [TestCase(12345, "IntPtr", 12345)]
- [TestCase(123, "Byte", (byte)123)]
- [TestCase(12345, "UInt16", (ushort)12345)]
- [TestCase(12345, "UInt32", (uint)12345)]
- [TestCase(12345, "UInt64", 12345UL)]
- [TestCase(12345, "UIntPtr", (uint)12345)]
- [TestCase(12345, "Single", 12345.67f)]
- [TestCase(12345, "Double", 12345.67)]
public sealed class Conv_i
{
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr SByte(sbyte value);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr SByteImpl(sbyte value);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr Int16(short value);
+ [TestCase(123, "SByte", (sbyte)123)]
+ public static int SByte(sbyte value) =>
+ SByteImpl(value).ToInt32();
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr Int32(int value);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr Int16Impl(short value);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr Int64(long value);
+ [TestCase(12345, "Int16", (short)12345)]
+ public static int Int16(short value) =>
+ Int16Impl(value).ToInt32();
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr IntPtr(IntPtr value);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr Int32Impl(int value);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr Byte(byte value);
+ [TestCase(12345, "Int32", 12345)]
+ public static int Int32(int value) =>
+ Int32Impl(value).ToInt32();
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr UInt16(ushort value);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr Int64Impl(long value);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr UInt32(uint value);
+ [TestCase(12345L, "Int64", 12345L)]
+ public static long Int64(long value) =>
+ Int64Impl(value).ToInt64();
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr UInt64(ulong value);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr IntPtrImpl(IntPtr value);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr UIntPtr(UIntPtr value);
+ [TestCase(12345, "IntPtr", 12345)]
+ public static int IntPtr(int value) =>
+ IntPtrImpl((IntPtr)value).ToInt32();
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr Single(float value);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr ByteImpl(byte value);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr Double(double value);
+ [TestCase(123, "Byte", (byte)123)]
+ public static int Byte(byte value) =>
+ ByteImpl(value).ToInt32();
+
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr UInt16Impl(ushort value);
+
+ [TestCase(12345, "UInt16", (ushort)12345)]
+ public static int UInt16(ushort value) =>
+ UInt16Impl(value).ToInt32();
+
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr UInt32Impl(uint value);
+
+ [TestCase(12345, "UInt32", (uint)12345)]
+ public static int UInt32(uint value) =>
+ UInt32Impl(value).ToInt32();
+
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr UInt64Impl(ulong value);
+
+ [TestCase(12345, "UInt64", 12345UL)]
+ public static int UInt64(ulong value) =>
+ UInt64Impl(value).ToInt32();
+
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr UIntPtrImpl(UIntPtr value);
+
+ [TestCase(12345, "UIntPtr", (uint)12345)]
+ public static int UIntPtr(uint value) =>
+ UIntPtrImpl((UIntPtr)value).ToInt32();
+
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr SingleImpl(float value);
+
+ [TestCase(12345, "Single", 12345.67f)]
+ public static int Single(float value) =>
+ SingleImpl(value).ToInt32();
+
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr DoubleImpl(double value);
+
+ [TestCase(12345, "Double", 12345.67)]
+ public static int Double(double value) =>
+ DoubleImpl(value).ToInt32();
}
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Conv_i/Conv_i.il b/tests/IL2C.Core.Test.ILConverters/Conv_i/Conv_i.il
index 7ca4301c..1ed6be5c 100644
--- a/tests/IL2C.Core.Test.ILConverters/Conv_i/Conv_i.il
+++ b/tests/IL2C.Core.Test.ILConverters/Conv_i/Conv_i.il
@@ -1,6 +1,6 @@
.class public IL2C.ILConverters.Conv_i
{
- .method public static native int SByte(int8 v) cil managed
+ .method private static native int SByteImpl(int8 v) cil managed
{
.maxstack 1
ldarg.0
@@ -8,7 +8,7 @@
ret
}
- .method public static native int Int16(int16 v) cil managed
+ .method private static native int Int16Impl(int16 v) cil managed
{
.maxstack 1
ldarg.0
@@ -16,7 +16,7 @@
ret
}
- .method public static native int Int32(int32 v) cil managed
+ .method private static native int Int32Impl(int32 v) cil managed
{
.maxstack 1
ldarg.0
@@ -24,7 +24,7 @@
ret
}
- .method public static native int Int64(int64 v) cil managed
+ .method private static native int Int64Impl(int64 v) cil managed
{
.maxstack 1
ldarg.0
@@ -32,7 +32,7 @@
ret
}
- .method public static native int IntPtr(native int v) cil managed
+ .method private static native int IntPtrImpl(native int v) cil managed
{
.maxstack 1
ldarg.0
@@ -40,7 +40,7 @@
ret
}
- .method public static native int Byte(uint8 v) cil managed
+ .method private static native int ByteImpl(uint8 v) cil managed
{
.maxstack 1
ldarg.0
@@ -48,7 +48,7 @@
ret
}
- .method public static native int UInt16(uint16 v) cil managed
+ .method private static native int UInt16Impl(uint16 v) cil managed
{
.maxstack 1
ldarg.0
@@ -56,7 +56,7 @@
ret
}
- .method public static native int UInt32(uint32 v) cil managed
+ .method private static native int UInt32Impl(uint32 v) cil managed
{
.maxstack 1
ldarg.0
@@ -64,7 +64,7 @@
ret
}
- .method public static native int UInt64(uint64 v) cil managed
+ .method private static native int UInt64Impl(uint64 v) cil managed
{
.maxstack 1
ldarg.0
@@ -72,7 +72,7 @@
ret
}
- .method public static native int UIntPtr(native uint v) cil managed
+ .method private static native int UIntPtrImpl(native uint v) cil managed
{
.maxstack 1
ldarg.0
@@ -80,7 +80,7 @@
ret
}
- .method public static native int Single(float32 v) cil managed
+ .method private static native int SingleImpl(float32 v) cil managed
{
.maxstack 1
ldarg.0
@@ -88,7 +88,7 @@
ret
}
- .method public static native int Double(float64 v) cil managed
+ .method private static native int DoubleImpl(float64 v) cil managed
{
.maxstack 1
ldarg.0
diff --git a/tests/IL2C.Core.Test.ILConverters/Conv_i1/Conv_i1.cs b/tests/IL2C.Core.Test.ILConverters/Conv_i1/Conv_i1.cs
index 54a21a7a..654870e2 100644
--- a/tests/IL2C.Core.Test.ILConverters/Conv_i1/Conv_i1.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Conv_i1/Conv_i1.cs
@@ -12,64 +12,70 @@
namespace IL2C.ILConverters
{
- [TestCase((sbyte)123, "SByte", (sbyte)123)]
- [TestCase((sbyte)-123, "SByte", (sbyte)-123)]
- [TestCase((sbyte)123, "Int16", (short)123)]
- [TestCase(unchecked((sbyte)12345), "Int16", (short)12345)]
- [TestCase((sbyte)123, "Int32", 123)]
- [TestCase(unchecked ((sbyte)456), "Int32", 456)]
- [TestCase((sbyte)123, "Int64", 123L)]
- [TestCase(unchecked((sbyte)456), "Int64", 456L)]
- [TestCase((sbyte)123, "IntPtr", 123)]
- [TestCase(unchecked((sbyte)456), "IntPtr", 456)]
- [TestCase((sbyte)123, "Byte", (byte)123)]
- [TestCase(unchecked((sbyte)0x80), "Byte", (byte)0x80)]
- [TestCase(unchecked((sbyte)12345), "UInt16", (ushort)12345)]
- [TestCase(unchecked((sbyte)0x8000), "UInt16", (ushort)0x8000)]
- [TestCase(unchecked((sbyte)456789012), "UInt32", (uint)456789012)]
- [TestCase(unchecked((sbyte)0x80000000), "UInt32", (uint)0x80000000)]
- [TestCase(unchecked((sbyte)456789012), "UInt64", 456789012UL)]
- [TestCase(unchecked((sbyte)0x8000000000000000UL), "UInt64", 0x8000000000000000UL)]
- [TestCase(unchecked((sbyte)456789012), "UIntPtr", (uint)456789012)]
- [TestCase((sbyte)123, "Single", 123.45f)]
- [TestCase(unchecked((sbyte)456), "Single", 456.78f)]
- [TestCase((sbyte)123, "Double", 123.45)]
- [TestCase(unchecked((sbyte)456), "Double", 456.78)]
public sealed class Conv_i1
{
+ [TestCase((sbyte)123, "SByte", (sbyte)123)]
+ [TestCase((sbyte)-123, "SByte", (sbyte)-123)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern sbyte SByte(sbyte value);
+ [TestCase((sbyte)123, "Int16", (short)123)]
+ [TestCase(unchecked((sbyte)12345), "Int16", (short)12345)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern sbyte Int16(short value);
+ [TestCase((sbyte)123, "Int32", 123)]
+ [TestCase(unchecked((sbyte)456), "Int32", 456)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern sbyte Int32(int value);
+ [TestCase((sbyte)123, "Int64", 123L)]
+ [TestCase(unchecked((sbyte)456), "Int64", 456L)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern sbyte Int64(long value);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern sbyte IntPtr(IntPtr value);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern sbyte IntPtrImpl(IntPtr value);
+
+ [TestCase((sbyte)123, "IntPtr", 123)]
+ [TestCase(unchecked((sbyte)456), "IntPtr", 456)]
+ public static sbyte IntPtr(int value) =>
+ IntPtrImpl((IntPtr)value);
+ [TestCase((sbyte)123, "Byte", (byte)123)]
+ [TestCase(unchecked((sbyte)0x80), "Byte", (byte)0x80)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern sbyte Byte(byte value);
+ [TestCase(unchecked((sbyte)12345), "UInt16", (ushort)12345)]
+ [TestCase(unchecked((sbyte)0x8000), "UInt16", (ushort)0x8000)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern sbyte UInt16(ushort value);
+ [TestCase(unchecked((sbyte)456789012), "UInt32", (uint)456789012)]
+ [TestCase(unchecked((sbyte)0x80000000), "UInt32", (uint)0x80000000)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern sbyte UInt32(uint value);
+ [TestCase(unchecked((sbyte)456789012), "UInt64", 456789012UL)]
+ [TestCase(unchecked((sbyte)0x8000000000000000UL), "UInt64", 0x8000000000000000UL)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern sbyte UInt64(ulong value);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern sbyte UIntPtr(UIntPtr value);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern sbyte UIntPtrImpl(UIntPtr value);
+
+ [TestCase(unchecked((sbyte)456789012), "UIntPtr", (uint)456789012)]
+ public static sbyte UIntPtr(uint value) =>
+ UIntPtrImpl((UIntPtr)value);
+ [TestCase((sbyte)123, "Single", 123.45f)]
+ [TestCase(unchecked((sbyte)456), "Single", 456.78f)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern sbyte Single(float value);
+ [TestCase((sbyte)123, "Double", 123.45)]
+ [TestCase(unchecked((sbyte)456), "Double", 456.78)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern sbyte Double(double value);
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Conv_i1/Conv_i1.il b/tests/IL2C.Core.Test.ILConverters/Conv_i1/Conv_i1.il
index db4ea745..5cbc3e87 100644
--- a/tests/IL2C.Core.Test.ILConverters/Conv_i1/Conv_i1.il
+++ b/tests/IL2C.Core.Test.ILConverters/Conv_i1/Conv_i1.il
@@ -32,7 +32,7 @@
ret
}
- .method public static int8 IntPtr(native int v) cil managed
+ .method private static int8 IntPtrImpl(native int v) cil managed
{
.maxstack 1
ldarg.0
@@ -72,7 +72,7 @@
ret
}
- .method public static int8 UIntPtr(native uint v) cil managed
+ .method private static int8 UIntPtrImpl(native uint v) cil managed
{
.maxstack 1
ldarg.0
diff --git a/tests/IL2C.Core.Test.ILConverters/Conv_i2/Conv_i2.cs b/tests/IL2C.Core.Test.ILConverters/Conv_i2/Conv_i2.cs
index afd855bf..55e82f55 100644
--- a/tests/IL2C.Core.Test.ILConverters/Conv_i2/Conv_i2.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Conv_i2/Conv_i2.cs
@@ -12,63 +12,69 @@
namespace IL2C.ILConverters
{
- [TestCase((short)123, "SByte", (sbyte)123)]
- [TestCase((short)-123, "SByte", (sbyte)-123)]
- [TestCase((short)12345, "Int16", (short)12345)]
- [TestCase((short)-12345, "Int16", (short)-12345)]
- [TestCase((short)12345, "Int32", 12345)]
- [TestCase(unchecked ((short)45678), "Int32", 45678)]
- [TestCase((short)12345, "Int64", 12345L)]
- [TestCase(unchecked((short)45678), "Int64", 45678L)]
- [TestCase((short)12345, "IntPtr", 12345)]
- [TestCase(unchecked((short)45678), "IntPtr", 45678)]
- [TestCase((short)123, "Byte", (byte)123)]
- [TestCase((short)12345, "UInt16", (ushort)12345)]
- [TestCase(unchecked((short)0x8000), "UInt16", (ushort)0x8000)]
- [TestCase(unchecked((short)456789012), "UInt32", (uint)456789012)]
- [TestCase(unchecked((short)0x80000000), "UInt32", (uint)0x80000000)]
- [TestCase(unchecked((short)456789012), "UInt64", 456789012UL)]
- [TestCase(unchecked((short)0x8000000000000000UL), "UInt64", 0x8000000000000000UL)]
- [TestCase(unchecked((short)456789012), "UIntPtr", (uint)456789012)]
- [TestCase((short)12345, "Single", 12345.67f)]
- [TestCase(unchecked((short)45678), "Single", 45678.91f)]
- [TestCase((short)12345, "Double", 12345.67)]
- [TestCase(unchecked((short)45678), "Double", 45678.91)]
public sealed class Conv_i2
{
+ [TestCase((short)123, "SByte", (sbyte)123)]
+ [TestCase((short)-123, "SByte", (sbyte)-123)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern short SByte(sbyte value);
+ [TestCase((short)12345, "Int16", (short)12345)]
+ [TestCase((short)-12345, "Int16", (short)-12345)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern short Int16(short value);
+ [TestCase((short)12345, "Int32", 12345)]
+ [TestCase(unchecked((short)45678), "Int32", 45678)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern short Int32(int value);
+ [TestCase((short)12345, "Int64", 12345L)]
+ [TestCase(unchecked((short)45678), "Int64", 45678L)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern short Int64(long value);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern short IntPtr(IntPtr value);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern short IntPtrImpl(IntPtr value);
+
+ [TestCase((short)12345, "IntPtr", 12345)]
+ [TestCase(unchecked((short)45678), "IntPtr", 45678)]
+ public static short IntPtr(int value) =>
+ IntPtrImpl((IntPtr)value);
+ [TestCase((short)123, "Byte", (byte)123)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern short Byte(byte value);
+ [TestCase((short)12345, "UInt16", (ushort)12345)]
+ [TestCase(unchecked((short)0x8000), "UInt16", (ushort)0x8000)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern short UInt16(ushort value);
+ [TestCase(unchecked((short)456789012), "UInt32", (uint)456789012)]
+ [TestCase(unchecked((short)0x80000000), "UInt32", (uint)0x80000000)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern short UInt32(uint value);
+ [TestCase(unchecked((short)456789012), "UInt64", 456789012UL)]
+ [TestCase(unchecked((short)0x8000000000000000UL), "UInt64", 0x8000000000000000UL)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern short UInt64(ulong value);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern short UIntPtr(UIntPtr value);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern short UIntPtrImpl(UIntPtr value);
+
+ [TestCase(unchecked((short)456789012), "UIntPtr", (uint)456789012)]
+ public static short UIntPtr(uint value) =>
+ UIntPtrImpl((UIntPtr)value);
+ [TestCase((short)12345, "Single", 12345.67f)]
+ [TestCase(unchecked((short)45678), "Single", 45678.91f)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern short Single(float value);
+ [TestCase((short)12345, "Double", 12345.67)]
+ [TestCase(unchecked((short)45678), "Double", 45678.91)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern short Double(double value);
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Conv_i2/Conv_i2.il b/tests/IL2C.Core.Test.ILConverters/Conv_i2/Conv_i2.il
index 5fe0e4ba..98af15f9 100644
--- a/tests/IL2C.Core.Test.ILConverters/Conv_i2/Conv_i2.il
+++ b/tests/IL2C.Core.Test.ILConverters/Conv_i2/Conv_i2.il
@@ -32,7 +32,7 @@
ret
}
- .method public static int16 IntPtr(native int v) cil managed
+ .method private static int16 IntPtrImpl(native int v) cil managed
{
.maxstack 1
ldarg.0
@@ -72,7 +72,7 @@
ret
}
- .method public static int16 UIntPtr(native uint v) cil managed
+ .method private static int16 UIntPtrImpl(native uint v) cil managed
{
.maxstack 1
ldarg.0
diff --git a/tests/IL2C.Core.Test.ILConverters/Conv_i4/Conv_i4.cs b/tests/IL2C.Core.Test.ILConverters/Conv_i4/Conv_i4.cs
index e9ba333e..8a7e1815 100644
--- a/tests/IL2C.Core.Test.ILConverters/Conv_i4/Conv_i4.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Conv_i4/Conv_i4.cs
@@ -12,62 +12,68 @@
namespace IL2C.ILConverters
{
- [TestCase(123, "SByte", (sbyte)123)]
- [TestCase(-123, "SByte", (sbyte)-123)]
- [TestCase(12345, "Int16", (short)12345)]
- [TestCase(-12345, "Int16", (short)-12345)]
- [TestCase(456789012, "Int32", 456789012)]
- [TestCase(-456789012, "Int32", -456789012)]
- [TestCase(456789012, "Int64", 456789012L)]
- [TestCase(unchecked((int)4567890123L), "Int64", 4567890123L)]
- [TestCase(456789012, "IntPtr", 456789012)]
- //[TestCase(unchecked((int)4567890123L), "IntPtr", 4567890123L)] // Will cause overflow on 32bit test environment (IntPtr.Size == 4)
- [TestCase(123, "Byte", (byte)123)]
- [TestCase(12345, "UInt16", (ushort)12345)]
- [TestCase(456789012, "UInt32", (uint)456789012)]
- [TestCase(unchecked((int)0x80000000), "UInt32", (uint)0x80000000)]
- [TestCase(456789012, "UInt64", 456789012UL)]
- [TestCase(unchecked((int)0x8000000000000000UL), "UInt64", 0x8000000000000000UL)]
- [TestCase(456789012, "UIntPtr", (uint)456789012)]
- [TestCase(456789, "Single", 456789.012f)]
- [TestCase(unchecked((int)456789.012f), "Single", 456789.012f)]
- [TestCase(456789, "Double", 456789.012)]
- [TestCase(unchecked((int)456789.012), "Double", 456789.012)]
public sealed class Conv_i4
{
+ [TestCase(123, "SByte", (sbyte)123)]
+ [TestCase(-123, "SByte", (sbyte)-123)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int SByte(sbyte value);
+ [TestCase(12345, "Int16", (short)12345)]
+ [TestCase(-12345, "Int16", (short)-12345)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Int16(short value);
+ [TestCase(456789012, "Int32", 456789012)]
+ [TestCase(-456789012, "Int32", -456789012)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Int32(int value);
+ [TestCase(456789012, "Int64", 456789012L)]
+ [TestCase(unchecked((int)4567890123L), "Int64", 4567890123L)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Int64(long value);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern int IntPtr(IntPtr value);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern int IntPtrImpl(IntPtr value);
+
+ [TestCase(456789012, "IntPtr", 456789012)]
+ //[TestCase(unchecked((int)4567890123L), "IntPtr", 4567890123L)] // Will cause overflow on 32bit test environment (IntPtr.Size == 4)
+ public static int IntPtr(long value) =>
+ IntPtrImpl((IntPtr)value);
+ [TestCase(123, "Byte", (byte)123)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Byte(byte value);
+ [TestCase(12345, "UInt16", (ushort)12345)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int UInt16(ushort value);
+ [TestCase(456789012, "UInt32", (uint)456789012)]
+ [TestCase(unchecked((int)0x80000000), "UInt32", (uint)0x80000000)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int UInt32(uint value);
+ [TestCase(456789012, "UInt64", 456789012UL)]
+ [TestCase(unchecked((int)0x8000000000000000UL), "UInt64", 0x8000000000000000UL)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int UInt64(ulong value);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern int UIntPtr(UIntPtr value);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern int UIntPtrImpl(UIntPtr value);
+
+ [TestCase(456789012, "UIntPtr", (uint)456789012)]
+ public static int UIntPtr(uint value) =>
+ UIntPtrImpl((UIntPtr)value);
+ [TestCase(456789, "Single", 456789.012f)]
+ [TestCase(unchecked((int)456789.012f), "Single", 456789.012f)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Single(float value);
+ [TestCase(456789, "Double", 456789.012)]
+ [TestCase(unchecked((int)456789.012), "Double", 456789.012)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Double(double value);
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Conv_i4/Conv_i4.il b/tests/IL2C.Core.Test.ILConverters/Conv_i4/Conv_i4.il
index 454eb403..2c359a74 100644
--- a/tests/IL2C.Core.Test.ILConverters/Conv_i4/Conv_i4.il
+++ b/tests/IL2C.Core.Test.ILConverters/Conv_i4/Conv_i4.il
@@ -32,7 +32,7 @@
ret
}
- .method public static int32 IntPtr(native int v) cil managed
+ .method private static int32 IntPtrImpl(native int v) cil managed
{
.maxstack 1
ldarg.0
@@ -72,7 +72,7 @@
ret
}
- .method public static int32 UIntPtr(native uint v) cil managed
+ .method private static int32 UIntPtrImpl(native uint v) cil managed
{
.maxstack 1
ldarg.0
diff --git a/tests/IL2C.Core.Test.ILConverters/Conv_i8/Conv_i8.cs b/tests/IL2C.Core.Test.ILConverters/Conv_i8/Conv_i8.cs
index f6174598..a5f7a3ef 100644
--- a/tests/IL2C.Core.Test.ILConverters/Conv_i8/Conv_i8.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Conv_i8/Conv_i8.cs
@@ -12,62 +12,68 @@
namespace IL2C.ILConverters
{
- [TestCase(123L, "SByte", (sbyte)123)]
- [TestCase(-123L, "SByte", (sbyte)-123)]
- [TestCase(12345L, "Int16", (short)12345)]
- [TestCase(-12345L, "Int16", (short)-12345)]
- [TestCase(456789012L, "Int32", 456789012)]
- [TestCase(-456789012L, "Int32", -456789012)]
- [TestCase(45678901234L, "Int64", 45678901234L)]
- [TestCase(-45678901234L, "Int64", -45678901234L)]
- [TestCase(456789012L, "IntPtr", 456789012)]
- //[TestCase(unchecked((int)4567890123L), "IntPtr", 4567890123L)] // Will cause overflow on 32bit test environment (IntPtr.Size == 4)
- [TestCase(-456789012L, "IntPtr", -456789012)]
- [TestCase(123L, "Byte", (byte)123)]
- [TestCase(12345L, "UInt16", (ushort)12345)]
- [TestCase(456789012L, "UInt32", (uint)456789012)]
- [TestCase(45678901234L, "UInt64", 45678901234UL)]
- [TestCase(unchecked((long)0x8000000000000000UL), "UInt64", 0x8000000000000000UL)]
- [TestCase(456789012L, "UIntPtr", (uint)456789012)]
- [TestCase((long)45678900000.56f, "Single", 45678900000.56f)]
- [TestCase((long)-45678900000.56f, "Single", -45678900000.56f)]
- [TestCase(45678901234L, "Double", 45678901234.56)]
- [TestCase(-45678901234L, "Double", -45678901234.56)]
public sealed class Conv_i8
{
+ [TestCase(123L, "SByte", (sbyte)123)]
+ [TestCase(-123L, "SByte", (sbyte)-123)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern long SByte(sbyte value);
+ [TestCase(12345L, "Int16", (short)12345)]
+ [TestCase(-12345L, "Int16", (short)-12345)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern long Int16(short value);
+ [TestCase(456789012L, "Int32", 456789012)]
+ [TestCase(-456789012L, "Int32", -456789012)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern long Int32(int value);
+ [TestCase(45678901234L, "Int64", 45678901234L)]
+ [TestCase(-45678901234L, "Int64", -45678901234L)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern long Int64(long value);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern long IntPtr(IntPtr value);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern long IntPtrImpl(IntPtr value);
+
+ [TestCase(456789012L, "IntPtr", 456789012)]
+ //[TestCase(unchecked((int)4567890123L), "IntPtr", 4567890123L)] // Will cause overflow on 32bit test environment (IntPtr.Size == 4)
+ [TestCase(-456789012L, "IntPtr", -456789012)]
+ public static long IntPtr(long value) =>
+ IntPtrImpl((IntPtr)value);
+ [TestCase(123L, "Byte", (byte)123)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern long Byte(byte value);
+ [TestCase(12345L, "UInt16", (ushort)12345)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern long UInt16(ushort value);
+ [TestCase(456789012L, "UInt32", (uint)456789012)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern long UInt32(uint value);
+ [TestCase(45678901234L, "UInt64", 45678901234UL)]
+ [TestCase(unchecked((long)0x8000000000000000UL), "UInt64", 0x8000000000000000UL)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern long UInt64(ulong value);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern long UIntPtr(UIntPtr value);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern long UIntPtrImpl(UIntPtr value);
+
+ [TestCase(456789012L, "UIntPtr", (uint)456789012)]
+ public static long UIntPtr(uint value) =>
+ UIntPtrImpl((UIntPtr)value);
+ [TestCase((long)45678900000.56f, "Single", 45678900000.56f)]
+ [TestCase((long)-45678900000.56f, "Single", -45678900000.56f)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern long Single(float value);
+ [TestCase(45678901234L, "Double", 45678901234.56)]
+ [TestCase(-45678901234L, "Double", -45678901234.56)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern long Double(double value);
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Conv_i8/Conv_i8.il b/tests/IL2C.Core.Test.ILConverters/Conv_i8/Conv_i8.il
index ea76cef2..e447bde5 100644
--- a/tests/IL2C.Core.Test.ILConverters/Conv_i8/Conv_i8.il
+++ b/tests/IL2C.Core.Test.ILConverters/Conv_i8/Conv_i8.il
@@ -32,7 +32,7 @@
ret
}
- .method public static int64 IntPtr(native int v) cil managed
+ .method private static int64 IntPtrImpl(native int v) cil managed
{
.maxstack 1
ldarg.0
@@ -72,7 +72,7 @@
ret
}
- .method public static int64 UIntPtr(native uint v) cil managed
+ .method private static int64 UIntPtrImpl(native uint v) cil managed
{
.maxstack 1
ldarg.0
diff --git a/tests/IL2C.Core.Test.ILConverters/Conv_r4/Conv_r4.cs b/tests/IL2C.Core.Test.ILConverters/Conv_r4/Conv_r4.cs
index ced3024d..5fb72466 100644
--- a/tests/IL2C.Core.Test.ILConverters/Conv_r4/Conv_r4.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Conv_r4/Conv_r4.cs
@@ -12,61 +12,67 @@
namespace IL2C.ILConverters
{
- [TestCase(123f, "SByte", (sbyte)123)]
- [TestCase(-123f, "SByte", (sbyte)-123)]
- [TestCase(12345f, "Int16", (short)12345)]
- [TestCase(-12345f, "Int16", (short)-12345)]
- [TestCase((float)456789012, "Int32", 456789012)]
- [TestCase((float)-456789012, "Int32", -456789012)]
- [TestCase((float)45678901234L, "Int64", 45678901234L)]
- [TestCase((float)-45678901234L, "Int64", -45678901234L)]
- [TestCase((float)456789012, "IntPtr", 456789012)]
- //[TestCase(unchecked((float)4567890123L), "IntPtr", 4567890123L)] // Will cause overflow on 32bit test environment (IntPtr.Size == 4)
- [TestCase((float)-456789012, "IntPtr", -456789012)]
- [TestCase(123f, "Byte", (byte)123)]
- [TestCase(12345f, "UInt16", (ushort)12345)]
- [TestCase((float)456789012, "UInt32", (uint)456789012)]
- [TestCase((float)45678901234UL, "UInt64", 45678901234UL)]
- [TestCase((float)456789012, "UIntPtr", (uint)456789012)]
- [TestCase(456789.012f, "Single", 456789.012f)]
- [TestCase(-456789.012f, "Single", -456789.012f)]
- [TestCase(456789.012f, "Double", 456789.012)]
- [TestCase(-456789.012f, "Double", -456789.012)]
public sealed class Conv_r4
{
+ [TestCase(123f, "SByte", (sbyte)123)]
+ [TestCase(-123f, "SByte", (sbyte)-123)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern float SByte(sbyte value);
+ [TestCase(12345f, "Int16", (short)12345)]
+ [TestCase(-12345f, "Int16", (short)-12345)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern float Int16(short value);
+ [TestCase((float)456789012, "Int32", 456789012)]
+ [TestCase((float)-456789012, "Int32", -456789012)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern float Int32(int value);
+ [TestCase((float)45678901234L, "Int64", 45678901234L)]
+ [TestCase((float)-45678901234L, "Int64", -45678901234L)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern float Int64(long value);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern float IntPtr(IntPtr value);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern float IntPtrImpl(IntPtr value);
+
+ [TestCase((float)456789012, "IntPtr", 456789012)]
+ //[TestCase(unchecked((float)4567890123L), "IntPtr", 4567890123L)] // Will cause overflow on 32bit test environment (IntPtr.Size == 4)
+ [TestCase((float)-456789012, "IntPtr", -456789012)]
+ public static float IntPtr(long value) =>
+ IntPtrImpl((IntPtr)value);
+ [TestCase(123f, "Byte", (byte)123)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern float Byte(byte value);
+ [TestCase(12345f, "UInt16", (ushort)12345)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern float UInt16(ushort value);
+ [TestCase((float)456789012, "UInt32", (uint)456789012)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern float UInt32(uint value);
+ [TestCase((float)45678901234UL, "UInt64", 45678901234UL)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern float UInt64(ulong value);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern float UIntPtr(UIntPtr value);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern float UIntPtrImpl(UIntPtr value);
+
+ [TestCase((float)456789012, "UIntPtr", (uint)456789012)]
+ public static float UIntPtr(uint value) =>
+ UIntPtrImpl((UIntPtr)value);
+ [TestCase(456789.012f, "Single", 456789.012f)]
+ [TestCase(-456789.012f, "Single", -456789.012f)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern float Single(float value);
+ [TestCase(456789.012f, "Double", 456789.012)]
+ [TestCase(-456789.012f, "Double", -456789.012)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern float Double(double value);
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Conv_r4/Conv_r4.il b/tests/IL2C.Core.Test.ILConverters/Conv_r4/Conv_r4.il
index 6a9346f5..c9a79c37 100644
--- a/tests/IL2C.Core.Test.ILConverters/Conv_r4/Conv_r4.il
+++ b/tests/IL2C.Core.Test.ILConverters/Conv_r4/Conv_r4.il
@@ -32,7 +32,7 @@
ret
}
- .method public static float32 IntPtr(native int v) cil managed
+ .method private static float32 IntPtrImpl(native int v) cil managed
{
.maxstack 1
ldarg.0
@@ -72,7 +72,7 @@
ret
}
- .method public static float32 UIntPtr(native uint v) cil managed
+ .method private static float32 UIntPtrImpl(native uint v) cil managed
{
.maxstack 1
ldarg.0
diff --git a/tests/IL2C.Core.Test.ILConverters/Conv_r8/Conv_r8.cs b/tests/IL2C.Core.Test.ILConverters/Conv_r8/Conv_r8.cs
index 83e2981c..ff093e15 100644
--- a/tests/IL2C.Core.Test.ILConverters/Conv_r8/Conv_r8.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Conv_r8/Conv_r8.cs
@@ -12,61 +12,67 @@
namespace IL2C.ILConverters
{
- [TestCase(123.0, "SByte", (sbyte)123)]
- [TestCase(-123.0, "SByte", (sbyte)-123)]
- [TestCase(12345.0, "Int16", (short)12345)]
- [TestCase(-12345.0, "Int16", (short)-12345)]
- [TestCase(456789012.0, "Int32", 456789012)]
- [TestCase(-456789012.0, "Int32", -456789012)]
- [TestCase(45678901234.0, "Int64", 45678901234L)]
- [TestCase(-45678901234.0, "Int64", -45678901234L)]
- [TestCase(456789012.0, "IntPtr", 456789012)]
- //[TestCase(unchecked(4567890123.0), "IntPtr", 4567890123L)] // Will cause overflow on 32bit test environment (IntPtr.Size == 4)
- [TestCase(-456789012.0, "IntPtr", -456789012)]
- [TestCase(123.0, "Byte", (byte)123)]
- [TestCase(12345.0, "UInt16", (ushort)12345)]
- [TestCase(456789012.0, "UInt32", (uint)456789012)]
- [TestCase(45678901234.0, "UInt64", 45678901234UL)]
- [TestCase(456789012.0, "UIntPtr", (uint)456789012)]
- [TestCase((double)456789.012f, "Single", 456789.012f)]
- [TestCase((double)-456789.012f, "Single", -456789.012f)]
- [TestCase(456789.01234, "Double", 456789.01234)]
- [TestCase(-456789.01234, "Double", -456789.01234)]
public sealed class Conv_r8
{
+ [TestCase(123.0, "SByte", (sbyte)123)]
+ [TestCase(-123.0, "SByte", (sbyte)-123)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern double SByte(sbyte value);
+ [TestCase(12345.0, "Int16", (short)12345)]
+ [TestCase(-12345.0, "Int16", (short)-12345)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern double Int16(short value);
+ [TestCase(456789012.0, "Int32", 456789012)]
+ [TestCase(-456789012.0, "Int32", -456789012)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern double Int32(int value);
+ [TestCase(45678901234.0, "Int64", 45678901234L)]
+ [TestCase(-45678901234.0, "Int64", -45678901234L)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern double Int64(long value);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern double IntPtr(IntPtr value);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern double IntPtrImpl(IntPtr value);
+
+ [TestCase(456789012.0, "IntPtr", 456789012)]
+ //[TestCase(unchecked(4567890123.0), "IntPtr", 4567890123L)] // Will cause overflow on 32bit test environment (IntPtr.Size == 4)
+ [TestCase(-456789012.0, "IntPtr", -456789012)]
+ public static double IntPtr(long value) =>
+ IntPtrImpl((IntPtr)value);
+ [TestCase(123.0, "Byte", (byte)123)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern double Byte(byte value);
+ [TestCase(12345.0, "UInt16", (ushort)12345)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern double UInt16(ushort value);
+ [TestCase(456789012.0, "UInt32", (uint)456789012)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern double UInt32(uint value);
+ [TestCase(45678901234.0, "UInt64", 45678901234UL)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern double UInt64(ulong value);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern double UIntPtr(UIntPtr value);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern double UIntPtrImpl(UIntPtr value);
+
+ [TestCase(456789012.0, "UIntPtr", (uint)456789012)]
+ public static double UIntPtr(uint value) =>
+ UIntPtrImpl((UIntPtr)value);
+ [TestCase((double)456789.012f, "Single", 456789.012f)]
+ [TestCase((double)-456789.012f, "Single", -456789.012f)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern double Single(float value);
+ [TestCase(456789.01234, "Double", 456789.01234)]
+ [TestCase(-456789.01234, "Double", -456789.01234)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern double Double(double value);
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Conv_r8/Conv_r8.il b/tests/IL2C.Core.Test.ILConverters/Conv_r8/Conv_r8.il
index 5ead5043..0f2c4adb 100644
--- a/tests/IL2C.Core.Test.ILConverters/Conv_r8/Conv_r8.il
+++ b/tests/IL2C.Core.Test.ILConverters/Conv_r8/Conv_r8.il
@@ -32,7 +32,7 @@
ret
}
- .method public static float64 IntPtr(native int v) cil managed
+ .method private static float64 IntPtrImpl(native int v) cil managed
{
.maxstack 1
ldarg.0
@@ -72,7 +72,7 @@
ret
}
- .method public static float64 UIntPtr(native uint v) cil managed
+ .method private static float64 UIntPtrImpl(native uint v) cil managed
{
.maxstack 1
ldarg.0
diff --git a/tests/IL2C.Core.Test.ILConverters/Conv_u/Conv_u.cs b/tests/IL2C.Core.Test.ILConverters/Conv_u/Conv_u.cs
index a7ff850c..a5af0125 100644
--- a/tests/IL2C.Core.Test.ILConverters/Conv_u/Conv_u.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Conv_u/Conv_u.cs
@@ -12,54 +12,90 @@
namespace IL2C.ILConverters
{
- [TestCase((uint)123, "SByte", (sbyte)123)]
- [TestCase((uint)12345, "Int16", (short)12345)]
- [TestCase((uint)12345, "Int32", 12345)]
- [TestCase((uint)12345, "Int64", 12345L)]
- [TestCase((uint)12345, "IntPtr", 12345)]
- [TestCase((uint)123, "Byte", (byte)123)]
- [TestCase((uint)12345, "UInt16", (ushort)12345)]
- [TestCase((uint)12345, "UInt32", (uint)12345)]
- [TestCase((uint)12345, "UInt64", 12345UL)]
- [TestCase((uint)12345, "UIntPtr", (uint)12345)]
- [TestCase((uint)12345, "Single", 12345.67f)]
- [TestCase((uint)12345, "Double", 12345.67)]
public sealed class Conv_u
{
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern UIntPtr SByte(sbyte value);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern UIntPtr SByteImpl(sbyte value);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern UIntPtr Int16(short value);
+ [TestCase((uint)123, "SByte", (sbyte)123)]
+ public static uint SByte(sbyte value) =>
+ SByteImpl(value).ToUInt32();
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern UIntPtr Int32(int value);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern UIntPtr Int16Impl(short value);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern UIntPtr Int64(long value);
+ [TestCase((uint)12345, "Int16", (short)12345)]
+ public static uint Int16(short value) =>
+ Int16Impl(value).ToUInt32();
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern UIntPtr IntPtr(IntPtr value);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern UIntPtr Int32Impl(int value);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern UIntPtr Byte(byte value);
+ [TestCase((uint)12345, "Int32", 12345)]
+ public static uint Int32(int value) =>
+ Int32Impl(value).ToUInt32();
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern UIntPtr UInt16(ushort value);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern UIntPtr Int64Impl(long value);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern UIntPtr UInt32(uint value);
+ [TestCase((uint)12345, "Int64", 12345L)]
+ public static uint Int64(long value) =>
+ Int64Impl(value).ToUInt32();
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern UIntPtr UInt64(ulong value);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern UIntPtr IntPtrImpl(IntPtr value);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern UIntPtr UIntPtr(UIntPtr value);
+ [TestCase((uint)12345, "IntPtr", 12345)]
+ public static uint IntPtr(int value) =>
+ IntPtrImpl((IntPtr)value).ToUInt32();
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern UIntPtr Single(float value);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern UIntPtr ByteImpl(byte value);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern UIntPtr Double(double value);
+ [TestCase((uint)123, "Byte", (byte)123)]
+ public static uint Byte(byte value) =>
+ ByteImpl(value).ToUInt32();
+
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern UIntPtr UInt16Impl(ushort value);
+
+ [TestCase((uint)12345, "UInt16", (ushort)12345)]
+ public static uint UInt16(ushort value) =>
+ UInt16Impl(value).ToUInt32();
+
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern UIntPtr UInt32Impl(uint value);
+
+ [TestCase((uint)12345, "UInt32", (uint)12345)]
+ public static uint UInt32(uint value) =>
+ UInt32Impl(value).ToUInt32();
+
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern UIntPtr UInt64Impl(ulong value);
+
+ [TestCase((uint)12345, "UInt64", 12345UL)]
+ public static uint UInt64(ulong value) =>
+ UInt64Impl(value).ToUInt32();
+
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern UIntPtr UIntPtrImpl(UIntPtr value);
+
+ [TestCase((uint)12345, "UIntPtr", (uint)12345)]
+ public static uint UIntPtr(uint value) =>
+ UIntPtrImpl((UIntPtr)value).ToUInt32();
+
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern UIntPtr SingleImpl(float value);
+
+ [TestCase((uint)12345, "Single", 12345.67f)]
+ public static uint Single(float value) =>
+ SingleImpl(value).ToUInt32();
+
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ public static extern UIntPtr DoubleImpl(double value);
+
+ [TestCase((uint)12345, "Double", 12345.67)]
+ public static uint Double(double value) =>
+ DoubleImpl(value).ToUInt32();
}
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Conv_u/Conv_u.il b/tests/IL2C.Core.Test.ILConverters/Conv_u/Conv_u.il
index a37a4f4b..a8cec8d5 100644
--- a/tests/IL2C.Core.Test.ILConverters/Conv_u/Conv_u.il
+++ b/tests/IL2C.Core.Test.ILConverters/Conv_u/Conv_u.il
@@ -1,6 +1,6 @@
.class public IL2C.ILConverters.Conv_u
{
- .method public static native uint SByte(int8 v) cil managed
+ .method private static native uint SByteImpl(int8 v) cil managed
{
.maxstack 1
ldarg.0
@@ -8,7 +8,7 @@
ret
}
- .method public static native uint Int16(int16 v) cil managed
+ .method private static native uint Int16Impl(int16 v) cil managed
{
.maxstack 1
ldarg.0
@@ -16,7 +16,7 @@
ret
}
- .method public static native uint Int32(int32 v) cil managed
+ .method private static native uint Int32Impl(int32 v) cil managed
{
.maxstack 1
ldarg.0
@@ -24,7 +24,7 @@
ret
}
- .method public static native uint Int64(int64 v) cil managed
+ .method private static native uint Int64Impl(int64 v) cil managed
{
.maxstack 1
ldarg.0
@@ -32,7 +32,7 @@
ret
}
- .method public static native uint IntPtr(native int v) cil managed
+ .method private static native uint IntPtrImpl(native int v) cil managed
{
.maxstack 1
ldarg.0
@@ -40,7 +40,7 @@
ret
}
- .method public static native uint Byte(uint8 v) cil managed
+ .method private static native uint ByteImpl(uint8 v) cil managed
{
.maxstack 1
ldarg.0
@@ -48,7 +48,7 @@
ret
}
- .method public static native uint UInt16(uint16 v) cil managed
+ .method private static native uint UInt16Impl(uint16 v) cil managed
{
.maxstack 1
ldarg.0
@@ -56,7 +56,7 @@
ret
}
- .method public static native uint UInt32(uint32 v) cil managed
+ .method private static native uint UInt32Impl(uint32 v) cil managed
{
.maxstack 1
ldarg.0
@@ -64,7 +64,7 @@
ret
}
- .method public static native uint UInt64(uint64 v) cil managed
+ .method private static native uint UInt64Impl(uint64 v) cil managed
{
.maxstack 1
ldarg.0
@@ -72,7 +72,7 @@
ret
}
- .method public static native uint UIntPtr(native uint v) cil managed
+ .method private static native uint UIntPtrImpl(native uint v) cil managed
{
.maxstack 1
ldarg.0
@@ -80,7 +80,7 @@
ret
}
- .method public static native uint Single(float32 v) cil managed
+ .method private static native uint SingleImpl(float32 v) cil managed
{
.maxstack 1
ldarg.0
@@ -88,7 +88,7 @@
ret
}
- .method public static native uint Double(float64 v) cil managed
+ .method private static native uint DoubleImpl(float64 v) cil managed
{
.maxstack 1
ldarg.0
diff --git a/tests/IL2C.Core.Test.ILConverters/Conv_u1/Conv_u1.cs b/tests/IL2C.Core.Test.ILConverters/Conv_u1/Conv_u1.cs
index 49a21edd..5534a0e6 100644
--- a/tests/IL2C.Core.Test.ILConverters/Conv_u1/Conv_u1.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Conv_u1/Conv_u1.cs
@@ -12,63 +12,69 @@
namespace IL2C.ILConverters
{
- [TestCase((byte)123, "Byte", (byte)123)]
- [TestCase((byte)123, "Int16", (short)123)]
- [TestCase(unchecked((byte)456), "Int16", (short)456)]
- [TestCase(unchecked((byte)-456), "Int16", (short)-456)]
- [TestCase((byte)123, "Int32", 123)]
- [TestCase(unchecked((byte)456), "Int32", 456)]
- [TestCase(unchecked((byte)-456), "Int32", -456)]
- [TestCase((byte)123L, "Int64", 123L)]
- [TestCase(unchecked((byte)456L), "Int64", 456L)]
- [TestCase(unchecked((byte)-456L), "Int64", -456L)]
- [TestCase((byte)123, "IntPtr", 123)]
- [TestCase(unchecked((byte)456), "IntPtr", 456)]
- [TestCase((byte)123, "SByte", (sbyte)123)]
- [TestCase(unchecked((byte)-123), "SByte", (sbyte)-123)]
- [TestCase((byte)123, "UInt16", (ushort)123)]
- [TestCase((byte)123, "UInt32", (uint)123)]
- [TestCase((byte)123, "UInt64", (ulong)123)]
- [TestCase((byte)123, "UIntPtr", (uint)123)]
- [TestCase((byte)123, "Single", 123.45f)]
- [TestCase(unchecked((byte)456), "Single", 456.78f)]
- [TestCase((byte)123, "Double", 123.45)]
- [TestCase(unchecked((byte)456), "Double", 456.78)]
public sealed class Conv_u1
{
+ [TestCase((byte)123, "Byte", (byte)123)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern byte Byte(byte value);
+ [TestCase((byte)123, "Int16", (short)123)]
+ [TestCase(unchecked((byte)456), "Int16", (short)456)]
+ [TestCase(unchecked((byte)-456), "Int16", (short)-456)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern byte Int16(short value);
+ [TestCase((byte)123, "Int32", 123)]
+ [TestCase(unchecked((byte)456), "Int32", 456)]
+ [TestCase(unchecked((byte)-456), "Int32", -456)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern byte Int32(int value);
+ [TestCase((byte)123L, "Int64", 123L)]
+ [TestCase(unchecked((byte)456L), "Int64", 456L)]
+ [TestCase(unchecked((byte)-456L), "Int64", -456L)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern byte Int64(long value);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern byte IntPtr(IntPtr value);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern byte IntPtrImpl(IntPtr value);
+
+ [TestCase((byte)123, "IntPtr", 123)]
+ [TestCase(unchecked((byte)456), "IntPtr", 456)]
+ public static byte IntPtr(int value) =>
+ IntPtrImpl((IntPtr)value);
+ [TestCase((byte)123, "SByte", (sbyte)123)]
+ [TestCase(unchecked((byte)-123), "SByte", (sbyte)-123)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern byte SByte(sbyte value);
+ [TestCase((byte)123, "UInt16", (ushort)123)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern byte UInt16(ushort value);
+ [TestCase((byte)123, "UInt32", (uint)123)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern byte UInt32(uint value);
+ [TestCase((byte)123, "UInt64", (ulong)123)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern byte UInt64(ulong value);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern byte UIntPtr(UIntPtr value);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern byte UIntPtrImpl(UIntPtr value);
+
+ [TestCase((byte)123, "UIntPtr", (uint)123)]
+ public static byte UIntPtr(uint value) =>
+ UIntPtrImpl((UIntPtr)value);
+ [TestCase((byte)123, "Single", 123.45f)]
+ [TestCase(unchecked((byte)456), "Single", 456.78f)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern byte Single(float value);
+ [TestCase((byte)123, "Double", 123.45)]
+ [TestCase(unchecked((byte)456), "Double", 456.78)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern byte Double(double value);
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Conv_u1/Conv_u1.il b/tests/IL2C.Core.Test.ILConverters/Conv_u1/Conv_u1.il
index d278b811..3f8ad0f6 100644
--- a/tests/IL2C.Core.Test.ILConverters/Conv_u1/Conv_u1.il
+++ b/tests/IL2C.Core.Test.ILConverters/Conv_u1/Conv_u1.il
@@ -32,7 +32,7 @@
ret
}
- .method public static uint8 IntPtr(native int v) cil managed
+ .method private static uint8 IntPtrImpl(native int v) cil managed
{
.maxstack 1
ldarg.0
@@ -72,7 +72,7 @@
ret
}
- .method public static uint8 UIntPtr(native uint v) cil managed
+ .method private static uint8 UIntPtrImpl(native uint v) cil managed
{
.maxstack 1
ldarg.0
diff --git a/tests/IL2C.Core.Test.ILConverters/Conv_u2/Conv_u2.cs b/tests/IL2C.Core.Test.ILConverters/Conv_u2/Conv_u2.cs
index 0543372c..e7de2355 100644
--- a/tests/IL2C.Core.Test.ILConverters/Conv_u2/Conv_u2.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Conv_u2/Conv_u2.cs
@@ -12,62 +12,68 @@
namespace IL2C.ILConverters
{
- [TestCase((ushort)123, "Byte", (byte)123)]
- [TestCase((ushort)12345, "Int16", (short)12345)]
- [TestCase(unchecked((ushort)-12345), "Int16", (short)-12345)]
- [TestCase((ushort)12345, "Int32", 12345)]
- [TestCase(unchecked((ushort)45678), "Int32", 45678)]
- [TestCase(unchecked((ushort)-45678), "Int32", -45678)]
- [TestCase((ushort)12345L, "Int64", 12345L)]
- [TestCase(unchecked((ushort)45678L), "Int64", 45678L)]
- [TestCase(unchecked((ushort)-45678L), "Int64", -45678L)]
- [TestCase((ushort)12345, "IntPtr", 12345)]
- [TestCase(unchecked((ushort)45678), "IntPtr", 45678)]
- [TestCase((ushort)123, "SByte", (sbyte)123)]
- [TestCase(unchecked((ushort)-123), "SByte", (sbyte)-123)]
- [TestCase((ushort)12345, "UInt16", (ushort)12345)]
- [TestCase((ushort)12345, "UInt32", (uint)12345)]
- [TestCase((ushort)12345, "UInt64", (ulong)12345)]
- [TestCase((ushort)12345, "UIntPtr", (uint)12345)]
- [TestCase((ushort)12345, "Single", 12345.67f)]
- [TestCase(unchecked((ushort)45678), "Single", 45678.91f)]
- [TestCase((ushort)12345, "Double", 12345.67)]
- [TestCase(unchecked((ushort)45678), "Double", 45678.91)]
public sealed class Conv_u2
{
+ [TestCase((ushort)123, "Byte", (byte)123)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ushort Byte(byte value);
+ [TestCase((ushort)12345, "Int16", (short)12345)]
+ [TestCase(unchecked((ushort)-12345), "Int16", (short)-12345)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ushort Int16(short value);
+ [TestCase((ushort)12345, "Int32", 12345)]
+ [TestCase(unchecked((ushort)45678), "Int32", 45678)]
+ [TestCase(unchecked((ushort)-45678), "Int32", -45678)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ushort Int32(int value);
+ [TestCase((ushort)12345L, "Int64", 12345L)]
+ [TestCase(unchecked((ushort)45678L), "Int64", 45678L)]
+ [TestCase(unchecked((ushort)-45678L), "Int64", -45678L)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ushort Int64(long value);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern ushort IntPtr(IntPtr value);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern ushort IntPtrImpl(IntPtr value);
+
+ [TestCase((ushort)12345, "IntPtr", 12345)]
+ [TestCase(unchecked((ushort)45678), "IntPtr", 45678)]
+ public static ushort IntPtr(int value) =>
+ IntPtrImpl((IntPtr)value);
+ [TestCase((ushort)123, "SByte", (sbyte)123)]
+ [TestCase(unchecked((ushort)-123), "SByte", (sbyte)-123)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ushort SByte(sbyte value);
+ [TestCase((ushort)12345, "UInt16", (ushort)12345)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ushort UInt16(ushort value);
+ [TestCase((ushort)12345, "UInt32", (uint)12345)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ushort UInt32(uint value);
+ [TestCase((ushort)12345, "UInt64", (ulong)12345)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ushort UInt64(ulong value);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern ushort UIntPtr(UIntPtr value);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern ushort UIntPtrImpl(UIntPtr value);
+
+ [TestCase((ushort)12345, "UIntPtr", (uint)12345)]
+ public static ushort UIntPtr(uint value) =>
+ UIntPtrImpl((UIntPtr)value);
+ [TestCase((ushort)12345, "Single", 12345.67f)]
+ [TestCase(unchecked((ushort)45678), "Single", 45678.91f)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ushort Single(float value);
+ [TestCase((ushort)12345, "Double", 12345.67)]
+ [TestCase(unchecked((ushort)45678), "Double", 45678.91)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ushort Double(double value);
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Conv_u2/Conv_u2.il b/tests/IL2C.Core.Test.ILConverters/Conv_u2/Conv_u2.il
index f5f910f3..3d8106d4 100644
--- a/tests/IL2C.Core.Test.ILConverters/Conv_u2/Conv_u2.il
+++ b/tests/IL2C.Core.Test.ILConverters/Conv_u2/Conv_u2.il
@@ -32,7 +32,7 @@
ret
}
- .method public static uint16 IntPtr(native int v) cil managed
+ .method private static uint16 IntPtrImpl(native int v) cil managed
{
.maxstack 1
ldarg.0
@@ -72,7 +72,7 @@
ret
}
- .method public static uint16 UIntPtr(native uint v) cil managed
+ .method private static uint16 UIntPtrImpl(native uint v) cil managed
{
.maxstack 1
ldarg.0
diff --git a/tests/IL2C.Core.Test.ILConverters/Conv_u4/Conv_u4.cs b/tests/IL2C.Core.Test.ILConverters/Conv_u4/Conv_u4.cs
index cece4147..f6383702 100644
--- a/tests/IL2C.Core.Test.ILConverters/Conv_u4/Conv_u4.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Conv_u4/Conv_u4.cs
@@ -12,60 +12,66 @@
namespace IL2C.ILConverters
{
- [TestCase((uint)123, "Byte", (byte)123)]
- [TestCase((uint)12345, "Int16", (short)12345)]
- [TestCase(unchecked((uint)-12345), "Int16", (short)-12345)]
- [TestCase((uint)12345, "Int32", 12345)]
- [TestCase(unchecked ((uint)-45678), "Int32", -45678)]
- [TestCase((uint)12345, "Int64", 12345L)]
- [TestCase(unchecked((uint)-45678L), "Int64", -45678L)]
- [TestCase((uint)12345, "IntPtr", 12345)]
- [TestCase(unchecked((uint)-45678), "IntPtr", -45678)]
- [TestCase((uint)123, "SByte", (sbyte)123)]
- [TestCase(unchecked((uint)-123), "SByte", (sbyte)-123)]
- [TestCase((uint)12345, "UInt16", (ushort)12345)]
- [TestCase((uint)12345, "UInt32", (uint)12345)]
- [TestCase((uint)12345, "UInt64", (ulong)12345)]
- [TestCase((uint)12345, "UIntPtr", (uint)12345)]
- [TestCase((uint)12345.67f, "Single", 12345.67f)]
- [TestCase(unchecked((uint)(int)-45678.91f), "Single", -45678.91f)]
- [TestCase((uint)12345.6789, "Double", 12345.6789)]
- [TestCase(unchecked((uint)45678.90123), "Double", 45678.90123)]
public sealed class Conv_u4
{
+ [TestCase((uint)123, "Byte", (byte)123)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern uint Byte(byte value);
+ [TestCase((uint)12345, "Int16", (short)12345)]
+ [TestCase(unchecked((uint)-12345), "Int16", (short)-12345)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern uint Int16(short value);
+ [TestCase((uint)12345, "Int32", 12345)]
+ [TestCase(unchecked((uint)-45678), "Int32", -45678)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern uint Int32(int value);
+ [TestCase((uint)12345, "Int64", 12345L)]
+ [TestCase(unchecked((uint)-45678L), "Int64", -45678L)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern uint Int64(long value);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern uint IntPtr(IntPtr value);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern uint IntPtrImpl(IntPtr value);
+
+ [TestCase((uint)12345, "IntPtr", 12345)]
+ [TestCase(unchecked((uint)-45678), "IntPtr", -45678)]
+ public static uint IntPtr(int value) =>
+ IntPtrImpl((IntPtr)value);
+ [TestCase((uint)123, "SByte", (sbyte)123)]
+ [TestCase(unchecked((uint)-123), "SByte", (sbyte)-123)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern uint SByte(sbyte value);
+ [TestCase((uint)12345, "UInt16", (ushort)12345)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern uint UInt16(ushort value);
+ [TestCase((uint)12345, "UInt32", (uint)12345)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern uint UInt32(uint value);
+ [TestCase((uint)12345, "UInt64", (ulong)12345)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern uint UInt64(ulong value);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern uint UIntPtr(UIntPtr value);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern uint UIntPtrImpl(UIntPtr value);
+
+ [TestCase((uint)12345, "UIntPtr", (uint)12345)]
+ public static uint UIntPtr(uint value) =>
+ UIntPtrImpl((UIntPtr)value);
+ [TestCase((uint)12345.67f, "Single", 12345.67f)]
+ [TestCase(unchecked((uint)(int)-45678.91f), "Single", -45678.91f)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern uint Single(float value);
+ [TestCase((uint)12345.6789, "Double", 12345.6789)]
+ [TestCase(unchecked((uint)45678.90123), "Double", 45678.90123)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern uint Double(double value);
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Conv_u4/Conv_u4.il b/tests/IL2C.Core.Test.ILConverters/Conv_u4/Conv_u4.il
index 1a7265d1..7ba1c417 100644
--- a/tests/IL2C.Core.Test.ILConverters/Conv_u4/Conv_u4.il
+++ b/tests/IL2C.Core.Test.ILConverters/Conv_u4/Conv_u4.il
@@ -32,7 +32,7 @@
ret
}
- .method public static uint32 IntPtr(native int v) cil managed
+ .method private static uint32 IntPtrImpl(native int v) cil managed
{
.maxstack 1
ldarg.0
@@ -72,7 +72,7 @@
ret
}
- .method public static uint32 UIntPtr(native uint v) cil managed
+ .method private static uint32 UIntPtrImpl(native uint v) cil managed
{
.maxstack 1
ldarg.0
diff --git a/tests/IL2C.Core.Test.ILConverters/Conv_u8/Conv_u8.cs b/tests/IL2C.Core.Test.ILConverters/Conv_u8/Conv_u8.cs
index 010d3a88..623edc64 100644
--- a/tests/IL2C.Core.Test.ILConverters/Conv_u8/Conv_u8.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Conv_u8/Conv_u8.cs
@@ -12,60 +12,66 @@
namespace IL2C.ILConverters
{
- [TestCase((ulong)123, "Byte", (byte)123)]
- [TestCase((ulong)12345, "Int16", (short)12345)]
- [TestCase(unchecked((ulong)(uint)-12345), "Int16", (short)-12345)]
- [TestCase((ulong)12345, "Int32", 12345)]
- [TestCase(unchecked((ulong)(uint)-45678), "Int32", -45678)]
- [TestCase((ulong)12345, "Int64", 12345L)]
- [TestCase(unchecked((ulong)-45678L), "Int64", -45678L)]
- [TestCase((ulong)12345, "IntPtr", 12345)]
- //[TestCase(unchecked((ulong)(uint)-45678), "IntPtr", -45678)] // Different result on both 32/64bit test environment
- [TestCase((ulong)123, "SByte", (sbyte)123)]
- [TestCase(unchecked((ulong)(uint)-123), "SByte", (sbyte)-123)]
- [TestCase((ulong)12345, "UInt16", (ushort)12345)]
- [TestCase((ulong)12345, "UInt32", (uint)12345)]
- [TestCase((ulong)12345, "UInt64", 12345UL)]
- [TestCase((ulong)12345, "UIntPtr", (uint)12345)]
- [TestCase((ulong)12345.67f, "Single", 12345.67f)]
- [TestCase(unchecked((ulong)(long)-45678.91f), "Single", -45678.91f)]
- [TestCase((ulong)12345.6789, "Double", 12345.6789)]
- [TestCase(unchecked((ulong)45678.90123), "Double", 45678.90123)]
public sealed class Conv_u8
{
+ [TestCase((ulong)123, "Byte", (byte)123)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ulong Byte(byte value);
+ [TestCase((ulong)12345, "Int16", (short)12345)]
+ [TestCase(unchecked((ulong)(uint)-12345), "Int16", (short)-12345)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ulong Int16(short value);
+ [TestCase((ulong)12345, "Int32", 12345)]
+ [TestCase(unchecked((ulong)(uint)-45678), "Int32", -45678)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ulong Int32(int value);
+ [TestCase((ulong)12345, "Int64", 12345L)]
+ [TestCase(unchecked((ulong)-45678L), "Int64", -45678L)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ulong Int64(long value);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern ulong IntPtr(IntPtr value);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern ulong IntPtrImpl(IntPtr value);
+
+ [TestCase((ulong)12345, "IntPtr", 12345)]
+ //[TestCase(unchecked((ulong)(uint)-45678), "IntPtr", -45678)] // Different result on both 32/64bit test environment
+ public static ulong IntPtr(int value) =>
+ IntPtrImpl((IntPtr)value);
+ [TestCase((ulong)123, "SByte", (sbyte)123)]
+ [TestCase(unchecked((ulong)(uint)-123), "SByte", (sbyte)-123)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ulong SByte(sbyte value);
+ [TestCase((ulong)12345, "UInt16", (ushort)12345)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ulong UInt16(ushort value);
+ [TestCase((ulong)12345, "UInt32", (uint)12345)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ulong UInt32(uint value);
+ [TestCase((ulong)12345, "UInt64", 12345UL)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ulong UInt64(ulong value);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern ulong UIntPtr(UIntPtr value);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern ulong UIntPtrImpl(UIntPtr value);
+
+ [TestCase((ulong)12345, "UIntPtr", (uint)12345)]
+ public static ulong UIntPtr(uint value) =>
+ UIntPtrImpl((UIntPtr)value);
+ [TestCase((ulong)12345.67f, "Single", 12345.67f)]
+ [TestCase(unchecked((ulong)(long)-45678.91f), "Single", -45678.91f)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ulong Single(float value);
+ [TestCase((ulong)12345.6789, "Double", 12345.6789)]
+ [TestCase(unchecked((ulong)45678.90123), "Double", 45678.90123)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ulong Double(double value);
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Conv_u8/Conv_u8.il b/tests/IL2C.Core.Test.ILConverters/Conv_u8/Conv_u8.il
index 8f0a1bd0..6feeb196 100644
--- a/tests/IL2C.Core.Test.ILConverters/Conv_u8/Conv_u8.il
+++ b/tests/IL2C.Core.Test.ILConverters/Conv_u8/Conv_u8.il
@@ -32,7 +32,7 @@
ret
}
- .method public static uint64 IntPtr(native int v) cil managed
+ .method private static uint64 IntPtrImpl(native int v) cil managed
{
.maxstack 1
ldarg.0
@@ -72,7 +72,7 @@
ret
}
- .method public static uint64 UIntPtr(native uint v) cil managed
+ .method private static uint64 UIntPtrImpl(native uint v) cil managed
{
.maxstack 1
ldarg.0
diff --git a/tests/IL2C.Core.Test.ILConverters/Div/Div.cs b/tests/IL2C.Core.Test.ILConverters/Div/Div.cs
index 10e823f0..3631c9fa 100644
--- a/tests/IL2C.Core.Test.ILConverters/Div/Div.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Div/Div.cs
@@ -12,41 +12,50 @@
namespace IL2C.ILConverters
{
- [TestCase(12, "Int32_Int32", 288, 24)]
- [TestCase(12, "Int32_IntPtr", 288, 24)]
- [TestCase(12L, "Int64_Int64", 288L, 24L)]
- [TestCase(12, "IntPtr_Int32", 288, 24)]
- [TestCase(12, "IntPtr_IntPtr", 288, 24)]
- [TestCase(123.0f / 0.45f, "Single_Single", 123.0f, 0.45f)]
- [TestCase(123.0f / 0.45, "Single_Double", 123.0f, 0.45)]
- [TestCase(123.0 / 0.45f, "Double_Single", 123.0, 0.45f)]
- [TestCase(123.0 / 0.45, "Double_Double", 123.0, 0.45)]
public sealed class Div
{
+ [TestCase(12, "Int32_Int32", 288, 24)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Int32_Int32(int lhs, int rhs);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr Int32_IntPtr(int lhs, IntPtr rhs);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr Int32_IntPtrImpl(int lhs, IntPtr rhs);
+
+ [TestCase(12, "Int32_IntPtr", 288, 24)]
+ public static int Int32_IntPtr(int lhs, int rhs) =>
+ Int32_IntPtrImpl(lhs, (IntPtr)rhs).ToInt32();
+ [TestCase(12L, "Int64_Int64", 288L, 24L)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern long Int64_Int64(long lhs, long rhs);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr IntPtr_Int32(IntPtr lhs, int rhs);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr IntPtr_Int32Impl(IntPtr lhs, int rhs);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr IntPtr_IntPtr(IntPtr lhs, IntPtr rhs);
+ [TestCase(12, "IntPtr_Int32", 288, 24)]
+ public static int IntPtr_Int32(int lhs, int rhs) =>
+ IntPtr_Int32Impl((IntPtr)lhs, rhs).ToInt32();
+
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr IntPtr_IntPtrImpl(IntPtr lhs, IntPtr rhs);
+
+ [TestCase(12, "IntPtr_IntPtr", 288, 24)]
+ public static int IntPtr_IntPtr(int lhs, int rhs) =>
+ IntPtr_IntPtrImpl((IntPtr)lhs, (IntPtr)rhs).ToInt32();
+ [TestCase(123.0f / 0.45f, "Single_Single", 123.0f, 0.45f)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern float Single_Single(float lhs, float rhs);
+ [TestCase(123.0f / 0.45, "Div_Single_Double", 123.0f, 0.45)]
[MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern double Single_Double(float lhs, double rhs);
+ public static extern double Div_Single_Double(float lhs, double rhs);
+ [TestCase(123.0 / 0.45f, "Div_Double_Single", 123.0, 0.45f)]
[MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern double Double_Single(double lhs, float rhs);
+ public static extern double Div_Double_Single(double lhs, float rhs);
+ [TestCase(123.0 / 0.45, "Double_Double", 123.0, 0.45)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern double Double_Double(double lhs, double rhs);
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Div/Div.il b/tests/IL2C.Core.Test.ILConverters/Div/Div.il
index b08d49c3..511c9cf5 100644
--- a/tests/IL2C.Core.Test.ILConverters/Div/Div.il
+++ b/tests/IL2C.Core.Test.ILConverters/Div/Div.il
@@ -1,83 +1,83 @@
.class public IL2C.ILConverters.Div
{
- .method public static int32 Int32_Int32(int32 lhs, int32 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- div
- ret
- }
+ .method public static int32 Int32_Int32(int32 lhs, int32 rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ div
+ ret
+ }
- .method public static native int Int32_IntPtr(int32 lhs, native int rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- div
- ret
- }
+ .method private static native int Int32_IntPtrImpl(int32 lhs, native int rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ div
+ ret
+ }
.method public static int64 Int64_Int64(int64 lhs, int64 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- div
- ret
- }
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ div
+ ret
+ }
- .method public static native int IntPtr_Int32(native int lhs, int32 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- div
- ret
- }
+ .method private static native int IntPtr_Int32Impl(native int lhs, int32 rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ div
+ ret
+ }
- .method public static native int IntPtr_IntPtr(native int lhs, native int rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- div
- ret
- }
+ .method private static native int IntPtr_IntPtrImpl(native int lhs, native int rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ div
+ ret
+ }
- .method public static float32 Single_Single(float32 lhs, float32 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- div
- ret
- }
+ .method public static float32 Single_Single(float32 lhs, float32 rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ div
+ ret
+ }
- .method public static float64 Single_Double(float32 lhs, float64 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- div
- ret
- }
+ .method public static float64 Div_Single_Double(float32 lhs, float64 rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ div
+ ret
+ }
- .method public static float64 Double_Single(float64 lhs, float32 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- div
- ret
- }
+ .method public static float64 Div_Double_Single(float64 lhs, float32 rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ div
+ ret
+ }
- .method public static float64 Double_Double(float64 lhs, float64 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- div
- ret
- }
+ .method public static float64 Double_Double(float64 lhs, float64 rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ div
+ ret
+ }
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Dup/Dup.cs b/tests/IL2C.Core.Test.ILConverters/Dup/Dup.cs
index ee592de9..a10b7189 100644
--- a/tests/IL2C.Core.Test.ILConverters/Dup/Dup.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Dup/Dup.cs
@@ -12,13 +12,13 @@
namespace IL2C.ILConverters
{
- [TestCase(246, "Mul2Int32", 123)]
- [TestCase("ABCABC", "Mul2String", "ABC")]
public sealed class Dup
{
+ [TestCase(246, "Mul2Int32", 123)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Mul2Int32(int value);
+ [TestCase("ABCABC", "Mul2String", "ABC")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Mul2String(string value);
}
diff --git a/tests/IL2C.Core.Test.ILConverters/IL2C.Core.Test.ILConverters.csproj b/tests/IL2C.Core.Test.ILConverters/IL2C.Core.Test.ILConverters.csproj
index c1a3b912..93908afa 100644
--- a/tests/IL2C.Core.Test.ILConverters/IL2C.Core.Test.ILConverters.csproj
+++ b/tests/IL2C.Core.Test.ILConverters/IL2C.Core.Test.ILConverters.csproj
@@ -1,28 +1,58 @@
+
+
+
+
+
+
- net48;netstandard2.0
+ net48;net6.0
+
+ net47;net6.0
+
Library
+ False
enable
+ true
+ $(DefineConstants);$(OS)
IL2C.Core.Test.ILConverters
IL2C.ILConverters
+
+ CommentOnly
+ true
+ Debug
+ false
+
+
+
+
-
+
-
+
-
-
+
+
+
+
+
+
+ $([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)\..\..\src\IL2C.Build\bin\$(Configuration)\$(_IL2C_PlatformName)'))
+
diff --git a/tests/IL2C.Core.Test.ILConverters/Isinst/Isinst.cs b/tests/IL2C.Core.Test.ILConverters/Isinst/Isinst.cs
index 89890501..f397cd98 100644
--- a/tests/IL2C.Core.Test.ILConverters/Isinst/Isinst.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Isinst/Isinst.cs
@@ -12,15 +12,15 @@
namespace IL2C.ILConverters
{
- [TestCase("ABCDEF", "ConcatIfString", "ABC")]
- [TestCase(null, "ConcatIfString", 123)]
- [TestCase(null, "ToStringIfInt32", "ABC")]
- [TestCase("123", "ToStringIfInt32", 123)]
public sealed class Isinst
{
+ [TestCase("ABCDEF", "ConcatIfString", "ABC")]
+ [TestCase(null, "ConcatIfString", 123, Assert = TestCaseAsserts.PerfectMatch)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string ConcatIfString(object value);
+ [TestCase(null, "ToStringIfInt32", "ABC", Assert = TestCaseAsserts.PerfectMatch)]
+ [TestCase("123", "ToStringIfInt32", 123)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string ToStringIfInt32(object value);
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Isinst/Isinst.il b/tests/IL2C.Core.Test.ILConverters/Isinst/Isinst.il
index 5d26301b..43d9f45b 100644
--- a/tests/IL2C.Core.Test.ILConverters/Isinst/Isinst.il
+++ b/tests/IL2C.Core.Test.ILConverters/Isinst/Isinst.il
@@ -6,7 +6,7 @@
ldarg.0
isinst string
dup
- brnull.s N1
+ brfalse.s N1
ldstr "DEF"
call string string::Concat(string, string)
N1:
@@ -19,7 +19,7 @@
ldarg.0
isinst int32
dup
- brnull.s N1
+ brfalse.s N1
callvirt instance string object::ToString()
N1:
ret
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldarg/Ldarg.cs b/tests/IL2C.Core.Test.ILConverters/Ldarg/Ldarg.cs
index 53b24c77..2058c478 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldarg/Ldarg.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Ldarg/Ldarg.cs
@@ -12,102 +12,110 @@
namespace IL2C.ILConverters
{
- [TestCase(true, "Boolean_4", 0, 1, 2, 3, false)]
- [TestCase(false, "Boolean_4", 0, 1, 2, 3, true)]
- [TestCase((byte)(byte.MaxValue - 1), "Byte_4", 0, 1, 2, 3, byte.MaxValue)]
- [TestCase((short)(short.MaxValue - 1), "Int16_4", 0, 1, 2, 3, short.MaxValue)]
- [TestCase(int.MaxValue - 1, "Int32_4", 0, 1, 2, 3, int.MaxValue)]
- [TestCase(long.MaxValue - 1, "Int64_4", 0, 1, 2, 3, long.MaxValue)]
- [TestCase((sbyte)(sbyte.MaxValue - 1), "SByte_4", 0, 1, 2, 3, sbyte.MaxValue)]
- [TestCase((ushort)(ushort.MaxValue - 1), "UInt16_4", 0, 1, 2, 3, ushort.MaxValue)]
- [TestCase(uint.MaxValue - 1, "UInt32_4", 0, 1, 2, 3, uint.MaxValue)]
- [TestCase(ulong.MaxValue - 1, "UInt64_4", 0, 1, 2, 3, ulong.MaxValue)]
- [TestCase(int.MaxValue - 1, "IntPtr_4", 0, 1, 2, 3, int.MaxValue)]
- [TestCase(uint.MaxValue - 1, "UIntPtr_4", 0, 1, 2, 3, uint.MaxValue)]
- [TestCase((float)((double)123.45f + (double)3.14159274f), "Single_4", 0, 1, 2, 3, 123.45f)]
- [TestCase(123.45 + 3.1415926535897931, "Double_4", 0, 1, 2, 3, 123.45)]
- [TestCase("ABCD", "String_4", 0, 1, 2, 3, "ABC")]
- [TestCase('B', "Char_4", 0, 1, 2, 3, 'A')]
- [TestCase("ABCD", "Argument_256",
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- "ABC")]
public sealed class Ldarg
{
+ [TestCase(true, "Boolean_4", 0, 1, 2, 3, false)]
+ [TestCase(false, "Boolean_4", 0, 1, 2, 3, true)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool Boolean_4(
int arg0, int arg1, int arg2, int arg3, bool value);
+ [TestCase((byte)(byte.MaxValue - 1), "Byte_4", 0, 1, 2, 3, byte.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern byte Byte_4(
int arg0, int arg1, int arg2, int arg3, byte num);
+ [TestCase((short)(short.MaxValue - 1), "Int16_4", 0, 1, 2, 3, short.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern short Int16_4(
int arg0, int arg1, int arg2, int arg3, short num);
+ [TestCase(int.MaxValue - 1, "Int32_4", 0, 1, 2, 3, int.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Int32_4(
int arg0, int arg1, int arg2, int arg3, int num);
+ [TestCase(long.MaxValue - 1, "Int64_4", 0, 1, 2, 3, long.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern long Int64_4(
int arg0, int arg1, int arg2, int arg3, long num);
+ [TestCase((sbyte)(sbyte.MaxValue - 1), "SByte_4", 0, 1, 2, 3, sbyte.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern sbyte SByte_4(
int arg0, int arg1, int arg2, int arg3, sbyte num);
+ [TestCase((ushort)(ushort.MaxValue - 1), "UInt16_4", 0, 1, 2, 3, ushort.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ushort UInt16_4(
int arg0, int arg1, int arg2, int arg3, ushort num);
+ [TestCase(uint.MaxValue - 1, "UInt32_4", 0, 1, 2, 3, uint.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern uint UInt32_4(
int arg0, int arg1, int arg2, int arg3, uint num);
+ [TestCase(ulong.MaxValue - 1, "UInt64_4", 0, 1, 2, 3, ulong.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ulong UInt64_4(
int arg0, int arg1, int arg2, int arg3, ulong num);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr IntPtr_4(
- int arg0, int arg1, int arg2, int arg3, IntPtr num);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr IntPtr_4Impl(
+ int arg0, int arg1, int arg2, int arg3, IntPtr num);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern UIntPtr UIntPtr_4(
- int arg0, int arg1, int arg2, int arg3, UIntPtr num);
+ [TestCase(int.MaxValue - 1, "IntPtr_4", 0, 1, 2, 3, int.MaxValue)]
+ public static int IntPtr_4(
+ int arg0, int arg1, int arg2, int arg3, int num) =>
+ IntPtr_4Impl(arg0, arg1, arg2, arg3, (IntPtr)num).ToInt32();
+
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern UIntPtr UIntPtr_4Impl(
+ int arg0, int arg1, int arg2, int arg3, UIntPtr num);
+
+ [TestCase(uint.MaxValue - 1, "UIntPtr_4", 0, 1, 2, 3, uint.MaxValue)]
+ public static uint UIntPtr_4(
+ int arg0, int arg1, int arg2, int arg3, uint num) =>
+ UIntPtr_4Impl(arg0, arg1, arg2, arg3, (UIntPtr)num).ToUInt32();
+ [TestCase((float)((double)123.45f + (double)3.14159274f), "Single_4", 0, 1, 2, 3, 123.45f)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern float Single_4(
int arg0, int arg1, int arg2, int arg3, float num);
+ [TestCase(123.45 + 3.1415926535897931, "Double_4", 0, 1, 2, 3, 123.45)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern double Double_4(
int arg0, int arg1, int arg2, int arg3, double num);
+ [TestCase('B', "Char_4", 0, 1, 2, 3, 'A')]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern char Char_4(
int arg0, int arg1, int arg2, int arg3, char ch);
+ [TestCase("ABCD", "String_4", 0, 1, 2, 3, "ABC")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string String_4(
int arg0, int arg1, int arg2, int arg3, string v);
+ [TestCase("ABCD", "Argument_256",
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ "ABC")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Argument_256(
int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7,
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldarg/Ldarg.il b/tests/IL2C.Core.Test.ILConverters/Ldarg/Ldarg.il
index 9c77258b..8be81a3f 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldarg/Ldarg.il
+++ b/tests/IL2C.Core.Test.ILConverters/Ldarg/Ldarg.il
@@ -96,7 +96,7 @@
ret
}
- .method public static native int IntPtr_4(
+ .method private static native int IntPtr_4Impl(
int32 arg0, int32 arg1, int32 arg2, int32 arg3, native int num) cil managed
{
.maxstack 2
@@ -106,7 +106,7 @@
ret
}
- .method public static native uint UIntPtr_4(
+ .method private static native uint UIntPtr_4Impl(
int32 arg0, int32 arg1, int32 arg2, int32 arg3, native uint num) cil managed
{
.maxstack 2
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldarg_0/Ldarg_0.cs b/tests/IL2C.Core.Test.ILConverters/Ldarg_0/Ldarg_0.cs
index 81c0e553..0e622665 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldarg_0/Ldarg_0.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Ldarg_0/Ldarg_0.cs
@@ -12,66 +12,72 @@
namespace IL2C.ILConverters
{
- [TestCase(true, "Boolean", false)]
- [TestCase(false, "Boolean", true)]
- [TestCase((byte)(byte.MaxValue - 1), "Byte", byte.MaxValue)]
- [TestCase((short)(short.MaxValue - 1), "Int16", short.MaxValue)]
- [TestCase(int.MaxValue - 1, "Int32", int.MaxValue)]
- [TestCase(long.MaxValue - 1, "Int64", long.MaxValue)]
- [TestCase((sbyte)(sbyte.MaxValue - 1), "SByte", sbyte.MaxValue)]
- [TestCase((ushort)(ushort.MaxValue - 1), "UInt16", ushort.MaxValue)]
- [TestCase(uint.MaxValue - 1, "UInt32", uint.MaxValue)]
- [TestCase(ulong.MaxValue - 1, "UInt64", ulong.MaxValue)]
- [TestCase(int.MaxValue - 1, "IntPtr", int.MaxValue)]
- [TestCase(uint.MaxValue - 1, "UIntPtr", uint.MaxValue)]
- [TestCase((float)((double)123.45f + (double)3.14159274f), "Single", 123.45f)]
- [TestCase(123.45 + 3.1415926535897931, "Double", 123.45)]
- [TestCase('B', "Char", 'A')]
- [TestCase("ABCD", "String", "ABC")]
public sealed class Ldarg_0
{
+ [TestCase(true, "Boolean", false)]
+ [TestCase(false, "Boolean", true)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool Boolean(bool value);
+ [TestCase((byte)(byte.MaxValue - 1), "Byte", byte.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern byte Byte(byte num);
+ [TestCase((short)(short.MaxValue - 1), "Int16", short.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern short Int16(short num);
+ [TestCase(int.MaxValue - 1, "Int32", int.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Int32(int num);
+ [TestCase(long.MaxValue - 1, "Int64", long.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern long Int64(long num);
+ [TestCase((sbyte)(sbyte.MaxValue - 1), "SByte", sbyte.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern sbyte SByte(sbyte num);
+ [TestCase((ushort)(ushort.MaxValue - 1), "UInt16", ushort.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ushort UInt16(ushort num);
+ [TestCase(uint.MaxValue - 1, "UInt32", uint.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern uint UInt32(uint num);
+ [TestCase(ulong.MaxValue - 1, "UInt64", ulong.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ulong UInt64(ulong num);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr IntPtr(IntPtr num);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr IntPtrImpl(IntPtr num);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern UIntPtr UIntPtr(UIntPtr num);
+ [TestCase(int.MaxValue - 1, "IntPtr", int.MaxValue)]
+ public static int IntPtr(int num) =>
+ IntPtrImpl((IntPtr)num).ToInt32();
+
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern UIntPtr UIntPtrImpl(UIntPtr num);
+
+ [TestCase(uint.MaxValue - 1, "UIntPtr", uint.MaxValue)]
+ public static uint UIntPtr(uint num) =>
+ UIntPtrImpl((UIntPtr)num).ToUInt32();
+ [TestCase((float)((double)123.45f + (double)3.14159274f), "Single", 123.45f)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern float Single(float num);
+ [TestCase(123.45 + 3.1415926535897931, "Double", 123.45)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern double Double(double num);
+ [TestCase('B', "Char", 'A')]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern char Char(char ch);
+ [TestCase("ABCD", "String", "ABC")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string String(string v);
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldarg_0/Ldarg_0.il b/tests/IL2C.Core.Test.ILConverters/Ldarg_0/Ldarg_0.il
index b052b5a6..da231719 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldarg_0/Ldarg_0.il
+++ b/tests/IL2C.Core.Test.ILConverters/Ldarg_0/Ldarg_0.il
@@ -87,7 +87,7 @@
ret
}
- .method public static native int IntPtr(native int num) cil managed
+ .method private static native int IntPtrImpl(native int num) cil managed
{
.maxstack 2
ldarg.0
@@ -96,7 +96,7 @@
ret
}
- .method public static native uint UIntPtr(native uint num) cil managed
+ .method private static native uint UIntPtrImpl(native uint num) cil managed
{
.maxstack 2
ldarg.0
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldarg_1/Ldarg_1.cs b/tests/IL2C.Core.Test.ILConverters/Ldarg_1/Ldarg_1.cs
index cdf986aa..db9982e7 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldarg_1/Ldarg_1.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Ldarg_1/Ldarg_1.cs
@@ -12,66 +12,72 @@
namespace IL2C.ILConverters
{
- [TestCase(true, "Boolean", 123, false)]
- [TestCase(false, "Boolean", 123, true)]
- [TestCase((byte)(byte.MaxValue - 1), "Byte", 123, byte.MaxValue)]
- [TestCase((short)(short.MaxValue - 1), "Int16", 123, short.MaxValue)]
- [TestCase(int.MaxValue - 1, "Int32", 123, int.MaxValue)]
- [TestCase(long.MaxValue - 1, "Int64", 123, long.MaxValue)]
- [TestCase((sbyte)(sbyte.MaxValue - 1), "SByte", 123, sbyte.MaxValue)]
- [TestCase((ushort)(ushort.MaxValue - 1), "UInt16", 123, ushort.MaxValue)]
- [TestCase(uint.MaxValue - 1, "UInt32", 123, uint.MaxValue)]
- [TestCase(ulong.MaxValue - 1, "UInt64", 123, ulong.MaxValue)]
- [TestCase(int.MaxValue - 1, "IntPtr", 123, int.MaxValue)]
- [TestCase(uint.MaxValue - 1, "UIntPtr", 123, uint.MaxValue)]
- [TestCase((float)((double)123.45f + (double)3.14159274f), "Single", 123, 123.45f)]
- [TestCase(123.45 + 3.1415926535897931, "Double", 123, 123.45)]
- [TestCase('B', "Char", 123, 'A')]
- [TestCase("ABCD", "String", 123, "ABC")]
public sealed class Ldarg_1
{
+ [TestCase(true, "Boolean", 123, false)]
+ [TestCase(false, "Boolean", 123, true)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool Boolean(int arg0, bool value);
+ [TestCase((byte)(byte.MaxValue - 1), "Byte", 123, byte.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern byte Byte(int arg0, byte num);
+ [TestCase((short)(short.MaxValue - 1), "Int16", 123, short.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern short Int16(int arg0, short num);
+ [TestCase(int.MaxValue - 1, "Int32", 123, int.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Int32(int arg0, int num);
+ [TestCase(long.MaxValue - 1, "Int64", 123, long.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern long Int64(int arg0, long num);
+ [TestCase((sbyte)(sbyte.MaxValue - 1), "SByte", 123, sbyte.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern sbyte SByte(int arg0, sbyte num);
+ [TestCase((ushort)(ushort.MaxValue - 1), "UInt16", 123, ushort.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ushort UInt16(int arg0, ushort num);
+ [TestCase(uint.MaxValue - 1, "UInt32", 123, uint.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern uint UInt32(int arg0, uint num);
+ [TestCase(ulong.MaxValue - 1, "UInt64", 123, ulong.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ulong UInt64(int arg0, ulong num);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr IntPtr(int arg0, IntPtr num);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr IntPtrImpl(int arg0, IntPtr num);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern UIntPtr UIntPtr(int arg0, UIntPtr num);
+ [TestCase(int.MaxValue - 1, "IntPtr", 123, int.MaxValue)]
+ public static int IntPtr(int arg0, int num) =>
+ IntPtrImpl(arg0, (IntPtr)num).ToInt32();
+
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern UIntPtr UIntPtrImpl(int arg0, UIntPtr num);
+
+ [TestCase(uint.MaxValue - 1, "UIntPtr", 123, uint.MaxValue)]
+ public static uint UIntPtr(int arg0, uint num) =>
+ UIntPtrImpl(arg0, (UIntPtr)num).ToUInt32();
+ [TestCase((float)((double)123.45f + (double)3.14159274f), "Single", 123, 123.45f)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern float Single(int arg0, float num);
+ [TestCase(123.45 + 3.1415926535897931, "Double", 123, 123.45)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern double Double(int arg0, double num);
+ [TestCase('B', "Char", 123, 'A')]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern char Char(int arg0, char ch);
+ [TestCase("ABCD", "String", 123, "ABC")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string String(int arg0, string v);
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldarg_1/Ldarg_1.il b/tests/IL2C.Core.Test.ILConverters/Ldarg_1/Ldarg_1.il
index 646cd1b1..b5999d8b 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldarg_1/Ldarg_1.il
+++ b/tests/IL2C.Core.Test.ILConverters/Ldarg_1/Ldarg_1.il
@@ -87,7 +87,7 @@
ret
}
- .method public static native int IntPtr(int32 arg0, native int num) cil managed
+ .method private static native int IntPtrImpl(int32 arg0, native int num) cil managed
{
.maxstack 2
ldarg.1
@@ -96,7 +96,7 @@
ret
}
- .method public static native uint UIntPtr(int32 arg0, native uint num) cil managed
+ .method private static native uint UIntPtrImpl(int32 arg0, native uint num) cil managed
{
.maxstack 2
ldarg.1
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldarg_2/Ldarg_2.cs b/tests/IL2C.Core.Test.ILConverters/Ldarg_2/Ldarg_2.cs
index 9fe6df2f..b1b7d9a8 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldarg_2/Ldarg_2.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Ldarg_2/Ldarg_2.cs
@@ -12,66 +12,72 @@
namespace IL2C.ILConverters
{
- [TestCase(true, "Boolean", 123, 45, false)]
- [TestCase(false, "Boolean", 123, 45, true)]
- [TestCase((byte)(byte.MaxValue - 1), "Byte", 123, 45, byte.MaxValue)]
- [TestCase((short)(short.MaxValue - 1), "Int16", 123, 45, short.MaxValue)]
- [TestCase(int.MaxValue - 1, "Int32", 123, 45, int.MaxValue)]
- [TestCase(long.MaxValue - 1, "Int64", 123, 45, long.MaxValue)]
- [TestCase((sbyte)(sbyte.MaxValue - 1), "SByte", 123, 45, sbyte.MaxValue)]
- [TestCase((ushort)(ushort.MaxValue - 1), "UInt16", 123, 45, ushort.MaxValue)]
- [TestCase(uint.MaxValue - 1, "UInt32", 123, 45, uint.MaxValue)]
- [TestCase(ulong.MaxValue - 1, "UInt64", 123, 45, ulong.MaxValue)]
- [TestCase(int.MaxValue - 1, "IntPtr", 123, 45, int.MaxValue)]
- [TestCase(uint.MaxValue - 1, "UIntPtr", 123, 45, uint.MaxValue)]
- [TestCase((float)((double)123.45f + (double)3.14159274f), "Single", 123, 45, 123.45f)]
- [TestCase(123.45 + 3.1415926535897931, "Double", 123, 45, 123.45)]
- [TestCase('B', "Char", 123, 45, 'A')]
- [TestCase("ABCD", "String", 123, 45, "ABC")]
public sealed class Ldarg_2
{
+ [TestCase(true, "Boolean", 123, 45, false)]
+ [TestCase(false, "Boolean", 123, 45, true)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool Boolean(int arg0, int arg1, bool value);
+ [TestCase((byte)(byte.MaxValue - 1), "Byte", 123, 45, byte.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern byte Byte(int arg0, int arg1, byte num);
+ [TestCase((short)(short.MaxValue - 1), "Int16", 123, 45, short.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern short Int16(int arg0, int arg1, short num);
+ [TestCase(int.MaxValue - 1, "Int32", 123, 45, int.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Int32(int arg0, int arg1, int num);
+ [TestCase(long.MaxValue - 1, "Int64", 123, 45, long.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern long Int64(int arg0, int arg1, long num);
+ [TestCase((sbyte)(sbyte.MaxValue - 1), "SByte", 123, 45, sbyte.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern sbyte SByte(int arg0, int arg1, sbyte num);
+ [TestCase((ushort)(ushort.MaxValue - 1), "UInt16", 123, 45, ushort.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ushort UInt16(int arg0, int arg1, ushort num);
+ [TestCase(uint.MaxValue - 1, "UInt32", 123, 45, uint.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern uint UInt32(int arg0, int arg1, uint num);
+ [TestCase(ulong.MaxValue - 1, "UInt64", 123, 45, ulong.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ulong UInt64(int arg0, int arg1, ulong num);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr IntPtr(int arg0, int arg1, IntPtr num);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr IntPtrImpl(int arg0, int arg1, IntPtr num);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern UIntPtr UIntPtr(int arg0, int arg1, UIntPtr num);
+ [TestCase(int.MaxValue - 1, "IntPtr", 123, 45, int.MaxValue)]
+ public static int IntPtr(int arg0, int arg1, int num) =>
+ IntPtrImpl(arg0, arg1, (IntPtr)num).ToInt32();
+
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern UIntPtr UIntPtrImpl(int arg0, int arg1, UIntPtr num);
+
+ [TestCase(uint.MaxValue - 1, "UIntPtr", 123, 45, uint.MaxValue)]
+ public static uint UIntPtr(int arg0, int arg1, uint num) =>
+ UIntPtrImpl(arg0, arg1, (UIntPtr)num).ToUInt32();
+ [TestCase((float)((double)123.45f + (double)3.14159274f), "Single", 123, 45, 123.45f)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern float Single(int arg0, int arg1, float num);
+ [TestCase(123.45 + 3.1415926535897931, "Double", 123, 45, 123.45)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern double Double(int arg0, int arg1, double num);
+ [TestCase('B', "Char", 123, 45, 'A')]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern char Char(int arg0, int arg1, char ch);
+ [TestCase("ABCD", "String", 123, 45, "ABC")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string String(int arg0, int arg1, string v);
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldarg_2/Ldarg_2.il b/tests/IL2C.Core.Test.ILConverters/Ldarg_2/Ldarg_2.il
index 73be69d4..1c8816ab 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldarg_2/Ldarg_2.il
+++ b/tests/IL2C.Core.Test.ILConverters/Ldarg_2/Ldarg_2.il
@@ -87,7 +87,7 @@
ret
}
- .method public static native int IntPtr(int32 arg0, int32 arg1, native int num) cil managed
+ .method private static native int IntPtrImpl(int32 arg0, int32 arg1, native int num) cil managed
{
.maxstack 2
ldarg.2
@@ -96,7 +96,7 @@
ret
}
- .method public static native uint UIntPtr(int32 arg0, int32 arg1, native uint num) cil managed
+ .method private static native uint UIntPtrImpl(int32 arg0, int32 arg1, native uint num) cil managed
{
.maxstack 2
ldarg.2
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldarg_3/Ldarg_3.cs b/tests/IL2C.Core.Test.ILConverters/Ldarg_3/Ldarg_3.cs
index c04c372b..3a7c7bee 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldarg_3/Ldarg_3.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Ldarg_3/Ldarg_3.cs
@@ -12,66 +12,72 @@
namespace IL2C.ILConverters
{
- [TestCase(true, "Boolean", 123, 45, 6, false)]
- [TestCase(false, "Boolean", 123, 45, 6, true)]
- [TestCase((byte)(byte.MaxValue - 1), "Byte", 123, 45, 6, byte.MaxValue)]
- [TestCase((short)(short.MaxValue - 1), "Int16", 123, 45, 6, short.MaxValue)]
- [TestCase(int.MaxValue - 1, "Int32", 123, 45, 6, int.MaxValue)]
- [TestCase(long.MaxValue - 1, "Int64", 123, 45, 6, long.MaxValue)]
- [TestCase((sbyte)(sbyte.MaxValue - 1), "SByte", 123, 45, 6, sbyte.MaxValue)]
- [TestCase((ushort)(ushort.MaxValue - 1), "UInt16", 123, 45, 6, ushort.MaxValue)]
- [TestCase(uint.MaxValue - 1, "UInt32", 123, 45, 6, uint.MaxValue)]
- [TestCase(ulong.MaxValue - 1, "UInt64", 123, 45, 6, ulong.MaxValue)]
- [TestCase(int.MaxValue - 1, "IntPtr", 123, 45, 6, int.MaxValue)]
- [TestCase(uint.MaxValue - 1, "UIntPtr", 123, 45, 6, uint.MaxValue)]
- [TestCase((float)((double)123.45f + (double)3.14159274f), "Single", 123, 45, 6, 123.45f)]
- [TestCase(123.45 + 3.1415926535897931, "Double", 123, 45, 6, 123.45)]
- [TestCase('B', "Char", 123, 45, 6, 'A')]
- [TestCase("ABCD", "String", 123, 45, 6, "ABC")]
public sealed class Ldarg_3
{
+ [TestCase(true, "Boolean", 123, 45, 6, false)]
+ [TestCase(false, "Boolean", 123, 45, 6, true)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool Boolean(int arg0, int arg1, int arg2, bool value);
+ [TestCase((byte)(byte.MaxValue - 1), "Byte", 123, 45, 6, byte.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern byte Byte(int arg0, int arg1, int arg2, byte num);
+ [TestCase((short)(short.MaxValue - 1), "Int16", 123, 45, 6, short.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern short Int16(int arg0, int arg1, int arg2, short num);
+ [TestCase(int.MaxValue - 1, "Int32", 123, 45, 6, int.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Int32(int arg0, int arg1, int arg2, int num);
+ [TestCase(long.MaxValue - 1, "Int64", 123, 45, 6, long.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern long Int64(int arg0, int arg1, int arg2, long num);
+ [TestCase((sbyte)(sbyte.MaxValue - 1), "SByte", 123, 45, 6, sbyte.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern sbyte SByte(int arg0, int arg1, int arg2, sbyte num);
+ [TestCase((ushort)(ushort.MaxValue - 1), "UInt16", 123, 45, 6, ushort.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ushort UInt16(int arg0, int arg1, int arg2, ushort num);
+ [TestCase(uint.MaxValue - 1, "UInt32", 123, 45, 6, uint.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern uint UInt32(int arg0, int arg1, int arg2, uint num);
+ [TestCase(ulong.MaxValue - 1, "UInt64", 123, 45, 6, ulong.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ulong UInt64(int arg0, int arg1, int arg2, ulong num);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr IntPtr(int arg0, int arg1, int arg2, IntPtr num);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr IntPtrImpl(int arg0, int arg1, int arg2, IntPtr num);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern UIntPtr UIntPtr(int arg0, int arg1, int arg2, UIntPtr num);
+ [TestCase(int.MaxValue - 1, "IntPtr", 123, 45, 6, int.MaxValue)]
+ public static int IntPtr(int arg0, int arg1, int arg2, int num) =>
+ IntPtrImpl(arg0, arg1, arg2, (IntPtr)num).ToInt32();
+
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern UIntPtr UIntPtrImpl(int arg0, int arg1, int arg2, UIntPtr num);
+
+ [TestCase(uint.MaxValue - 1, "UIntPtr", 123, 45, 6, uint.MaxValue)]
+ public static uint UIntPtr(int arg0, int arg1, int arg2, uint num) =>
+ UIntPtrImpl(arg0, arg1, arg2, (UIntPtr)num).ToUInt32();
+ [TestCase((float)((double)123.45f + (double)3.14159274f), "Single", 123, 45, 6, 123.45f)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern float Single(int arg0, int arg1, int arg2, float num);
+ [TestCase(123.45 + 3.1415926535897931, "Double", 123, 45, 6, 123.45)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern double Double(int arg0, int arg1, int arg2, double num);
+ [TestCase('B', "Char", 123, 45, 6, 'A')]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern char Char(int arg0, int arg1, int arg2, char ch);
+ [TestCase("ABCD", "String", 123, 45, 6, "ABC")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string String(int arg0, int arg1, int arg2, string v);
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldarg_3/Ldarg_3.il b/tests/IL2C.Core.Test.ILConverters/Ldarg_3/Ldarg_3.il
index d1f52840..b1079f2e 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldarg_3/Ldarg_3.il
+++ b/tests/IL2C.Core.Test.ILConverters/Ldarg_3/Ldarg_3.il
@@ -87,7 +87,7 @@
ret
}
- .method public static native int IntPtr(int32 arg0, int32 arg1, int32 arg2, native int num) cil managed
+ .method private static native int IntPtrImpl(int32 arg0, int32 arg1, int32 arg2, native int num) cil managed
{
.maxstack 2
ldarg.3
@@ -96,7 +96,7 @@
ret
}
- .method public static native uint UIntPtr(int32 arg0, int32 arg1, int32 arg2, native uint num) cil managed
+ .method private static native uint UIntPtrImpl(int32 arg0, int32 arg1, int32 arg2, native uint num) cil managed
{
.maxstack 2
ldarg.3
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldarg_s/Ldarg_s.cs b/tests/IL2C.Core.Test.ILConverters/Ldarg_s/Ldarg_s.cs
index a0b8c62a..8df795ac 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldarg_s/Ldarg_s.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Ldarg_s/Ldarg_s.cs
@@ -12,102 +12,110 @@
namespace IL2C.ILConverters
{
- [TestCase(true, "Boolean_4", 0, 1, 2, 3, false)]
- [TestCase(false, "Boolean_4", 0, 1, 2, 3, true)]
- [TestCase((byte)(byte.MaxValue - 1), "Byte_4", 0, 1, 2, 3, byte.MaxValue)]
- [TestCase((short)(short.MaxValue - 1), "Int16_4", 0, 1, 2, 3, short.MaxValue)]
- [TestCase(int.MaxValue - 1, "Int32_4", 0, 1, 2, 3, int.MaxValue)]
- [TestCase(long.MaxValue - 1, "Int64_4", 0, 1, 2, 3, long.MaxValue)]
- [TestCase((sbyte)(sbyte.MaxValue - 1), "SByte_4", 0, 1, 2, 3, sbyte.MaxValue)]
- [TestCase((ushort)(ushort.MaxValue - 1), "UInt16_4", 0, 1, 2, 3, ushort.MaxValue)]
- [TestCase(uint.MaxValue - 1, "UInt32_4", 0, 1, 2, 3, uint.MaxValue)]
- [TestCase(ulong.MaxValue - 1, "UInt64_4", 0, 1, 2, 3, ulong.MaxValue)]
- [TestCase(int.MaxValue - 1, "IntPtr_4", 0, 1, 2, 3, int.MaxValue)]
- [TestCase(uint.MaxValue - 1, "UIntPtr_4", 0, 1, 2, 3, uint.MaxValue)]
- [TestCase((float)((double)123.45f + (double)3.14159274f), "Single_4", 0, 1, 2, 3, 123.45f)]
- [TestCase(123.45 + 3.1415926535897931, "Double_4", 0, 1, 2, 3, 123.45)]
- [TestCase('B', "Char_4", 0, 1, 2, 3, 'A')]
- [TestCase("ABCD", "String_4", 0, 1, 2, 3, "ABC")]
- [TestCase("ABCD", "Argument_255",
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
- "ABC")]
public sealed class Ldarg_s
{
+ [TestCase(true, "Boolean_4", 0, 1, 2, 3, false)]
+ [TestCase(false, "Boolean_4", 0, 1, 2, 3, true)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool Boolean_4(
int arg0, int arg1, int arg2, int arg3, bool value);
+ [TestCase((byte)(byte.MaxValue - 1), "Byte_4", 0, 1, 2, 3, byte.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern byte Byte_4(
int arg0, int arg1, int arg2, int arg3, byte num);
+ [TestCase((short)(short.MaxValue - 1), "Int16_4", 0, 1, 2, 3, short.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern short Int16_4(
int arg0, int arg1, int arg2, int arg3, short num);
+ [TestCase(int.MaxValue - 1, "Int32_4", 0, 1, 2, 3, int.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Int32_4(
int arg0, int arg1, int arg2, int arg3, int num);
+ [TestCase(long.MaxValue - 1, "Int64_4", 0, 1, 2, 3, long.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern long Int64_4(
int arg0, int arg1, int arg2, int arg3, long num);
+ [TestCase((sbyte)(sbyte.MaxValue - 1), "SByte_4", 0, 1, 2, 3, sbyte.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern sbyte SByte_4(
int arg0, int arg1, int arg2, int arg3, sbyte num);
+ [TestCase((ushort)(ushort.MaxValue - 1), "UInt16_4", 0, 1, 2, 3, ushort.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ushort UInt16_4(
int arg0, int arg1, int arg2, int arg3, ushort num);
+ [TestCase(uint.MaxValue - 1, "UInt32_4", 0, 1, 2, 3, uint.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern uint UInt32_4(
int arg0, int arg1, int arg2, int arg3, uint num);
+ [TestCase(ulong.MaxValue - 1, "UInt64_4", 0, 1, 2, 3, ulong.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ulong UInt64_4(
int arg0, int arg1, int arg2, int arg3, ulong num);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr IntPtr_4(
- int arg0, int arg1, int arg2, int arg3, IntPtr num);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr IntPtr_4Impl(
+ int arg0, int arg1, int arg2, int arg3, IntPtr num);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern UIntPtr UIntPtr_4(
- int arg0, int arg1, int arg2, int arg3, UIntPtr num);
+ [TestCase(int.MaxValue - 1, "IntPtr_4", 0, 1, 2, 3, int.MaxValue)]
+ public static int IntPtr_4(
+ int arg0, int arg1, int arg2, int arg3, int num) =>
+ IntPtr_4Impl(arg0, arg1, arg2, arg3, (IntPtr)num).ToInt32();
+
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern UIntPtr UIntPtr_4Impl(
+ int arg0, int arg1, int arg2, int arg3, UIntPtr num);
+
+ [TestCase(uint.MaxValue - 1, "UIntPtr_4", 0, 1, 2, 3, uint.MaxValue)]
+ public static uint UIntPtr_4(
+ int arg0, int arg1, int arg2, int arg3, uint num) =>
+ UIntPtr_4Impl(arg0, arg1, arg2, arg3, (UIntPtr)num).ToUInt32();
+ [TestCase((float)((double)123.45f + (double)3.14159274f), "Single_4", 0, 1, 2, 3, 123.45f)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern float Single_4(
int arg0, int arg1, int arg2, int arg3, float num);
+ [TestCase(123.45 + 3.1415926535897931, "Double_4", 0, 1, 2, 3, 123.45)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern double Double_4(
int arg0, int arg1, int arg2, int arg3, double num);
+ [TestCase('B', "Char_4", 0, 1, 2, 3, 'A')]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern char Char_4(
int arg0, int arg1, int arg2, int arg3, char ch);
+ [TestCase("ABCD", "String_4", 0, 1, 2, 3, "ABC")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string String_4(
int arg0, int arg1, int arg2, int arg3, string v);
+ [TestCase("ABCD", "Argument_255",
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ "ABC")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Argument_255(
int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7,
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldarg_s/Ldarg_s.il b/tests/IL2C.Core.Test.ILConverters/Ldarg_s/Ldarg_s.il
index 1b570384..b7857907 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldarg_s/Ldarg_s.il
+++ b/tests/IL2C.Core.Test.ILConverters/Ldarg_s/Ldarg_s.il
@@ -96,7 +96,7 @@
ret
}
- .method public static native int IntPtr_4(
+ .method private static native int IntPtr_4Impl(
int32 arg0, int32 arg1, int32 arg2, int32 arg3, native int num) cil managed
{
.maxstack 2
@@ -106,7 +106,7 @@
ret
}
- .method public static native uint UIntPtr_4(
+ .method private static native uint UIntPtr_4Impl(
int32 arg0, int32 arg1, int32 arg2, int32 arg3, native uint num) cil managed
{
.maxstack 2
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldarga_s/Ldarga_s.cs b/tests/IL2C.Core.Test.ILConverters/Ldarga_s/Ldarga_s.cs
index 60d59aef..32cba5e0 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldarga_s/Ldarga_s.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Ldarga_s/Ldarga_s.cs
@@ -12,104 +12,112 @@
namespace IL2C.ILConverters
{
- [TestCase("False", "Boolean_4", 0, 1, 2, 3, false)]
- [TestCase("True", "Boolean_4", 0, 1, 2, 3, true)]
- [TestCase("255", "Byte_4", 0, 1, 2, 3, byte.MaxValue)]
- [TestCase("32767", "Int16_4", 0, 1, 2, 3, short.MaxValue)]
- [TestCase("2147483647", "Int32_4", 0, 1, 2, 3, int.MaxValue)]
- [TestCase("9223372036854775807", "Int64_4", 0, 1, 2, 3, long.MaxValue)]
- [TestCase("127", "SByte_4", 0, 1, 2, 3, sbyte.MaxValue)]
- [TestCase("65535", "UInt16_4", 0, 1, 2, 3, ushort.MaxValue)]
- [TestCase("4294967295", "UInt32_4", 0, 1, 2, 3, uint.MaxValue)]
- [TestCase("18446744073709551615", "UInt64_4", 0, 1, 2, 3, ulong.MaxValue)]
- [TestCase("2147483647", "IntPtr_4", 0, 1, 2, 3, int.MaxValue)]
- [TestCase("4294967295", "UIntPtr_4", 0, 1, 2, 3, uint.MaxValue)]
- [TestCase("123.45", "Single_4", 0, 1, 2, 3, 123.45f)]
- [TestCase("123.45", "Double_4", 0, 1, 2, 3, 123.45)]
- [TestCase("A", "Char_4", 0, 1, 2, 3, 'A')]
- [TestCase("ABC", new[] { "String_4", "GetUnrefString" }, 0, 1, 2, 3, "ABC")]
- [TestCase("ABC", new[] { "Argument_255", "GetUnrefString" },
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
- "ABC")]
public sealed class Ldarga_s
{
+ [TestCase("False", "Boolean_4", 0, 1, 2, 3, false)]
+ [TestCase("True", "Boolean_4", 0, 1, 2, 3, true)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Boolean_4(
int arg0, int arg1, int arg2, int arg3, bool value);
+ [TestCase("255", "Byte_4", 0, 1, 2, 3, byte.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Byte_4(
int arg0, int arg1, int arg2, int arg3, byte num);
+ [TestCase("32767", "Int16_4", 0, 1, 2, 3, short.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Int16_4(
int arg0, int arg1, int arg2, int arg3, short num);
+ [TestCase("2147483647", "Int32_4", 0, 1, 2, 3, int.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Int32_4(
int arg0, int arg1, int arg2, int arg3, int num);
+ [TestCase("9223372036854775807", "Int64_4", 0, 1, 2, 3, long.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Int64_4(
int arg0, int arg1, int arg2, int arg3, long num);
+ [TestCase("127", "SByte_4", 0, 1, 2, 3, sbyte.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string SByte_4(
int arg0, int arg1, int arg2, int arg3, sbyte num);
+ [TestCase("65535", "UInt16_4", 0, 1, 2, 3, ushort.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string UInt16_4(
int arg0, int arg1, int arg2, int arg3, ushort num);
+ [TestCase("4294967295", "UInt32_4", 0, 1, 2, 3, uint.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string UInt32_4(
int arg0, int arg1, int arg2, int arg3, uint num);
+ [TestCase("18446744073709551615", "UInt64_4", 0, 1, 2, 3, ulong.MaxValue)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string UInt64_4(
int arg0, int arg1, int arg2, int arg3, ulong num);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern string IntPtr_4(
- int arg0, int arg1, int arg2, int arg3, IntPtr num);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern string IntPtr_4Impl(
+ int arg0, int arg1, int arg2, int arg3, IntPtr num);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern string UIntPtr_4(
- int arg0, int arg1, int arg2, int arg3, UIntPtr num);
+ [TestCase("2147483647", "IntPtr_4", 0, 1, 2, 3, int.MaxValue)]
+ public static string IntPtr_4(
+ int arg0, int arg1, int arg2, int arg3, int num) =>
+ IntPtr_4Impl(arg0, arg1, arg2, arg3, (IntPtr)num);
+
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern string UIntPtr_4Impl(
+ int arg0, int arg1, int arg2, int arg3, UIntPtr num);
+
+ [TestCase("4294967295", "UIntPtr_4", 0, 1, 2, 3, uint.MaxValue)]
+ public static string UIntPtr_4(
+ int arg0, int arg1, int arg2, int arg3, uint num) =>
+ UIntPtr_4Impl(arg0, arg1, arg2, arg3, (UIntPtr)num);
+ [TestCase("123.45", "Single_4", 0, 1, 2, 3, 123.45f)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Single_4(
int arg0, int arg1, int arg2, int arg3, float num);
+ [TestCase("123.45", "Double_4", 0, 1, 2, 3, 123.45)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Double_4(
int arg0, int arg1, int arg2, int arg3, double num);
+ [TestCase("A", "Char_4", 0, 1, 2, 3, 'A')]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Char_4(
int arg0, int arg1, int arg2, int arg3, char ch);
private static string GetUnrefString(ref string value) => value;
+ [TestCase("ABC", new[] { "String_4", "GetUnrefString" }, 0, 1, 2, 3, "ABC")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string String_4(
int arg0, int arg1, int arg2, int arg3, string v);
+ [TestCase("ABC", new[] { "Argument_255", "GetUnrefString" },
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ "ABC")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Argument_255(
int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7,
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldarga_s/Ldarga_s.il b/tests/IL2C.Core.Test.ILConverters/Ldarga_s/Ldarga_s.il
index c9447bfe..45442f03 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldarga_s/Ldarga_s.il
+++ b/tests/IL2C.Core.Test.ILConverters/Ldarga_s/Ldarga_s.il
@@ -81,7 +81,7 @@
ret
}
- .method public static string IntPtr_4(
+ .method private static string IntPtr_4Impl(
int32 arg0, int32 arg1, int32 arg2, int32 arg3, native int num) cil managed
{
.maxstack 1
@@ -90,7 +90,7 @@
ret
}
- .method public static string UIntPtr_4(
+ .method private static string UIntPtr_4Impl(
int32 arg0, int32 arg1, int32 arg2, int32 arg3, native uint num) cil managed
{
.maxstack 1
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldc_i4/Ldc_i4.cs b/tests/IL2C.Core.Test.ILConverters/Ldc_i4/Ldc_i4.cs
index 42553819..10bf5790 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldc_i4/Ldc_i4.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Ldc_i4/Ldc_i4.cs
@@ -11,13 +11,13 @@
namespace IL2C.ILConverters
{
- [TestCase(int.MaxValue, "MaxValue")]
- [TestCase(int.MinValue, "MinValue")]
public sealed class Ldc_i4
{
+ [TestCase(int.MaxValue, "MaxValue")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int MaxValue();
+ [TestCase(int.MinValue, "MinValue")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int MinValue();
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldc_i4_0/Ldc_i4_0.cs b/tests/IL2C.Core.Test.ILConverters/Ldc_i4_0/Ldc_i4_0.cs
index ae5aff94..33c318a3 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldc_i4_0/Ldc_i4_0.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Ldc_i4_0/Ldc_i4_0.cs
@@ -11,13 +11,13 @@
namespace IL2C.ILConverters
{
- [TestCase(0, "RawValue")]
- [TestCase(4, "Add", 4)]
public sealed class Ldc_i4_0
{
+ [TestCase(0, "RawValue")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int RawValue();
+ [TestCase(4, "Add", 4)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Add(int num);
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldc_i4_1/Ldc_i4_1.cs b/tests/IL2C.Core.Test.ILConverters/Ldc_i4_1/Ldc_i4_1.cs
index 042b27da..ec3d0703 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldc_i4_1/Ldc_i4_1.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Ldc_i4_1/Ldc_i4_1.cs
@@ -11,13 +11,13 @@
namespace IL2C.ILConverters
{
- [TestCase(1, "RawValue")]
- [TestCase(5, "Add", 4)]
public sealed class Ldc_i4_1
{
+ [TestCase(1, "RawValue")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int RawValue();
+ [TestCase(5, "Add", 4)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Add(int num);
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldc_i4_2/Ldc_i4_2.cs b/tests/IL2C.Core.Test.ILConverters/Ldc_i4_2/Ldc_i4_2.cs
index d386e7fd..13ef654e 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldc_i4_2/Ldc_i4_2.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Ldc_i4_2/Ldc_i4_2.cs
@@ -11,13 +11,13 @@
namespace IL2C.ILConverters
{
- [TestCase(2, "RawValue")]
- [TestCase(6, "Add", 4)]
public sealed class Ldc_i4_2
{
+ [TestCase(2, "RawValue")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int RawValue();
+ [TestCase(6, "Add", 4)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Add(int num);
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldc_i4_3/Ldc_i4_3.cs b/tests/IL2C.Core.Test.ILConverters/Ldc_i4_3/Ldc_i4_3.cs
index 14b625be..6b28744f 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldc_i4_3/Ldc_i4_3.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Ldc_i4_3/Ldc_i4_3.cs
@@ -11,13 +11,13 @@
namespace IL2C.ILConverters
{
- [TestCase(3, "RawValue")]
- [TestCase(7, "Add", 4)]
public sealed class Ldc_i4_3
{
+ [TestCase(3, "RawValue")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int RawValue();
+ [TestCase(7, "Add", 4)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Add(int num);
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldc_i4_4/Ldc_i4_4.cs b/tests/IL2C.Core.Test.ILConverters/Ldc_i4_4/Ldc_i4_4.cs
index f3702641..0cb98bd5 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldc_i4_4/Ldc_i4_4.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Ldc_i4_4/Ldc_i4_4.cs
@@ -11,13 +11,13 @@
namespace IL2C.ILConverters
{
- [TestCase(4, "RawValue")]
- [TestCase(8, "Add", 4)]
public sealed class Ldc_i4_4
{
+ [TestCase(4, "RawValue")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int RawValue();
+ [TestCase(8, "Add", 4)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Add(int num);
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldc_i4_5/Ldc_i4_5.cs b/tests/IL2C.Core.Test.ILConverters/Ldc_i4_5/Ldc_i4_5.cs
index 0cafec22..01df8f5a 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldc_i4_5/Ldc_i4_5.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Ldc_i4_5/Ldc_i4_5.cs
@@ -11,13 +11,13 @@
namespace IL2C.ILConverters
{
- [TestCase(5, "RawValue")]
- [TestCase(9, "Add", 4)]
public sealed class Ldc_i4_5
{
+ [TestCase(5, "RawValue")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int RawValue();
+ [TestCase(9, "Add", 4)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Add(int num);
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldc_i4_6/Ldc_i4_6.cs b/tests/IL2C.Core.Test.ILConverters/Ldc_i4_6/Ldc_i4_6.cs
index 8f4a3f10..c1b4a09d 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldc_i4_6/Ldc_i4_6.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Ldc_i4_6/Ldc_i4_6.cs
@@ -11,13 +11,13 @@
namespace IL2C.ILConverters
{
- [TestCase(6, "RawValue")]
- [TestCase(10, "Add", 4)]
public sealed class Ldc_i4_6
{
+ [TestCase(6, "RawValue")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int RawValue();
+ [TestCase(10, "Add", 4)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Add(int num);
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldc_i4_7/Ldc_i4_7.cs b/tests/IL2C.Core.Test.ILConverters/Ldc_i4_7/Ldc_i4_7.cs
index 84683ab1..91817ec0 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldc_i4_7/Ldc_i4_7.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Ldc_i4_7/Ldc_i4_7.cs
@@ -11,13 +11,13 @@
namespace IL2C.ILConverters
{
- [TestCase(7, "RawValue")]
- [TestCase(11, "Add", 4)]
public sealed class Ldc_i4_7
{
+ [TestCase(7, "RawValue")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int RawValue();
+ [TestCase(11, "Add", 4)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Add(int num);
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldc_i4_8/Ldc_i4_8.cs b/tests/IL2C.Core.Test.ILConverters/Ldc_i4_8/Ldc_i4_8.cs
index 8c0f38b0..cc8116a4 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldc_i4_8/Ldc_i4_8.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Ldc_i4_8/Ldc_i4_8.cs
@@ -11,13 +11,13 @@
namespace IL2C.ILConverters
{
- [TestCase(8, "RawValue")]
- [TestCase(12, "Add", 4)]
public sealed class Ldc_i4_8
{
+ [TestCase(8, "RawValue")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int RawValue();
+ [TestCase(12, "Add", 4)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Add(int num);
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldc_i4_m1/Ldc_i4_m1.cs b/tests/IL2C.Core.Test.ILConverters/Ldc_i4_m1/Ldc_i4_m1.cs
index 9560df46..c4493fb3 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldc_i4_m1/Ldc_i4_m1.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Ldc_i4_m1/Ldc_i4_m1.cs
@@ -11,13 +11,13 @@
namespace IL2C.ILConverters
{
- [TestCase(-1, "RawValue")]
- [TestCase(3, "Add", 4)]
public sealed class Ldc_i4_m1
{
+ [TestCase(-1, "RawValue")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int RawValue();
+ [TestCase(3, "Add", 4)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Add(int num);
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldc_i4_s/Ldc_i4_s.cs b/tests/IL2C.Core.Test.ILConverters/Ldc_i4_s/Ldc_i4_s.cs
index b530c59d..a1eada2d 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldc_i4_s/Ldc_i4_s.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Ldc_i4_s/Ldc_i4_s.cs
@@ -11,13 +11,13 @@
namespace IL2C.ILConverters
{
- [TestCase(127, "Plus127Value")]
- [TestCase(-128, "Minus128Value")]
public sealed class Ldc_i4_s
{
+ [TestCase(127, "Plus127Value")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Plus127Value();
+ [TestCase(-128, "Minus128Value")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Minus128Value();
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldc_i8/Ldc_i8.cs b/tests/IL2C.Core.Test.ILConverters/Ldc_i8/Ldc_i8.cs
index ec405eef..0563b4f0 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldc_i8/Ldc_i8.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Ldc_i8/Ldc_i8.cs
@@ -11,13 +11,13 @@
namespace IL2C.ILConverters
{
- [TestCase(long.MaxValue, "MaxValue")]
- [TestCase(long.MinValue, "MinValue")]
public sealed class Ldc_i8
{
+ [TestCase(long.MaxValue, "MaxValue")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern long MaxValue();
+ [TestCase(long.MinValue, "MinValue")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern long MinValue();
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldc_r4/Ldc_r4.cs b/tests/IL2C.Core.Test.ILConverters/Ldc_r4/Ldc_r4.cs
index 280421b6..7af93a3f 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldc_r4/Ldc_r4.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Ldc_r4/Ldc_r4.cs
@@ -11,13 +11,13 @@
namespace IL2C.ILConverters
{
- [TestCase(float.MaxValue, "MaxValue")]
- [TestCase(float.MinValue, "MinValue")]
public sealed class Ldc_r4
{
+ [TestCase(float.MaxValue, "MaxValue")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern float MaxValue();
+ [TestCase(float.MinValue, "MinValue")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern float MinValue();
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldc_r8/Ldc_r8.cs b/tests/IL2C.Core.Test.ILConverters/Ldc_r8/Ldc_r8.cs
index ba82ea63..679bf5c0 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldc_r8/Ldc_r8.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Ldc_r8/Ldc_r8.cs
@@ -11,13 +11,13 @@
namespace IL2C.ILConverters
{
- [TestCase(double.MaxValue, "MaxValue")]
- [TestCase(double.MinValue, "MinValue")]
public sealed class Ldc_r8
{
+ [TestCase(double.MaxValue, "MaxValue")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern double MaxValue();
+ [TestCase(double.MinValue, "MinValue")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern double MinValue();
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldloc_0/Ldloc_0.cs b/tests/IL2C.Core.Test.ILConverters/Ldloc_0/Ldloc_0.cs
index af5918e1..a7d4e0c0 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldloc_0/Ldloc_0.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Ldloc_0/Ldloc_0.cs
@@ -12,69 +12,75 @@
namespace IL2C.ILConverters
{
- [TestCase(true, "True")]
- [TestCase(false, "False")]
- [TestCase(byte.MaxValue, "Byte")]
- [TestCase(short.MaxValue, "Int16")]
- [TestCase(int.MaxValue, "Int32")]
- [TestCase(long.MaxValue, "Int64")]
- [TestCase(sbyte.MaxValue, "SByte")]
- [TestCase(ushort.MaxValue, "UInt16")]
- [TestCase(uint.MaxValue, "UInt32")]
- [TestCase(ulong.MaxValue, "UInt64")]
- [TestCase(int.MaxValue, "IntPtr")]
- [TestCase(uint.MaxValue, "UIntPtr")]
- [TestCase(3.14159274f, "Single")]
- [TestCase(3.1415926535897931, "Double")]
- [TestCase('A', "Char")]
- [TestCase("ABC", "String")]
public sealed class Ldloc_0
{
+ [TestCase(true, "True")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool True();
+ [TestCase(false, "False")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool False();
+ [TestCase(byte.MaxValue, "Byte")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern byte Byte();
+ [TestCase(short.MaxValue, "Int16")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern short Int16();
+ [TestCase(int.MaxValue, "Int32")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Int32();
+ [TestCase(long.MaxValue, "Int64")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern long Int64();
+ [TestCase(sbyte.MaxValue, "SByte")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern sbyte SByte();
+ [TestCase(ushort.MaxValue, "UInt16")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ushort UInt16();
+ [TestCase(uint.MaxValue, "UInt32")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern uint UInt32();
+ [TestCase(ulong.MaxValue, "UInt64")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ulong UInt64();
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr IntPtr();
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr IntPtrImpl();
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern UIntPtr UIntPtr();
+ [TestCase(int.MaxValue, "IntPtr")]
+ public static int IntPtr() =>
+ IntPtrImpl().ToInt32();
+
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern UIntPtr UIntPtrImpl();
+
+ [TestCase(uint.MaxValue, "UIntPtr")]
+ public static uint UIntPtr() =>
+ UIntPtrImpl().ToUInt32();
+ [TestCase(3.14159274f, "Single")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern float Single();
+ [TestCase(3.1415926535897931, "Double")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern double Double();
+ [TestCase('A', "Char")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern char Char();
+ [TestCase("ABC", "String")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string String();
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldloc_0/Ldloc_0.il b/tests/IL2C.Core.Test.ILConverters/Ldloc_0/Ldloc_0.il
index 86e712e1..5b1f8e15 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldloc_0/Ldloc_0.il
+++ b/tests/IL2C.Core.Test.ILConverters/Ldloc_0/Ldloc_0.il
@@ -122,7 +122,7 @@
ret
}
- .method public static native int IntPtr() cil managed
+ .method private static native int IntPtrImpl() cil managed
{
.maxstack 1
.locals init (
@@ -135,7 +135,7 @@
ret
}
- .method public static native uint UIntPtr() cil managed
+ .method private static native uint UIntPtrImpl() cil managed
{
.maxstack 1
.locals init (
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldloc_1/Ldloc_1.cs b/tests/IL2C.Core.Test.ILConverters/Ldloc_1/Ldloc_1.cs
index 3e8a7336..1e99037c 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldloc_1/Ldloc_1.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Ldloc_1/Ldloc_1.cs
@@ -12,69 +12,75 @@
namespace IL2C.ILConverters
{
- [TestCase(true, "True")]
- [TestCase(false, "False")]
- [TestCase(byte.MaxValue, "Byte")]
- [TestCase(short.MaxValue, "Int16")]
- [TestCase(int.MaxValue, "Int32")]
- [TestCase(long.MaxValue, "Int64")]
- [TestCase(sbyte.MaxValue, "SByte")]
- [TestCase(ushort.MaxValue, "UInt16")]
- [TestCase(uint.MaxValue, "UInt32")]
- [TestCase(ulong.MaxValue, "UInt64")]
- [TestCase(int.MaxValue, "IntPtr")]
- [TestCase(uint.MaxValue, "UIntPtr")]
- [TestCase(3.14159274f, "Single")]
- [TestCase(3.1415926535897931, "Double")]
- [TestCase('A', "Char")]
- [TestCase("ABC", "String")]
public sealed class Ldloc_1
{
+ [TestCase(true, "True")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool True();
+ [TestCase(false, "False")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool False();
+ [TestCase(byte.MaxValue, "Byte")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern byte Byte();
+ [TestCase(short.MaxValue, "Int16")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern short Int16();
+ [TestCase(int.MaxValue, "Int32")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Int32();
+ [TestCase(long.MaxValue, "Int64")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern long Int64();
+ [TestCase(sbyte.MaxValue, "SByte")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern sbyte SByte();
+ [TestCase(ushort.MaxValue, "UInt16")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ushort UInt16();
+ [TestCase(uint.MaxValue, "UInt32")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern uint UInt32();
+ [TestCase(ulong.MaxValue, "UInt64")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ulong UInt64();
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr IntPtr();
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr IntPtrImpl();
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern UIntPtr UIntPtr();
+ [TestCase(int.MaxValue, "IntPtr")]
+ public static int IntPtr() =>
+ IntPtrImpl().ToInt32();
+
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern UIntPtr UIntPtrImpl();
+
+ [TestCase(uint.MaxValue, "UIntPtr")]
+ public static uint UIntPtr() =>
+ UIntPtrImpl().ToUInt32();
+ [TestCase(3.14159274f, "Single")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern float Single();
+ [TestCase(3.1415926535897931, "Double")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern double Double();
+ [TestCase('A', "Char")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern char Char();
+ [TestCase("ABC", "String")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string String();
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldloc_1/Ldloc_1.il b/tests/IL2C.Core.Test.ILConverters/Ldloc_1/Ldloc_1.il
index 0f5cc3be..ec7fb8c6 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldloc_1/Ldloc_1.il
+++ b/tests/IL2C.Core.Test.ILConverters/Ldloc_1/Ldloc_1.il
@@ -132,7 +132,7 @@
ret
}
- .method public static native int IntPtr() cil managed
+ .method private static native int IntPtrImpl() cil managed
{
.maxstack 1
.locals init (
@@ -146,7 +146,7 @@
ret
}
- .method public static native uint UIntPtr() cil managed
+ .method private static native uint UIntPtrImpl() cil managed
{
.maxstack 1
.locals init (
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldloc_2/Ldloc_2.cs b/tests/IL2C.Core.Test.ILConverters/Ldloc_2/Ldloc_2.cs
index f1afacb8..1f61e3b6 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldloc_2/Ldloc_2.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Ldloc_2/Ldloc_2.cs
@@ -12,69 +12,75 @@
namespace IL2C.ILConverters
{
- [TestCase(true, "True")]
- [TestCase(false, "False")]
- [TestCase(byte.MaxValue, "Byte")]
- [TestCase(short.MaxValue, "Int16")]
- [TestCase(int.MaxValue, "Int32")]
- [TestCase(long.MaxValue, "Int64")]
- [TestCase(sbyte.MaxValue, "SByte")]
- [TestCase(ushort.MaxValue, "UInt16")]
- [TestCase(uint.MaxValue, "UInt32")]
- [TestCase(ulong.MaxValue, "UInt64")]
- [TestCase(int.MaxValue, "IntPtr")]
- [TestCase(uint.MaxValue, "UIntPtr")]
- [TestCase(3.14159274f, "Single")]
- [TestCase(3.1415926535897931, "Double")]
- [TestCase('A', "Char")]
- [TestCase("ABC", "String")]
public sealed class Ldloc_2
{
+ [TestCase(true, "True")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool True();
+ [TestCase(false, "False")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool False();
+ [TestCase(byte.MaxValue, "Byte")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern byte Byte();
+ [TestCase(short.MaxValue, "Int16")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern short Int16();
+ [TestCase(int.MaxValue, "Int32")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Int32();
+ [TestCase(long.MaxValue, "Int64")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern long Int64();
+ [TestCase(sbyte.MaxValue, "SByte")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern sbyte SByte();
+ [TestCase(ushort.MaxValue, "UInt16")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ushort UInt16();
+ [TestCase(uint.MaxValue, "UInt32")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern uint UInt32();
+ [TestCase(ulong.MaxValue, "UInt64")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ulong UInt64();
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr IntPtr();
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr IntPtrImpl();
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern UIntPtr UIntPtr();
+ [TestCase(int.MaxValue, "IntPtr")]
+ public static int IntPtr() =>
+ IntPtrImpl().ToInt32();
+
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern UIntPtr UIntPtrImpl();
+
+ [TestCase(uint.MaxValue, "UIntPtr")]
+ public static uint UIntPtr() =>
+ UIntPtrImpl().ToUInt32();
+ [TestCase(3.14159274f, "Single")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern float Single();
+ [TestCase(3.1415926535897931, "Double")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern double Double();
+ [TestCase('A', "Char")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern char Char();
+ [TestCase("ABC", "String")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string String();
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldloc_2/Ldloc_2.il b/tests/IL2C.Core.Test.ILConverters/Ldloc_2/Ldloc_2.il
index 3d794dee..8ed1544e 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldloc_2/Ldloc_2.il
+++ b/tests/IL2C.Core.Test.ILConverters/Ldloc_2/Ldloc_2.il
@@ -142,7 +142,7 @@
ret
}
- .method public static native int IntPtr() cil managed
+ .method private static native int IntPtrImpl() cil managed
{
.maxstack 1
.locals init (
@@ -157,7 +157,7 @@
ret
}
- .method public static native uint UIntPtr() cil managed
+ .method private static native uint UIntPtrImpl() cil managed
{
.maxstack 1
.locals init (
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldloc_3/Ldloc_3.cs b/tests/IL2C.Core.Test.ILConverters/Ldloc_3/Ldloc_3.cs
index 6e0913e3..27190eaa 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldloc_3/Ldloc_3.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Ldloc_3/Ldloc_3.cs
@@ -12,69 +12,75 @@
namespace IL2C.ILConverters
{
- [TestCase(true, "True")]
- [TestCase(false, "False")]
- [TestCase(byte.MaxValue, "Byte")]
- [TestCase(short.MaxValue, "Int16")]
- [TestCase(int.MaxValue, "Int32")]
- [TestCase(long.MaxValue, "Int64")]
- [TestCase(sbyte.MaxValue, "SByte")]
- [TestCase(ushort.MaxValue, "UInt16")]
- [TestCase(uint.MaxValue, "UInt32")]
- [TestCase(ulong.MaxValue, "UInt64")]
- [TestCase(int.MaxValue, "IntPtr")]
- [TestCase(uint.MaxValue, "UIntPtr")]
- [TestCase(3.14159274f, "Single")]
- [TestCase(3.1415926535897931, "Double")]
- [TestCase('A', "Char")]
- [TestCase("ABC", "String")]
public sealed class Ldloc_3
{
+ [TestCase(true, "True")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool True();
+ [TestCase(false, "False")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool False();
+ [TestCase(byte.MaxValue, "Byte")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern byte Byte();
+ [TestCase(short.MaxValue, "Int16")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern short Int16();
+ [TestCase(int.MaxValue, "Int32")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Int32();
+ [TestCase(long.MaxValue, "Int64")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern long Int64();
+ [TestCase(sbyte.MaxValue, "SByte")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern sbyte SByte();
+ [TestCase(ushort.MaxValue, "UInt16")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ushort UInt16();
+ [TestCase(uint.MaxValue, "UInt32")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern uint UInt32();
+ [TestCase(ulong.MaxValue, "UInt64")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ulong UInt64();
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr IntPtr();
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr IntPtrImpl();
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern UIntPtr UIntPtr();
+ [TestCase(int.MaxValue, "IntPtr")]
+ public static int IntPtr() =>
+ IntPtrImpl().ToInt32();
+
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern UIntPtr UIntPtrImpl();
+
+ [TestCase(uint.MaxValue, "UIntPtr")]
+ public static uint UIntPtr() =>
+ UIntPtrImpl().ToUInt32();
+ [TestCase(3.14159274f, "Single")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern float Single();
+ [TestCase(3.1415926535897931, "Double")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern double Double();
+ [TestCase('A', "Char")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern char Char();
+ [TestCase("ABC", "String")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string String();
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldloc_3/Ldloc_3.il b/tests/IL2C.Core.Test.ILConverters/Ldloc_3/Ldloc_3.il
index 5ea857f9..7d509677 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldloc_3/Ldloc_3.il
+++ b/tests/IL2C.Core.Test.ILConverters/Ldloc_3/Ldloc_3.il
@@ -152,7 +152,7 @@
ret
}
- .method public static native int IntPtr() cil managed
+ .method private static native int IntPtrImpl() cil managed
{
.maxstack 1
.locals init (
@@ -168,7 +168,7 @@
ret
}
- .method public static native uint UIntPtr() cil managed
+ .method private static native uint UIntPtrImpl() cil managed
{
.maxstack 1
.locals init (
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldloc_s/Ldloc_s.cs b/tests/IL2C.Core.Test.ILConverters/Ldloc_s/Ldloc_s.cs
index 358ac42f..21555ca2 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldloc_s/Ldloc_s.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Ldloc_s/Ldloc_s.cs
@@ -12,73 +12,79 @@
namespace IL2C.ILConverters
{
- [TestCase(true, "True")]
- [TestCase(false, "False")]
- [TestCase(byte.MaxValue, "Byte")]
- [TestCase(short.MaxValue, "Int16")]
- [TestCase(int.MaxValue, "Int32")]
- [TestCase(long.MaxValue, "Int64")]
- [TestCase(sbyte.MaxValue, "SByte")]
- [TestCase(ushort.MaxValue, "UInt16")]
- [TestCase(uint.MaxValue, "UInt32")]
- [TestCase(ulong.MaxValue, "UInt64")]
- [TestCase(int.MaxValue, "IntPtr")]
- [TestCase(uint.MaxValue, "UIntPtr")]
- [TestCase(3.14159274f, "Single")]
- [TestCase(3.1415926535897931, "Double")]
- [TestCase('A', "Char")]
- [TestCase("ABC", "String")]
- [TestCase("ABC", "LocalVariable_255")]
public sealed class Ldloc_s
{
+ [TestCase(true, "True")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool True();
+ [TestCase(false, "False")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool False();
+ [TestCase(byte.MaxValue, "Byte")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern byte Byte();
+ [TestCase(short.MaxValue, "Int16")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern short Int16();
+ [TestCase(int.MaxValue, "Int32")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Int32();
+ [TestCase(long.MaxValue, "Int64")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern long Int64();
+ [TestCase(sbyte.MaxValue, "SByte")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern sbyte SByte();
+ [TestCase(ushort.MaxValue, "UInt16")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ushort UInt16();
+ [TestCase(uint.MaxValue, "UInt32")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern uint UInt32();
+ [TestCase(ulong.MaxValue, "UInt64")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ulong UInt64();
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr IntPtr();
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr IntPtrImpl();
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern UIntPtr UIntPtr();
+ [TestCase(int.MaxValue, "IntPtr")]
+ public static int IntPtr() =>
+ IntPtrImpl().ToInt32();
+
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern UIntPtr UIntPtrImpl();
+
+ [TestCase(uint.MaxValue, "UIntPtr")]
+ public static uint UIntPtr() =>
+ UIntPtrImpl().ToUInt32();
+ [TestCase(3.14159274f, "Single")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern float Single();
+ [TestCase(3.1415926535897931, "Double")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern double Double();
+ [TestCase('A', "Char")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern char Char();
+ [TestCase("ABC", "String")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string String();
+ [TestCase("ABC", "LocalVariable_255")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string LocalVariable_255();
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldloc_s/Ldloc_s.il b/tests/IL2C.Core.Test.ILConverters/Ldloc_s/Ldloc_s.il
index 0d64c83d..7a371ade 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldloc_s/Ldloc_s.il
+++ b/tests/IL2C.Core.Test.ILConverters/Ldloc_s/Ldloc_s.il
@@ -162,7 +162,7 @@
ret
}
- .method public static native int IntPtr() cil managed
+ .method private static native int IntPtrImpl() cil managed
{
.maxstack 1
.locals init (
@@ -179,7 +179,7 @@
ret
}
- .method public static native uint UIntPtr() cil managed
+ .method private static native uint UIntPtrImpl() cil managed
{
.maxstack 1
.locals init (
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldloca_s/Ldloca_s.cs b/tests/IL2C.Core.Test.ILConverters/Ldloca_s/Ldloca_s.cs
index c360c117..f66bff52 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldloca_s/Ldloca_s.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Ldloca_s/Ldloca_s.cs
@@ -9,76 +9,85 @@
using System;
using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
namespace IL2C.ILConverters
{
- [TestCase("True", "True")]
- [TestCase("False", "False")]
- [TestCase("255", "Byte")]
- [TestCase("32767", "Int16")]
- [TestCase("2147483647", "Int32")]
- [TestCase("9223372036854775807", "Int64")]
- [TestCase("127", "SByte")]
- [TestCase("65535", "UInt16")]
- [TestCase("4294967295", "UInt32")]
- [TestCase("18446744073709551615", "UInt64")]
- [TestCase("2147483647", "IntPtr")]
- [TestCase("4294967295", "UIntPtr")]
-#if NET50
- [TestCase("3.1415927", "Single")] // Lost last 1 digits via ToString conversion.
- [TestCase("3.141592653589793", "Double")] // Lost last 1 digits via ToString conversion.
-#else
- // Ignore validation because .NET Framework CLR precision is poor.
- [TestCase("3.1415927", "Single", Assert = TestCaseAsserts.IgnoreValidateInvokeResult)] // Lost last 1 digits via ToString conversion.
- [TestCase("3.141592653589793", "Double", Assert = TestCaseAsserts.IgnoreValidateInvokeResult)] // Lost last 1 digits via ToString conversion.
-#endif
- [TestCase("A", "Char")]
- [TestCase("ABC", new[] { "String", "UpdateString" })] // Translation will include UpdateString method
- [TestCase("ABC", new[] { "LocalVariable_255", "UpdateString" })] // Translation will include UpdateString method
public sealed class Ldloca_s
{
+ [TestCase("True", "True")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string True();
+ [TestCase("False", "False")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string False();
+ [TestCase("255", "Byte")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Byte();
+ [TestCase("32767", "Int16")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Int16();
+ [TestCase("2147483647", "Int32")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Int32();
+ [TestCase("9223372036854775807", "Int64")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Int64();
+ [TestCase("127", "SByte")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string SByte();
+ [TestCase("65535", "UInt16")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string UInt16();
+ [TestCase("4294967295", "UInt32")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string UInt32();
+ [TestCase("18446744073709551615", "UInt64")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string UInt64();
+ [TestCase("2147483647", "IntPtr")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string IntPtr();
+ [TestCase("4294967295", "UIntPtr")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string UIntPtr();
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern string Single();
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern string SingleImpl();
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern string Double();
+ [TestCase("3.1415927", "Single")]
+ public static string Single() =>
+#if NETFRAMEWORK
+ // Ignore validation because .NET Framework CLR precision is poor.
+ IL2CServices.IsInNativeExecution ? SingleImpl() : "3.1415927";
+#else
+ SingleImpl();
+#endif
+
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern string DoubleImpl();
+
+ [TestCase("3.141592653589793", "Double")] // Lost last 1 digits via ToString conversion.
+ public static string Double() =>
+#if NETFRAMEWORK
+ // Ignore validation because .NET Framework CLR precision is poor.
+ IL2CServices.IsInNativeExecution ? DoubleImpl() : "3.141592653589793";
+#else
+ DoubleImpl();
+#endif
+ [TestCase("A", "Char")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Char();
@@ -87,9 +96,11 @@ public static void UpdateString(ref string value)
value = "ABC";
}
+ [TestCase("ABC", new[] { "String", "UpdateString" })] // Translation will include UpdateString method
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string String();
+ [TestCase("ABC", new[] { "LocalVariable_255", "UpdateString" })] // Translation will include UpdateString method
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string LocalVariable_255();
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldloca_s/Ldloca_s.il b/tests/IL2C.Core.Test.ILConverters/Ldloca_s/Ldloca_s.il
index 3024b81b..42966f0b 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldloca_s/Ldloca_s.il
+++ b/tests/IL2C.Core.Test.ILConverters/Ldloca_s/Ldloca_s.il
@@ -160,7 +160,7 @@
ret
}
- .method public static string Single() cil managed
+ .method private static string SingleImpl() cil managed
{
.maxstack 1
.locals init (
@@ -173,7 +173,7 @@
ret
}
- .method public static string Double() cil managed
+ .method private static string DoubleImpl() cil managed
{
.maxstack 1
.locals init (
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldnull/Ldnull.cs b/tests/IL2C.Core.Test.ILConverters/Ldnull/Ldnull.cs
index 2c93fc72..5552cd66 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldnull/Ldnull.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Ldnull/Ldnull.cs
@@ -12,17 +12,29 @@
namespace IL2C.ILConverters
{
- [TestCase(0, "IntPtrZero")]
- [TestCase((uint)0, "UIntPtrZero")]
- [TestCase(null, "NullReference")]
public sealed class Ldnull
{
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr IntPtrZero();
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr IntPtrZeroImpl();
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern UIntPtr UIntPtrZero();
+ // TODO: Unknown failure on mono linux x64
+ // System.InvalidProgramException : Invalid IL code in IL2C.ILConverters.Ldnull:IntPtrZeroImpl (): IL_0001: ret
+ [TestCase(0, "IntPtrZero",
+ RunOnPlatforms = RunOnPlatforms.DotNet)]
+ public static int IntPtrZero() =>
+ IntPtrZeroImpl().ToInt32();
+
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ public static extern UIntPtr UIntPtrZeroImpl();
+
+ // TODO: Unknown failure on mono linux x64
+ // System.InvalidProgramException : Invalid IL code in IL2C.ILConverters.Ldnull:UIntPtrZeroImpl (): IL_0001: ret
+ [TestCase((uint)0, "UIntPtrZero",
+ RunOnPlatforms = RunOnPlatforms.DotNet)]
+ public static uint UIntPtrZero() =>
+ UIntPtrZeroImpl().ToUInt32();
+ [TestCase(null, "NullReference", Assert = TestCaseAsserts.PerfectMatch)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern object NullReference();
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldnull/Ldnull.il b/tests/IL2C.Core.Test.ILConverters/Ldnull/Ldnull.il
index 391fd2d0..06df6728 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldnull/Ldnull.il
+++ b/tests/IL2C.Core.Test.ILConverters/Ldnull/Ldnull.il
@@ -1,13 +1,13 @@
.class public IL2C.ILConverters.Ldnull
{
- .method public static native int IntPtrZero() cil managed
+ .method private static native int IntPtrZeroImpl() cil managed
{
.maxstack 2
ldnull
ret
}
- .method public static native unsigned int UIntPtrZero() cil managed
+ .method private static native unsigned int UIntPtrZeroImpl() cil managed
{
.maxstack 2
ldnull
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldsfld/Ldsfld.cs b/tests/IL2C.Core.Test.ILConverters/Ldsfld/Ldsfld.cs
index d37dc4a3..638947e3 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldsfld/Ldsfld.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Ldsfld/Ldsfld.cs
@@ -32,69 +32,75 @@ public static class Ldsfld_Field
public static readonly string StringValue = "ABC";
}
- [TestCase(true, "True", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
- [TestCase(false, "False", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
- [TestCase(byte.MaxValue, "Byte", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
- [TestCase(short.MaxValue, "Int16", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
- [TestCase(int.MaxValue, "Int32", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
- [TestCase(long.MaxValue, "Int64", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
- [TestCase(sbyte.MaxValue, "SByte", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
- [TestCase(ushort.MaxValue, "UInt16", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
- [TestCase(uint.MaxValue, "UInt32", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
- [TestCase(ulong.MaxValue, "UInt64", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
- [TestCase(int.MaxValue, "IntPtr", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
- [TestCase(uint.MaxValue, "UIntPtr", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
- [TestCase(3.14159274f, "Single", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
- [TestCase(3.1415926535897931, "Double", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
- [TestCase('A', "Char", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
- [TestCase("ABC", "String", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
public sealed class Ldsfld
{
+ [TestCase(true, "True", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool True();
+ [TestCase(false, "False", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool False();
+ [TestCase(byte.MaxValue, "Byte", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern byte Byte();
+ [TestCase(short.MaxValue, "Int16", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern short Int16();
+ [TestCase(int.MaxValue, "Int32", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Int32();
+ [TestCase(long.MaxValue, "Int64", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern long Int64();
+ [TestCase(sbyte.MaxValue, "SByte", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern sbyte SByte();
+ [TestCase(ushort.MaxValue, "UInt16", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ushort UInt16();
+ [TestCase(uint.MaxValue, "UInt32", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern uint UInt32();
+ [TestCase(ulong.MaxValue, "UInt64", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ulong UInt64();
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr IntPtr();
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr IntPtrImpl();
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern UIntPtr UIntPtr();
+ [TestCase(int.MaxValue, "IntPtr", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
+ public static int IntPtr() =>
+ IntPtrImpl().ToInt32();
+
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern UIntPtr UIntPtrImpl();
+
+ [TestCase(uint.MaxValue, "UIntPtr", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
+ public static uint UIntPtr() =>
+ UIntPtrImpl().ToUInt32();
+ [TestCase(3.14159274f, "Single", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern float Single();
+ [TestCase(3.1415926535897931, "Double", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern double Double();
+ [TestCase('A', "Char", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern char Char();
+ [TestCase("ABC", "String", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string String();
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldsfld/Ldsfld.il b/tests/IL2C.Core.Test.ILConverters/Ldsfld/Ldsfld.il
index 44ad3717..3a70bc5b 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldsfld/Ldsfld.il
+++ b/tests/IL2C.Core.Test.ILConverters/Ldsfld/Ldsfld.il
@@ -3,112 +3,112 @@
.method public static bool True() cil managed
{
.maxstack 1
- ldsfld bool IL2C.ILConverters.Ldsfld_Field::TrueValue
+ ldsfld bool [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Ldsfld_Field::TrueValue
ret
}
.method public static bool False() cil managed
{
.maxstack 1
- ldsfld bool IL2C.ILConverters.Ldsfld_Field::FalseValue
+ ldsfld bool [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Ldsfld_Field::FalseValue
ret
}
.method public static uint8 Byte() cil managed
{
.maxstack 1
- ldsfld uint8 IL2C.ILConverters.Ldsfld_Field::ByteValue
+ ldsfld uint8 [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Ldsfld_Field::ByteValue
ret
}
.method public static int16 Int16() cil managed
{
.maxstack 1
- ldsfld int16 IL2C.ILConverters.Ldsfld_Field::Int16Value
+ ldsfld int16 [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Ldsfld_Field::Int16Value
ret
}
.method public static int32 Int32() cil managed
{
.maxstack 1
- ldsfld int32 IL2C.ILConverters.Ldsfld_Field::Int32Value
+ ldsfld int32 [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Ldsfld_Field::Int32Value
ret
}
.method public static int64 Int64() cil managed
{
.maxstack 1
- ldsfld int64 IL2C.ILConverters.Ldsfld_Field::Int64Value
+ ldsfld int64 [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Ldsfld_Field::Int64Value
ret
}
.method public static int8 SByte() cil managed
{
.maxstack 1
- ldsfld int8 IL2C.ILConverters.Ldsfld_Field::SByteValue
+ ldsfld int8 [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Ldsfld_Field::SByteValue
ret
}
.method public static uint16 UInt16() cil managed
{
.maxstack 1
- ldsfld uint16 IL2C.ILConverters.Ldsfld_Field::UInt16Value
+ ldsfld uint16 [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Ldsfld_Field::UInt16Value
ret
}
.method public static uint32 UInt32() cil managed
{
.maxstack 1
- ldsfld uint32 IL2C.ILConverters.Ldsfld_Field::UInt32Value
+ ldsfld uint32 [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Ldsfld_Field::UInt32Value
ret
}
.method public static uint64 UInt64() cil managed
{
.maxstack 1
- ldsfld uint64 IL2C.ILConverters.Ldsfld_Field::UInt64Value
+ ldsfld uint64 [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Ldsfld_Field::UInt64Value
ret
}
- .method public static native int IntPtr() cil managed
+ .method private static native int IntPtrImpl() cil managed
{
.maxstack 1
- ldsfld native int IL2C.ILConverters.Ldsfld_Field::IntPtrValue
+ ldsfld native int [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Ldsfld_Field::IntPtrValue
ret
}
- .method public static native uint UIntPtr() cil managed
+ .method private static native uint UIntPtrImpl() cil managed
{
.maxstack 1
- ldsfld native uint IL2C.ILConverters.Ldsfld_Field::UIntPtrValue
+ ldsfld native uint [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Ldsfld_Field::UIntPtrValue
ret
}
.method public static float32 Single() cil managed
{
.maxstack 1
- ldsfld float32 IL2C.ILConverters.Ldsfld_Field::SingleValue
+ ldsfld float32 [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Ldsfld_Field::SingleValue
ret
}
.method public static float64 Double() cil managed
{
.maxstack 1
- ldsfld float64 IL2C.ILConverters.Ldsfld_Field::DoubleValue
+ ldsfld float64 [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Ldsfld_Field::DoubleValue
ret
}
.method public static char Char() cil managed
{
.maxstack 1
- ldsfld char IL2C.ILConverters.Ldsfld_Field::CharValue
+ ldsfld char [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Ldsfld_Field::CharValue
ret
}
.method public static string String() cil managed
{
.maxstack 1
- ldsfld string IL2C.ILConverters.Ldsfld_Field::StringValue
+ ldsfld string [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Ldsfld_Field::StringValue
ret
}
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldsflda/Ldsflda.cs b/tests/IL2C.Core.Test.ILConverters/Ldsflda/Ldsflda.cs
index 9b6065de..cf816c00 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldsflda/Ldsflda.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Ldsflda/Ldsflda.cs
@@ -12,69 +12,75 @@
namespace IL2C.ILConverters
{
- [TestCase(true, "True", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
- [TestCase(false, "False", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
- [TestCase(byte.MaxValue, "Byte", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
- [TestCase(short.MaxValue, "Int16", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
- [TestCase(int.MaxValue, "Int32", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
- [TestCase(long.MaxValue, "Int64", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
- [TestCase(sbyte.MaxValue, "SByte", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
- [TestCase(ushort.MaxValue, "UInt16", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
- [TestCase(uint.MaxValue, "UInt32", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
- [TestCase(ulong.MaxValue, "UInt64", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
- [TestCase(int.MaxValue, "IntPtr", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
- [TestCase(uint.MaxValue, "UIntPtr", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
- [TestCase(3.14159274f, "Single", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
- [TestCase(3.1415926535897931, "Double", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
- [TestCase('A', "Char", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
- [TestCase("ABC", "String", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
public sealed class Ldsflda
{
+ [TestCase(true, "True", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool True();
+ [TestCase(false, "False", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool False();
+ [TestCase(byte.MaxValue, "Byte", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern byte Byte();
+ [TestCase(short.MaxValue, "Int16", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern short Int16();
+ [TestCase(int.MaxValue, "Int32", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Int32();
+ [TestCase(long.MaxValue, "Int64", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern long Int64();
+ [TestCase(sbyte.MaxValue, "SByte", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern sbyte SByte();
+ [TestCase(ushort.MaxValue, "UInt16", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ushort UInt16();
+ [TestCase(uint.MaxValue, "UInt32", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern uint UInt32();
+ [TestCase(ulong.MaxValue, "UInt64", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ulong UInt64();
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr IntPtr();
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr IntPtrImpl();
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern UIntPtr UIntPtr();
+ [TestCase(int.MaxValue, "IntPtr", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
+ public static int IntPtr() =>
+ IntPtrImpl().ToInt32();
+
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern UIntPtr UIntPtrImpl();
+
+ [TestCase(uint.MaxValue, "UIntPtr", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
+ public static uint UIntPtr() =>
+ UIntPtrImpl().ToUInt32();
+ [TestCase(3.14159274f, "Single", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern float Single();
+ [TestCase(3.1415926535897931, "Double", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern double Double();
+ [TestCase('A', "Char", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern char Char();
+ [TestCase("ABC", "String", IncludeTypes = new[] { typeof(Ldsfld_Field) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string String();
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldsflda/Ldsflda.il b/tests/IL2C.Core.Test.ILConverters/Ldsflda/Ldsflda.il
index 173e8035..10a88e84 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldsflda/Ldsflda.il
+++ b/tests/IL2C.Core.Test.ILConverters/Ldsflda/Ldsflda.il
@@ -3,7 +3,7 @@
.method public static bool True() cil managed
{
.maxstack 1
- ldsflda bool IL2C.ILConverters.Ldsfld_Field::TrueValue
+ ldsflda bool [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Ldsfld_Field::TrueValue
ldind.u1
ret
}
@@ -11,7 +11,7 @@
.method public static bool False() cil managed
{
.maxstack 1
- ldsflda bool IL2C.ILConverters.Ldsfld_Field::FalseValue
+ ldsflda bool [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Ldsfld_Field::FalseValue
ldind.u1
ret
}
@@ -19,7 +19,7 @@
.method public static uint8 Byte() cil managed
{
.maxstack 1
- ldsflda uint8 IL2C.ILConverters.Ldsfld_Field::ByteValue
+ ldsflda uint8 [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Ldsfld_Field::ByteValue
ldind.u1
ret
}
@@ -27,7 +27,7 @@
.method public static int16 Int16() cil managed
{
.maxstack 1
- ldsflda int16 IL2C.ILConverters.Ldsfld_Field::Int16Value
+ ldsflda int16 [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Ldsfld_Field::Int16Value
ldind.i2
ret
}
@@ -35,7 +35,7 @@
.method public static int32 Int32() cil managed
{
.maxstack 1
- ldsflda int32 IL2C.ILConverters.Ldsfld_Field::Int32Value
+ ldsflda int32 [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Ldsfld_Field::Int32Value
ldind.i4
ret
}
@@ -43,7 +43,7 @@
.method public static int64 Int64() cil managed
{
.maxstack 1
- ldsflda int64 IL2C.ILConverters.Ldsfld_Field::Int64Value
+ ldsflda int64 [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Ldsfld_Field::Int64Value
ldind.i8
ret
}
@@ -51,7 +51,7 @@
.method public static int8 SByte() cil managed
{
.maxstack 1
- ldsflda int8 IL2C.ILConverters.Ldsfld_Field::SByteValue
+ ldsflda int8 [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Ldsfld_Field::SByteValue
ldind.i1
ret
}
@@ -59,7 +59,7 @@
.method public static uint16 UInt16() cil managed
{
.maxstack 1
- ldsflda uint16 IL2C.ILConverters.Ldsfld_Field::UInt16Value
+ ldsflda uint16 [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Ldsfld_Field::UInt16Value
ldind.u2
ret
}
@@ -67,7 +67,7 @@
.method public static uint32 UInt32() cil managed
{
.maxstack 1
- ldsflda uint32 IL2C.ILConverters.Ldsfld_Field::UInt32Value
+ ldsflda uint32 [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Ldsfld_Field::UInt32Value
ldind.u4
ret
}
@@ -75,23 +75,23 @@
.method public static uint64 UInt64() cil managed
{
.maxstack 1
- ldsflda uint64 IL2C.ILConverters.Ldsfld_Field::UInt64Value
+ ldsflda uint64 [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Ldsfld_Field::UInt64Value
ldind.i8
ret
}
- .method public static native int IntPtr() cil managed
+ .method private static native int IntPtrImpl() cil managed
{
.maxstack 1
- ldsflda native int IL2C.ILConverters.Ldsfld_Field::IntPtrValue
+ ldsflda native int [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Ldsfld_Field::IntPtrValue
ldind.i
ret
}
- .method public static native uint UIntPtr() cil managed
+ .method private static native uint UIntPtrImpl() cil managed
{
.maxstack 1
- ldsflda native uint IL2C.ILConverters.Ldsfld_Field::UIntPtrValue
+ ldsflda native uint [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Ldsfld_Field::UIntPtrValue
ldind.i
ret
}
@@ -99,7 +99,7 @@
.method public static float32 Single() cil managed
{
.maxstack 1
- ldsflda float32 IL2C.ILConverters.Ldsfld_Field::SingleValue
+ ldsflda float32 [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Ldsfld_Field::SingleValue
ldind.r4
ret
}
@@ -107,7 +107,7 @@
.method public static float64 Double() cil managed
{
.maxstack 1
- ldsflda float64 IL2C.ILConverters.Ldsfld_Field::DoubleValue
+ ldsflda float64 [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Ldsfld_Field::DoubleValue
ldind.r8
ret
}
@@ -115,7 +115,7 @@
.method public static char Char() cil managed
{
.maxstack 1
- ldsflda char IL2C.ILConverters.Ldsfld_Field::CharValue
+ ldsflda char [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Ldsfld_Field::CharValue
ldind.u2
ret
}
@@ -123,7 +123,7 @@
.method public static string String() cil managed
{
.maxstack 1
- ldsflda string IL2C.ILConverters.Ldsfld_Field::StringValue
+ ldsflda string [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Ldsfld_Field::StringValue
ldind.ref
ret
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Ldstr/Ldstr.cs b/tests/IL2C.Core.Test.ILConverters/Ldstr/Ldstr.cs
index 28e602a7..641229b5 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ldstr/Ldstr.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Ldstr/Ldstr.cs
@@ -12,9 +12,9 @@
namespace IL2C.ILConverters
{
- [TestCase("ABC", "Value")]
public sealed class Ldstr
{
+ [TestCase("ABC", "Value")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string Value();
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Mul/Mul.cs b/tests/IL2C.Core.Test.ILConverters/Mul/Mul.cs
index ed981032..a1034701 100644
--- a/tests/IL2C.Core.Test.ILConverters/Mul/Mul.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Mul/Mul.cs
@@ -12,41 +12,56 @@
namespace IL2C.ILConverters
{
- [TestCase(288, "Int32_Int32", 12, 24)]
- [TestCase(288, "Int32_IntPtr", 12, 24)]
- [TestCase(288L, "Int64_Int64", 12L, 24L)]
- [TestCase(288, "IntPtr_Int32", 12, 24)]
- [TestCase(288, "IntPtr_IntPtr", 12, 24)]
- [TestCase(123.0f * 0.45f, "Single_Single", 123.0f, 0.45f)]
- [TestCase(123.0f * 0.45, "Single_Double", 123.0f, 0.45)]
- [TestCase(123.0 * 0.45f, "Double_Single", 123.0, 0.45f)]
- [TestCase(123.0 * 0.45, "Double_Double", 123.0, 0.45)]
public sealed class Mul
{
+ [TestCase(288, "Int32_Int32", 12, 24)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Int32_Int32(int lhs, int rhs);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr Int32_IntPtr(int lhs, IntPtr rhs);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr Int32_IntPtrImpl(int lhs, IntPtr rhs);
+
+ [TestCase(288, "Int32_IntPtr", 12, 24)]
+ public static int Int32_IntPtr(int lhs, int rhs) =>
+ Int32_IntPtrImpl(lhs, (IntPtr)rhs).ToInt32();
+ [TestCase(288L, "Int64_Int64", 12L, 24L)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern long Int64_Int64(long lhs, long rhs);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr IntPtr_Int32(IntPtr lhs, int rhs);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr IntPtr_Int32Impl(IntPtr lhs, int rhs);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr IntPtr_IntPtr(IntPtr lhs, IntPtr rhs);
+ [TestCase(288, "IntPtr_Int32", 12, 24)]
+ public static int IntPtr_Int32(int lhs, int rhs) =>
+ IntPtr_Int32Impl((IntPtr)lhs, rhs).ToInt32();
+
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr IntPtr_IntPtrImpl(IntPtr lhs, IntPtr rhs);
+
+ [TestCase(288, "IntPtr_IntPtr", 12, 24)]
+ public static int IntPtr_IntPtr(int lhs, int rhs) =>
+ IntPtr_IntPtrImpl((IntPtr)lhs, (IntPtr)rhs).ToInt32();
+ [TestCase(123.0f * 0.45f, "Single_Single", 123.0f, 0.45f)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern float Single_Single(float lhs, float rhs);
+ // TODO: Unknown failure on mono linux x64
+ // Expected: 55.350000000000001d But was: 2.4976903257713897E-315d
+ [TestCase(123.0f * 0.45, "Mul_Single_Double", 123.0f, 0.45,
+ RunOnPlatforms = RunOnPlatforms.DotNet)]
[MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern double Single_Double(float lhs, double rhs);
+ public static extern double Mul_Single_Double(float lhs, double rhs);
+ // TODO: Unknown failure on mono linux x64
+ // Expected: 55.349998533725739d But was: 6.4129862616164714E-313d
+ [TestCase(123.0 * 0.45f, "Mul_Double_Single", 123.0, 0.45f,
+ RunOnPlatforms = RunOnPlatforms.DotNet)]
[MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern double Double_Single(double lhs, float rhs);
+ public static extern double Mul_Double_Single(double lhs, float rhs);
+ [TestCase(123.0 * 0.45, "Double_Double", 123.0, 0.45)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern double Double_Double(double lhs, double rhs);
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Mul/Mul.il b/tests/IL2C.Core.Test.ILConverters/Mul/Mul.il
index e17e0a30..e3950149 100644
--- a/tests/IL2C.Core.Test.ILConverters/Mul/Mul.il
+++ b/tests/IL2C.Core.Test.ILConverters/Mul/Mul.il
@@ -1,83 +1,83 @@
.class public IL2C.ILConverters.Mul
{
- .method public static int32 Int32_Int32(int32 lhs, int32 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- mul
- ret
- }
+ .method public static int32 Int32_Int32(int32 lhs, int32 rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ mul
+ ret
+ }
- .method public static native int Int32_IntPtr(int32 lhs, native int rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- mul
- ret
- }
+ .method private static native int Int32_IntPtrImpl(int32 lhs, native int rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ mul
+ ret
+ }
.method public static int64 Int64_Int64(int64 lhs, int64 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- mul
- ret
- }
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ mul
+ ret
+ }
- .method public static native int IntPtr_Int32(native int lhs, int32 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- mul
- ret
- }
+ .method private static native int IntPtr_Int32Impl(native int lhs, int32 rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ mul
+ ret
+ }
- .method public static native int IntPtr_IntPtr(native int lhs, native int rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- mul
- ret
- }
+ .method private static native int IntPtr_IntPtrImpl(native int lhs, native int rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ mul
+ ret
+ }
- .method public static float32 Single_Single(float32 lhs, float32 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- mul
- ret
- }
+ .method public static float32 Single_Single(float32 lhs, float32 rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ mul
+ ret
+ }
- .method public static float64 Single_Double(float32 lhs, float64 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- mul
- ret
- }
+ .method public static float64 Mul_Single_Double(float32 lhs, float64 rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ mul
+ ret
+ }
- .method public static float64 Double_Single(float64 lhs, float32 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- mul
- ret
- }
+ .method public static float64 Mul_Double_Single(float64 lhs, float32 rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ mul
+ ret
+ }
- .method public static float64 Double_Double(float64 lhs, float64 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- mul
- ret
- }
+ .method public static float64 Double_Double(float64 lhs, float64 rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ mul
+ ret
+ }
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Nop/Nop.cs b/tests/IL2C.Core.Test.ILConverters/Nop/Nop.cs
index 6c307bdb..04f38113 100644
--- a/tests/IL2C.Core.Test.ILConverters/Nop/Nop.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Nop/Nop.cs
@@ -12,9 +12,9 @@
namespace IL2C.ILConverters
{
- [TestCase(123, "Nothing")]
public sealed class Nop
{
+ [TestCase(123, "Nothing")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Nothing();
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Or/Or.cs b/tests/IL2C.Core.Test.ILConverters/Or/Or.cs
index 7dd6d284..75209fcc 100644
--- a/tests/IL2C.Core.Test.ILConverters/Or/Or.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Or/Or.cs
@@ -12,26 +12,35 @@
namespace IL2C.ILConverters
{
- [TestCase(0x12345678 | 0x55555555, "Int32_Int32", 0x12345678, 0x55555555)]
- [TestCase(0x12345678 | 0x55555555, "Int32_IntPtr", 0x12345678, 0x55555555)]
- [TestCase(0x123456789abcdef | 0x55555555aaaaaaaa, "Int64_Int64", 0x123456789abcdef, 0x55555555aaaaaaaa)]
- [TestCase(0x12345678 | 0x55555555, "IntPtr_Int32", 0x12345678, 0x55555555)]
- [TestCase(0x12345678 | 0x55555555, "IntPtr_IntPtr", 0x12345678, 0x55555555)]
public sealed class Or
{
+ [TestCase(0x12345678 | 0x55555555, "Int32_Int32", 0x12345678, 0x55555555)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Int32_Int32(int lhs, int rhs);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr Int32_IntPtr(int lhs, IntPtr rhs);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr Int32_IntPtrImpl(int lhs, IntPtr rhs);
+
+ [TestCase(0x12345678 | 0x55555555, "Int32_IntPtr", 0x12345678, 0x55555555)]
+ public static int Int32_IntPtr(int lhs, int rhs) =>
+ Int32_IntPtrImpl(lhs, (IntPtr)rhs).ToInt32();
+ [TestCase(0x123456789abcdef | 0x55555555aaaaaaaa, "Int64_Int64", 0x123456789abcdef, 0x55555555aaaaaaaa)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern long Int64_Int64(long lhs, long rhs);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr IntPtr_Int32(IntPtr lhs, int rhs);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr IntPtr_Int32Impl(IntPtr lhs, int rhs);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr IntPtr_IntPtr(IntPtr lhs, IntPtr rhs);
+ [TestCase(0x12345678 | 0x55555555, "IntPtr_Int32", 0x12345678, 0x55555555)]
+ public static int IntPtr_Int32(int lhs, int rhs) =>
+ IntPtr_Int32Impl((IntPtr)lhs, rhs).ToInt32();
+
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr IntPtr_IntPtrImpl(IntPtr lhs, IntPtr rhs);
+
+ [TestCase(0x12345678 | 0x55555555, "IntPtr_IntPtr", 0x12345678, 0x55555555)]
+ public static int IntPtr_IntPtr(int lhs, int rhs) =>
+ IntPtr_IntPtrImpl((IntPtr)lhs, (IntPtr)rhs).ToInt32();
}
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Or/Or.il b/tests/IL2C.Core.Test.ILConverters/Or/Or.il
index 5fe4ff01..a68c8cc8 100644
--- a/tests/IL2C.Core.Test.ILConverters/Or/Or.il
+++ b/tests/IL2C.Core.Test.ILConverters/Or/Or.il
@@ -1,47 +1,47 @@
.class public IL2C.ILConverters.Or
{
- .method public static int32 Int32_Int32(int32 lhs, int32 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- or
- ret
- }
+ .method public static int32 Int32_Int32(int32 lhs, int32 rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ or
+ ret
+ }
- .method public static native int Int32_IntPtr(int32 lhs, native int rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- or
- ret
- }
+ .method private static native int Int32_IntPtrImpl(int32 lhs, native int rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ or
+ ret
+ }
.method public static int64 Int64_Int64(int64 lhs, int64 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- or
- ret
- }
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ or
+ ret
+ }
- .method public static native int IntPtr_Int32(native int lhs, int32 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- or
- ret
- }
+ .method private static native int IntPtr_Int32Impl(native int lhs, int32 rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ or
+ ret
+ }
- .method public static native int IntPtr_IntPtr(native int lhs, native int rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- or
- ret
- }
+ .method private static native int IntPtr_IntPtrImpl(native int lhs, native int rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ or
+ ret
+ }
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Properties/AssemblyInfo.cs b/tests/IL2C.Core.Test.ILConverters/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000..9052f96f
--- /dev/null
+++ b/tests/IL2C.Core.Test.ILConverters/Properties/AssemblyInfo.cs
@@ -0,0 +1,12 @@
+////////////////////////////////////////////////////////////////////////////
+//
+// IL2C - A translator for ECMA-335 CIL/MSIL to C language.
+// Copyright (c) Kouji Matsui (@kozy_kekyo, @kekyo@mastodon.cloud)
+//
+// Licensed under Apache-v2: https://opensource.org/licenses/Apache-2.0
+//
+////////////////////////////////////////////////////////////////////////////
+
+using IL2C;
+
+[assembly: SetCulture("en-us")]
diff --git a/tests/IL2C.Core.Test.ILConverters/Rem/Rem.cs b/tests/IL2C.Core.Test.ILConverters/Rem/Rem.cs
index 63e0e733..fdba6958 100644
--- a/tests/IL2C.Core.Test.ILConverters/Rem/Rem.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Rem/Rem.cs
@@ -12,41 +12,50 @@
namespace IL2C.ILConverters
{
- [TestCase(12, "Int32_Int32", 288, 23)]
- [TestCase(12, "Int32_IntPtr", 288, 23)]
- [TestCase(12L, "Int64_Int64", 288L, 23L)]
- [TestCase(12, "IntPtr_Int32", 288, 23)]
- [TestCase(12, "IntPtr_IntPtr", 288, 23)]
- [TestCase(123.0f % 0.45f, "Single_Single", 123.0f, 0.45f)]
- [TestCase(123.0f % 0.45, "Single_Double", 123.0f, 0.45)]
- [TestCase(123.0 % 0.45f, "Double_Single", 123.0, 0.45f)]
- [TestCase(123.0 % 0.45, "Double_Double", 123.0, 0.45)]
public sealed class Rem
{
+ [TestCase(12, "Int32_Int32", 288, 23)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Int32_Int32(int lhs, int rhs);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr Int32_IntPtr(int lhs, IntPtr rhs);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr Int32_IntPtrImpl(int lhs, IntPtr rhs);
+
+ [TestCase(12, "Int32_IntPtr", 288, 23)]
+ public static int Int32_IntPtr(int lhs, int rhs) =>
+ Int32_IntPtrImpl(lhs, (IntPtr)rhs).ToInt32();
+ [TestCase(12L, "Int64_Int64", 288L, 23L)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern long Int64_Int64(long lhs, long rhs);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr IntPtr_Int32(IntPtr lhs, int rhs);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr IntPtr_Int32Impl(IntPtr lhs, int rhs);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr IntPtr_IntPtr(IntPtr lhs, IntPtr rhs);
+ [TestCase(12, "IntPtr_Int32", 288, 23)]
+ public static int IntPtr_Int32(int lhs, int rhs) =>
+ IntPtr_Int32Impl((IntPtr)lhs, rhs).ToInt32();
+
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr IntPtr_IntPtrImpl(IntPtr lhs, IntPtr rhs);
+
+ [TestCase(12, "IntPtr_IntPtr", 288, 23)]
+ public static int IntPtr_IntPtr(int lhs, int rhs) =>
+ IntPtr_IntPtrImpl((IntPtr)lhs, (IntPtr)rhs).ToInt32();
+ [TestCase(123.0f % 0.45f, "Single_Single", 123.0f, 0.45f)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern float Single_Single(float lhs, float rhs);
+ [TestCase(123.0f % 0.45, "Rem_Single_Double", 123.0f, 0.45)]
[MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern double Single_Double(float lhs, double rhs);
+ public static extern double Rem_Single_Double(float lhs, double rhs);
+ [TestCase(123.0 % 0.45f, "Rem_Double_Single", 123.0, 0.45f)]
[MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern double Double_Single(double lhs, float rhs);
+ public static extern double Rem_Double_Single(double lhs, float rhs);
+ [TestCase(123.0 % 0.45, "Double_Double", 123.0, 0.45)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern double Double_Double(double lhs, double rhs);
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Rem/Rem.il b/tests/IL2C.Core.Test.ILConverters/Rem/Rem.il
index d7d79f10..557863d3 100644
--- a/tests/IL2C.Core.Test.ILConverters/Rem/Rem.il
+++ b/tests/IL2C.Core.Test.ILConverters/Rem/Rem.il
@@ -1,83 +1,83 @@
.class public IL2C.ILConverters.Rem
{
- .method public static int32 Int32_Int32(int32 lhs, int32 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- rem
- ret
- }
+ .method public static int32 Int32_Int32(int32 lhs, int32 rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ rem
+ ret
+ }
- .method public static native int Int32_IntPtr(int32 lhs, native int rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- rem
- ret
- }
+ .method private static native int Int32_IntPtrImpl(int32 lhs, native int rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ rem
+ ret
+ }
.method public static int64 Int64_Int64(int64 lhs, int64 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- rem
- ret
- }
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ rem
+ ret
+ }
- .method public static native int IntPtr_Int32(native int lhs, int32 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- rem
- ret
- }
+ .method private static native int IntPtr_Int32Impl(native int lhs, int32 rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ rem
+ ret
+ }
- .method public static native int IntPtr_IntPtr(native int lhs, native int rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- rem
- ret
- }
+ .method private static native int IntPtr_IntPtrImpl(native int lhs, native int rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ rem
+ ret
+ }
- .method public static float32 Single_Single(float32 lhs, float32 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- rem
- ret
- }
+ .method public static float32 Single_Single(float32 lhs, float32 rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ rem
+ ret
+ }
- .method public static float64 Single_Double(float32 lhs, float64 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- rem
- ret
- }
+ .method public static float64 Rem_Single_Double(float32 lhs, float64 rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ rem
+ ret
+ }
- .method public static float64 Double_Single(float64 lhs, float32 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- rem
- ret
- }
+ .method public static float64 Rem_Double_Single(float64 lhs, float32 rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ rem
+ ret
+ }
- .method public static float64 Double_Double(float64 lhs, float64 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- rem
- ret
- }
+ .method public static float64 Double_Double(float64 lhs, float64 rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ rem
+ ret
+ }
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Ret/Ret.cs b/tests/IL2C.Core.Test.ILConverters/Ret/Ret.cs
index 80308640..88251551 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ret/Ret.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Ret/Ret.cs
@@ -12,29 +12,29 @@
namespace IL2C.ILConverters
{
- [TestCase(123, "Int32Value")]
- [TestCase("ABC", "StringValue")]
- [TestCase(null, "NullValue")]
- [TestCase(123, new[] { "RefIntValue", "Return_RefInt" }, true)]
- [TestCase(456, new[] { "RefIntValue", "Return_RefInt" }, false)]
- [TestCase(null, "Void")]
public sealed class Ret
{
+ [TestCase(123, "Int32Value")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Int32Value();
+ [TestCase("ABC", "StringValue")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string StringValue();
+ [TestCase(null, "NullValue", Assert = TestCaseAsserts.PerfectMatch)]
[MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern object NullValue();
+ public static extern object? NullValue();
- [MethodImpl(MethodImplOptions.ForwardRef)]
- private static extern ref int Return_RefInt(ref int a, ref int b, bool select);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern ref int Return_RefInt(ref int a, ref int b, bool select);
+ [TestCase(123, new[] { "RefIntValue", "Return_RefInt" }, true)]
+ [TestCase(456, new[] { "RefIntValue", "Return_RefInt" }, false)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int RefIntValue(bool select);
+ [TestCase(null, "Void")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern void Void();
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Ret/Ret.il b/tests/IL2C.Core.Test.ILConverters/Ret/Ret.il
index cd6f840e..86cf2b26 100644
--- a/tests/IL2C.Core.Test.ILConverters/Ret/Ret.il
+++ b/tests/IL2C.Core.Test.ILConverters/Ret/Ret.il
@@ -1,46 +1,46 @@
.class public IL2C.ILConverters.Ret
{
- .method public static int32 Int32Value() cil managed
- {
- .maxstack 1
- ldc.i4.s 123
- ret
- }
+ .method public static int32 Int32Value() cil managed
+ {
+ .maxstack 1
+ ldc.i4.s 123
+ ret
+ }
- .method public static string StringValue() cil managed
- {
- .maxstack 1
- ldstr "ABC"
- ret
- }
+ .method public static string StringValue() cil managed
+ {
+ .maxstack 1
+ ldstr "ABC"
+ ret
+ }
- .method public static object NullValue() cil managed
- {
- .maxstack 1
- ldnull
- ret
- }
+ .method public static object NullValue() cil managed
+ {
+ .maxstack 1
+ ldnull
+ ret
+ }
- .method private static int32& Return_RefInt(int32& a, int32& b, bool select) cil managed
- {
- .maxstack 1
+ .method public static int32& Return_RefInt(int32& a, int32& b, bool select) cil managed
+ {
+ .maxstack 1
ldarg.2
brfalse.s F1
ldarg.0
- ret
+ ret
F1:
ldarg.1
ret
- }
+ }
- .method public static int32 RefIntValue(bool select) cil managed
- {
- .maxstack 3
+ .method public static int32 RefIntValue(bool select) cil managed
+ {
+ .maxstack 3
.locals init (
[0] int32,
[1] int32
)
- ldc.i4.s 123
+ ldc.i4.s 123
stloc.0
ldc.i4 456
stloc.1
@@ -49,12 +49,12 @@
ldarg.0
call int32& IL2C.ILConverters.Ret::Return_RefInt(int32&, int32&, bool)
ldind.i4
- ret
- }
+ ret
+ }
- .method public static void Void() cil managed
- {
- .maxstack 1
- ret
- }
+ .method public static void Void() cil managed
+ {
+ .maxstack 1
+ ret
+ }
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Stelem/Stelem.cs b/tests/IL2C.Core.Test.ILConverters/Stelem/Stelem.cs
index df29fc7e..5b494a48 100644
--- a/tests/IL2C.Core.Test.ILConverters/Stelem/Stelem.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Stelem/Stelem.cs
@@ -12,50 +12,11 @@
namespace IL2C.ILConverters
{
- [TestCase((byte)123, new[] { "Byte", "ByteInner" }, 0, (byte)123)]
- [TestCase((byte)125, new[] { "Byte", "ByteInner" }, 1, (byte)125)]
- [TestCase((byte)127, new[] { "Byte", "ByteInner" }, 2, (byte)127)]
- [TestCase((byte)123, new[] { "ByteIntPtrIndex", "ByteIntPtrIndexInner" }, 0, (byte)123)]
- [TestCase((byte)125, new[] { "ByteIntPtrIndex", "ByteIntPtrIndexInner" }, 1, (byte)125)]
- [TestCase((byte)127, new[] { "ByteIntPtrIndex", "ByteIntPtrIndexInner" }, 2, (byte)127)]
- [TestCase((short)123, new[] { "Int16", "Int16Inner" }, 0, (short)123)]
- [TestCase((short)456, new[] { "Int16", "Int16Inner" }, 1, (short)456)]
- [TestCase((short)789, new[] { "Int16", "Int16Inner" }, 2, (short)789)]
- [TestCase((short)123, new[] { "Int16IntPtrIndex", "Int16IntPtrIndexInner" }, 0, (short)123)]
- [TestCase((short)456, new[] { "Int16IntPtrIndex", "Int16IntPtrIndexInner" }, 1, (short)456)]
- [TestCase((short)789, new[] { "Int16IntPtrIndex", "Int16IntPtrIndexInner" }, 2, (short)789)]
- [TestCase(123, new[] { "Int32", "Int32Inner" }, 0, 123)]
- [TestCase(456, new[] { "Int32", "Int32Inner" }, 1, 456)]
- [TestCase(789, new[] { "Int32", "Int32Inner" }, 2, 789)]
- [TestCase(123, new[] { "Int32IntPtrIndex", "Int32IntPtrIndexInner" }, 0, 123)]
- [TestCase(456, new[] { "Int32IntPtrIndex", "Int32IntPtrIndexInner" }, 1, 456)]
- [TestCase(789, new[] { "Int32IntPtrIndex", "Int32IntPtrIndexInner" }, 2, 789)]
- [TestCase(123L, new[] { "Int64", "Int64Inner" }, 0, 123L)]
- [TestCase(456L, new[] { "Int64", "Int64Inner" }, 1, 456L)]
- [TestCase(789L, new[] { "Int64", "Int64Inner" }, 2, 789L)]
- [TestCase(123L, new[] { "Int64IntPtrIndex", "Int64IntPtrIndexInner" }, 0, 123L)]
- [TestCase(456L, new[] { "Int64IntPtrIndex", "Int64IntPtrIndexInner" }, 1, 456L)]
- [TestCase(789L, new[] { "Int64IntPtrIndex", "Int64IntPtrIndexInner" }, 2, 789L)]
- [TestCase(123f, new[] { "Single", "SingleInner" }, 0, 123f)]
- [TestCase(456f, new[] { "Single", "SingleInner" }, 1, 456f)]
- [TestCase(789f, new[] { "Single", "SingleInner" }, 2, 789f)]
- [TestCase(123f, new[] { "SingleIntPtrIndex", "SingleIntPtrIndexInner" }, 0, 123f)]
- [TestCase(456f, new[] { "SingleIntPtrIndex", "SingleIntPtrIndexInner" }, 1, 456f)]
- [TestCase(789f, new[] { "SingleIntPtrIndex", "SingleIntPtrIndexInner" }, 2, 789f)]
- [TestCase(123.111, new[] { "Double", "DoubleInner" }, 0, 123.111)]
- [TestCase(456.222, new[] { "Double", "DoubleInner" }, 1, 456.222)]
- [TestCase(789.333, new[] { "Double", "DoubleInner" }, 2, 789.333)]
- [TestCase(123.111, new[] { "DoubleIntPtrIndex", "DoubleIntPtrIndexInner" }, 0, 123.111)]
- [TestCase(456.222, new[] { "DoubleIntPtrIndex", "DoubleIntPtrIndexInner" }, 1, 456.222)]
- [TestCase(789.333, new[] { "DoubleIntPtrIndex", "DoubleIntPtrIndexInner" }, 2, 789.333)]
- [TestCase("123", new[] { "Object", "ObjectInner" }, 0, "123")]
- [TestCase("456", new[] { "Object", "ObjectInner" }, 1, "456")]
- [TestCase("789", new[] { "Object", "ObjectInner" }, 2, "789")]
- [TestCase("123", new[] { "ObjectIntPtrIndex", "ObjectIntPtrIndexInner" }, 0, "123")]
- [TestCase("456", new[] { "ObjectIntPtrIndex", "ObjectIntPtrIndexInner" }, 1, "456")]
- [TestCase("789", new[] { "ObjectIntPtrIndex", "ObjectIntPtrIndexInner" }, 2, "789")]
public sealed class Stelem
{
+ [TestCase((byte)123, new[] { "Byte", "ByteInner" }, 0, (byte)123)]
+ [TestCase((byte)125, new[] { "Byte", "ByteInner" }, 1, (byte)125)]
+ [TestCase((byte)127, new[] { "Byte", "ByteInner" }, 2, (byte)127)]
public static byte Byte(int index, byte value)
{
var values = new byte[] { 1, 2, 3 };
@@ -66,6 +27,9 @@ public static byte Byte(int index, byte value)
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern void ByteInner(byte[] values, int index, byte value);
+ [TestCase((byte)123, new[] { "ByteIntPtrIndex", "ByteIntPtrIndexInner" }, 0, (byte)123)]
+ [TestCase((byte)125, new[] { "ByteIntPtrIndex", "ByteIntPtrIndexInner" }, 1, (byte)125)]
+ [TestCase((byte)127, new[] { "ByteIntPtrIndex", "ByteIntPtrIndexInner" }, 2, (byte)127)]
public static byte ByteIntPtrIndex(int index, byte value)
{
var values = new byte[] { 1, 2, 3 };
@@ -78,6 +42,9 @@ public static byte ByteIntPtrIndex(int index, byte value)
//////////////////////////////////////////////////////////////////////
+ [TestCase((short)123, new[] { "Int16", "Int16Inner" }, 0, (short)123)]
+ [TestCase((short)456, new[] { "Int16", "Int16Inner" }, 1, (short)456)]
+ [TestCase((short)789, new[] { "Int16", "Int16Inner" }, 2, (short)789)]
public static short Int16(int index, short value)
{
var values = new short[] { 1, 2, 3 };
@@ -88,6 +55,9 @@ public static short Int16(int index, short value)
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern void Int16Inner(short[] values, int index, short value);
+ [TestCase((short)123, new[] { "Int16IntPtrIndex", "Int16IntPtrIndexInner" }, 0, (short)123)]
+ [TestCase((short)456, new[] { "Int16IntPtrIndex", "Int16IntPtrIndexInner" }, 1, (short)456)]
+ [TestCase((short)789, new[] { "Int16IntPtrIndex", "Int16IntPtrIndexInner" }, 2, (short)789)]
public static short Int16IntPtrIndex(int index, short value)
{
var values = new short[] { 1, 2, 3 };
@@ -100,6 +70,9 @@ public static short Int16IntPtrIndex(int index, short value)
//////////////////////////////////////////////////////////////////////
+ [TestCase(123, new[] { "Int32", "Int32Inner" }, 0, 123)]
+ [TestCase(456, new[] { "Int32", "Int32Inner" }, 1, 456)]
+ [TestCase(789, new[] { "Int32", "Int32Inner" }, 2, 789)]
public static int Int32(int index, int value)
{
var values = new[] { 1, 2, 3 };
@@ -110,6 +83,9 @@ public static int Int32(int index, int value)
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern void Int32Inner(int[] values, int index, int value);
+ [TestCase(123, new[] { "Int32IntPtrIndex", "Int32IntPtrIndexInner" }, 0, 123)]
+ [TestCase(456, new[] { "Int32IntPtrIndex", "Int32IntPtrIndexInner" }, 1, 456)]
+ [TestCase(789, new[] { "Int32IntPtrIndex", "Int32IntPtrIndexInner" }, 2, 789)]
public static int Int32IntPtrIndex(int index, int value)
{
var values = new[] { 1, 2, 3 };
@@ -122,6 +98,9 @@ public static int Int32IntPtrIndex(int index, int value)
//////////////////////////////////////////////////////////////////////
+ [TestCase(123L, new[] { "Int64", "Int64Inner" }, 0, 123L)]
+ [TestCase(456L, new[] { "Int64", "Int64Inner" }, 1, 456L)]
+ [TestCase(789L, new[] { "Int64", "Int64Inner" }, 2, 789L)]
public static long Int64(int index, long value)
{
var values = new long[] { 1, 2, 3 };
@@ -132,6 +111,9 @@ public static long Int64(int index, long value)
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern void Int64Inner(long[] values, int index, long value);
+ [TestCase(123L, new[] { "Int64IntPtrIndex", "Int64IntPtrIndexInner" }, 0, 123L)]
+ [TestCase(456L, new[] { "Int64IntPtrIndex", "Int64IntPtrIndexInner" }, 1, 456L)]
+ [TestCase(789L, new[] { "Int64IntPtrIndex", "Int64IntPtrIndexInner" }, 2, 789L)]
public static long Int64IntPtrIndex(int index, long value)
{
var values = new long[] { 1, 2, 3 };
@@ -144,6 +126,9 @@ public static long Int64IntPtrIndex(int index, long value)
//////////////////////////////////////////////////////////////////////
+ [TestCase(123f, new[] { "Single", "SingleInner" }, 0, 123f)]
+ [TestCase(456f, new[] { "Single", "SingleInner" }, 1, 456f)]
+ [TestCase(789f, new[] { "Single", "SingleInner" }, 2, 789f)]
public static float Single(int index, float value)
{
var values = new[] { 1f, 2f, 3f };
@@ -154,6 +139,9 @@ public static float Single(int index, float value)
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern void SingleInner(float[] values, int index, float value);
+ [TestCase(123f, new[] { "SingleIntPtrIndex", "SingleIntPtrIndexInner" }, 0, 123f)]
+ [TestCase(456f, new[] { "SingleIntPtrIndex", "SingleIntPtrIndexInner" }, 1, 456f)]
+ [TestCase(789f, new[] { "SingleIntPtrIndex", "SingleIntPtrIndexInner" }, 2, 789f)]
public static float SingleIntPtrIndex(int index, float value)
{
var values = new[] { 1f, 2f, 3f };
@@ -166,6 +154,9 @@ public static float SingleIntPtrIndex(int index, float value)
//////////////////////////////////////////////////////////////////////
+ [TestCase(123.111, new[] { "Double", "DoubleInner" }, 0, 123.111)]
+ [TestCase(456.222, new[] { "Double", "DoubleInner" }, 1, 456.222)]
+ [TestCase(789.333, new[] { "Double", "DoubleInner" }, 2, 789.333)]
public static double Double(int index, double value)
{
var values = new double[] { 1, 2, 3 };
@@ -176,6 +167,9 @@ public static double Double(int index, double value)
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern void DoubleInner(double[] values, int index, double value);
+ [TestCase(123.111, new[] { "DoubleIntPtrIndex", "DoubleIntPtrIndexInner" }, 0, 123.111)]
+ [TestCase(456.222, new[] { "DoubleIntPtrIndex", "DoubleIntPtrIndexInner" }, 1, 456.222)]
+ [TestCase(789.333, new[] { "DoubleIntPtrIndex", "DoubleIntPtrIndexInner" }, 2, 789.333)]
public static double DoubleIntPtrIndex(int index, double value)
{
var values = new double[] { 1, 2, 3 };
@@ -188,6 +182,9 @@ public static double DoubleIntPtrIndex(int index, double value)
//////////////////////////////////////////////////////////////////////
+ [TestCase("123", new[] { "Object", "ObjectInner" }, 0, "123")]
+ [TestCase("456", new[] { "Object", "ObjectInner" }, 1, "456")]
+ [TestCase("789", new[] { "Object", "ObjectInner" }, 2, "789")]
public static string Object(int index, string value)
{
var values = new[] { "1", "2", "3" };
@@ -198,6 +195,9 @@ public static string Object(int index, string value)
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern void ObjectInner(string[] values, int index, string value);
+ [TestCase("123", new[] { "ObjectIntPtrIndex", "ObjectIntPtrIndexInner" }, 0, "123")]
+ [TestCase("456", new[] { "ObjectIntPtrIndex", "ObjectIntPtrIndexInner" }, 1, "456")]
+ [TestCase("789", new[] { "ObjectIntPtrIndex", "ObjectIntPtrIndexInner" }, 2, "789")]
public static string ObjectIntPtrIndex(int index, string value)
{
var values = new[] { "1", "2", "3" };
diff --git a/tests/IL2C.Core.Test.ILConverters/Stelem_i1/Stelem_i1.cs b/tests/IL2C.Core.Test.ILConverters/Stelem_i1/Stelem_i1.cs
index a4728600..f8324eb4 100644
--- a/tests/IL2C.Core.Test.ILConverters/Stelem_i1/Stelem_i1.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Stelem_i1/Stelem_i1.cs
@@ -12,14 +12,11 @@
namespace IL2C.ILConverters
{
- [TestCase((byte)123, new[] { "Byte", "ByteInner" }, 0, (byte)123)]
- [TestCase((byte)125, new[] { "Byte", "ByteInner" }, 1, (byte)125)]
- [TestCase((byte)127, new[] { "Byte", "ByteInner" }, 2, (byte)127)]
- [TestCase((byte)123, new[] { "ByteIntPtrIndex", "ByteIntPtrIndexInner" }, 0, (byte)123)]
- [TestCase((byte)125, new[] { "ByteIntPtrIndex", "ByteIntPtrIndexInner" }, 1, (byte)125)]
- [TestCase((byte)127, new[] { "ByteIntPtrIndex", "ByteIntPtrIndexInner" }, 2, (byte)127)]
public sealed class Stelem_i1
{
+ [TestCase((byte)123, new[] { "Byte", "ByteInner" }, 0, (byte)123)]
+ [TestCase((byte)125, new[] { "Byte", "ByteInner" }, 1, (byte)125)]
+ [TestCase((byte)127, new[] { "Byte", "ByteInner" }, 2, (byte)127)]
public static byte Byte(int index, byte value)
{
var values = new byte[] { 1, 2, 3 };
@@ -30,6 +27,9 @@ public static byte Byte(int index, byte value)
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern void ByteInner(byte[] values, int index, byte value);
+ [TestCase((byte)123, new[] { "ByteIntPtrIndex", "ByteIntPtrIndexInner" }, 0, (byte)123)]
+ [TestCase((byte)125, new[] { "ByteIntPtrIndex", "ByteIntPtrIndexInner" }, 1, (byte)125)]
+ [TestCase((byte)127, new[] { "ByteIntPtrIndex", "ByteIntPtrIndexInner" }, 2, (byte)127)]
public static byte ByteIntPtrIndex(int index, byte value)
{
var values = new byte[] { 1, 2, 3 };
diff --git a/tests/IL2C.Core.Test.ILConverters/Stelem_i2/Stelem_i2.cs b/tests/IL2C.Core.Test.ILConverters/Stelem_i2/Stelem_i2.cs
index 42013e94..87d610ec 100644
--- a/tests/IL2C.Core.Test.ILConverters/Stelem_i2/Stelem_i2.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Stelem_i2/Stelem_i2.cs
@@ -12,14 +12,11 @@
namespace IL2C.ILConverters
{
- [TestCase((short)123, new[] { "Int16", "Int16Inner" }, 0, (short)123)]
- [TestCase((short)456, new[] { "Int16", "Int16Inner" }, 1, (short)456)]
- [TestCase((short)789, new[] { "Int16", "Int16Inner" }, 2, (short)789)]
- [TestCase((short)123, new[] { "Int16IntPtrIndex", "Int16IntPtrIndexInner" }, 0, (short)123)]
- [TestCase((short)456, new[] { "Int16IntPtrIndex", "Int16IntPtrIndexInner" }, 1, (short)456)]
- [TestCase((short)789, new[] { "Int16IntPtrIndex", "Int16IntPtrIndexInner" }, 2, (short)789)]
public sealed class Stelem_i2
{
+ [TestCase((short)123, new[] { "Int16", "Int16Inner" }, 0, (short)123)]
+ [TestCase((short)456, new[] { "Int16", "Int16Inner" }, 1, (short)456)]
+ [TestCase((short)789, new[] { "Int16", "Int16Inner" }, 2, (short)789)]
public static short Int16(int index, short value)
{
var values = new short[] { 1, 2, 3 };
@@ -30,6 +27,9 @@ public static short Int16(int index, short value)
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern void Int16Inner(short[] values, int index, short value);
+ [TestCase((short)123, new[] { "Int16IntPtrIndex", "Int16IntPtrIndexInner" }, 0, (short)123)]
+ [TestCase((short)456, new[] { "Int16IntPtrIndex", "Int16IntPtrIndexInner" }, 1, (short)456)]
+ [TestCase((short)789, new[] { "Int16IntPtrIndex", "Int16IntPtrIndexInner" }, 2, (short)789)]
public static short Int16IntPtrIndex(int index, short value)
{
var values = new short[] { 1, 2, 3 };
diff --git a/tests/IL2C.Core.Test.ILConverters/Stelem_i4/Stelem_i4.cs b/tests/IL2C.Core.Test.ILConverters/Stelem_i4/Stelem_i4.cs
index b8f00935..b7846173 100644
--- a/tests/IL2C.Core.Test.ILConverters/Stelem_i4/Stelem_i4.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Stelem_i4/Stelem_i4.cs
@@ -12,14 +12,11 @@
namespace IL2C.ILConverters
{
- [TestCase(123, new[] { "Int32", "Int32Inner" }, 0, 123)]
- [TestCase(456, new[] { "Int32", "Int32Inner" }, 1, 456)]
- [TestCase(789, new[] { "Int32", "Int32Inner" }, 2, 789)]
- [TestCase(123, new[] { "Int32IntPtrIndex", "Int32IntPtrIndexInner" }, 0, 123)]
- [TestCase(456, new[] { "Int32IntPtrIndex", "Int32IntPtrIndexInner" }, 1, 456)]
- [TestCase(789, new[] { "Int32IntPtrIndex", "Int32IntPtrIndexInner" }, 2, 789)]
public sealed class Stelem_i4
{
+ [TestCase(123, new[] { "Int32", "Int32Inner" }, 0, 123)]
+ [TestCase(456, new[] { "Int32", "Int32Inner" }, 1, 456)]
+ [TestCase(789, new[] { "Int32", "Int32Inner" }, 2, 789)]
public static int Int32(int index, int value)
{
var values = new[] { 1, 2, 3 };
@@ -30,6 +27,9 @@ public static int Int32(int index, int value)
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern void Int32Inner(int[] values, int index, int value);
+ [TestCase(123, new[] { "Int32IntPtrIndex", "Int32IntPtrIndexInner" }, 0, 123)]
+ [TestCase(456, new[] { "Int32IntPtrIndex", "Int32IntPtrIndexInner" }, 1, 456)]
+ [TestCase(789, new[] { "Int32IntPtrIndex", "Int32IntPtrIndexInner" }, 2, 789)]
public static int Int32IntPtrIndex(int index, int value)
{
var values = new[] { 1, 2, 3 };
diff --git a/tests/IL2C.Core.Test.ILConverters/Stelem_i8/Stelem_i8.cs b/tests/IL2C.Core.Test.ILConverters/Stelem_i8/Stelem_i8.cs
index 77262e13..b9415ddb 100644
--- a/tests/IL2C.Core.Test.ILConverters/Stelem_i8/Stelem_i8.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Stelem_i8/Stelem_i8.cs
@@ -12,14 +12,11 @@
namespace IL2C.ILConverters
{
- [TestCase(123L, new[] { "Int64", "Int64Inner" }, 0, 123L)]
- [TestCase(456L, new[] { "Int64", "Int64Inner" }, 1, 456L)]
- [TestCase(789L, new[] { "Int64", "Int64Inner" }, 2, 789L)]
- [TestCase(123L, new[] { "Int64IntPtrIndex", "Int64IntPtrIndexInner" }, 0, 123L)]
- [TestCase(456L, new[] { "Int64IntPtrIndex", "Int64IntPtrIndexInner" }, 1, 456L)]
- [TestCase(789L, new[] { "Int64IntPtrIndex", "Int64IntPtrIndexInner" }, 2, 789L)]
public sealed class Stelem_i8
{
+ [TestCase(123L, new[] { "Int64", "Int64Inner" }, 0, 123L)]
+ [TestCase(456L, new[] { "Int64", "Int64Inner" }, 1, 456L)]
+ [TestCase(789L, new[] { "Int64", "Int64Inner" }, 2, 789L)]
public static long Int64(int index, long value)
{
var values = new long[] { 1, 2, 3 };
@@ -30,6 +27,9 @@ public static long Int64(int index, long value)
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern void Int64Inner(long[] values, int index, long value);
+ [TestCase(123L, new[] { "Int64IntPtrIndex", "Int64IntPtrIndexInner" }, 0, 123L)]
+ [TestCase(456L, new[] { "Int64IntPtrIndex", "Int64IntPtrIndexInner" }, 1, 456L)]
+ [TestCase(789L, new[] { "Int64IntPtrIndex", "Int64IntPtrIndexInner" }, 2, 789L)]
public static long Int64IntPtrIndex(int index, long value)
{
var values = new long[] { 1, 2, 3 };
diff --git a/tests/IL2C.Core.Test.ILConverters/Stelem_r4/Stelem_r4.cs b/tests/IL2C.Core.Test.ILConverters/Stelem_r4/Stelem_r4.cs
index 18ac6947..4538b387 100644
--- a/tests/IL2C.Core.Test.ILConverters/Stelem_r4/Stelem_r4.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Stelem_r4/Stelem_r4.cs
@@ -12,14 +12,11 @@
namespace IL2C.ILConverters
{
- [TestCase(123f, new[] { "Single", "SingleInner" }, 0, 123f)]
- [TestCase(456f, new[] { "Single", "SingleInner" }, 1, 456f)]
- [TestCase(789f, new[] { "Single", "SingleInner" }, 2, 789f)]
- [TestCase(123f, new[] { "SingleIntPtrIndex", "SingleIntPtrIndexInner" }, 0, 123f)]
- [TestCase(456f, new[] { "SingleIntPtrIndex", "SingleIntPtrIndexInner" }, 1, 456f)]
- [TestCase(789f, new[] { "SingleIntPtrIndex", "SingleIntPtrIndexInner" }, 2, 789f)]
public sealed class Stelem_r4
{
+ [TestCase(123f, new[] { "Single", "SingleInner" }, 0, 123f)]
+ [TestCase(456f, new[] { "Single", "SingleInner" }, 1, 456f)]
+ [TestCase(789f, new[] { "Single", "SingleInner" }, 2, 789f)]
public static float Single(int index, float value)
{
var values = new[] { 1f, 2f, 3f };
@@ -30,6 +27,9 @@ public static float Single(int index, float value)
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern void SingleInner(float[] values, int index, float value);
+ [TestCase(123f, new[] { "SingleIntPtrIndex", "SingleIntPtrIndexInner" }, 0, 123f)]
+ [TestCase(456f, new[] { "SingleIntPtrIndex", "SingleIntPtrIndexInner" }, 1, 456f)]
+ [TestCase(789f, new[] { "SingleIntPtrIndex", "SingleIntPtrIndexInner" }, 2, 789f)]
public static float SingleIntPtrIndex(int index, float value)
{
var values = new[] { 1f, 2f, 3f };
diff --git a/tests/IL2C.Core.Test.ILConverters/Stelem_r8/Stelem_r8.cs b/tests/IL2C.Core.Test.ILConverters/Stelem_r8/Stelem_r8.cs
index 6b769b8d..955ed7dc 100644
--- a/tests/IL2C.Core.Test.ILConverters/Stelem_r8/Stelem_r8.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Stelem_r8/Stelem_r8.cs
@@ -12,14 +12,11 @@
namespace IL2C.ILConverters
{
- [TestCase(123.111, new[] { "Double", "DoubleInner" }, 0, 123.111)]
- [TestCase(456.222, new[] { "Double", "DoubleInner" }, 1, 456.222)]
- [TestCase(789.333, new[] { "Double", "DoubleInner" }, 2, 789.333)]
- [TestCase(123.111, new[] { "DoubleIntPtrIndex", "DoubleIntPtrIndexInner" }, 0, 123.111)]
- [TestCase(456.222, new[] { "DoubleIntPtrIndex", "DoubleIntPtrIndexInner" }, 1, 456.222)]
- [TestCase(789.333, new[] { "DoubleIntPtrIndex", "DoubleIntPtrIndexInner" }, 2, 789.333)]
public sealed class Stelem_r8
{
+ [TestCase(123.111, new[] { "Double", "DoubleInner" }, 0, 123.111)]
+ [TestCase(456.222, new[] { "Double", "DoubleInner" }, 1, 456.222)]
+ [TestCase(789.333, new[] { "Double", "DoubleInner" }, 2, 789.333)]
public static double Double(int index, double value)
{
var values = new double[] { 1, 2, 3 };
@@ -30,6 +27,9 @@ public static double Double(int index, double value)
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern void DoubleInner(double[] values, int index, double value);
+ [TestCase(123.111, new[] { "DoubleIntPtrIndex", "DoubleIntPtrIndexInner" }, 0, 123.111)]
+ [TestCase(456.222, new[] { "DoubleIntPtrIndex", "DoubleIntPtrIndexInner" }, 1, 456.222)]
+ [TestCase(789.333, new[] { "DoubleIntPtrIndex", "DoubleIntPtrIndexInner" }, 2, 789.333)]
public static double DoubleIntPtrIndex(int index, double value)
{
var values = new double[] { 1, 2, 3 };
diff --git a/tests/IL2C.Core.Test.ILConverters/Stelem_ref/Stelem_ref.cs b/tests/IL2C.Core.Test.ILConverters/Stelem_ref/Stelem_ref.cs
index a8c85c9e..4da3f66c 100644
--- a/tests/IL2C.Core.Test.ILConverters/Stelem_ref/Stelem_ref.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Stelem_ref/Stelem_ref.cs
@@ -12,14 +12,11 @@
namespace IL2C.ILConverters
{
- [TestCase("123", new[] { "Object", "ObjectInner" }, 0, "123")]
- [TestCase("456", new[] { "Object", "ObjectInner" }, 1, "456")]
- [TestCase("789", new[] { "Object", "ObjectInner" }, 2, "789")]
- [TestCase("123", new[] { "ObjectIntPtrIndex", "ObjectIntPtrIndexInner" }, 0, "123")]
- [TestCase("456", new[] { "ObjectIntPtrIndex", "ObjectIntPtrIndexInner" }, 1, "456")]
- [TestCase("789", new[] { "ObjectIntPtrIndex", "ObjectIntPtrIndexInner" }, 2, "789")]
public sealed class Stelem_ref
{
+ [TestCase("123", new[] { "Object", "ObjectInner" }, 0, "123")]
+ [TestCase("456", new[] { "Object", "ObjectInner" }, 1, "456")]
+ [TestCase("789", new[] { "Object", "ObjectInner" }, 2, "789")]
public static string Object(int index, string value)
{
var values = new[] { "1", "2", "3" };
@@ -30,6 +27,9 @@ public static string Object(int index, string value)
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern void ObjectInner(string[] values, int index, string value);
+ [TestCase("123", new[] { "ObjectIntPtrIndex", "ObjectIntPtrIndexInner" }, 0, "123")]
+ [TestCase("456", new[] { "ObjectIntPtrIndex", "ObjectIntPtrIndexInner" }, 1, "456")]
+ [TestCase("789", new[] { "ObjectIntPtrIndex", "ObjectIntPtrIndexInner" }, 2, "789")]
public static string ObjectIntPtrIndex(int index, string value)
{
var values = new[] { "1", "2", "3" };
diff --git a/tests/IL2C.Core.Test.ILConverters/Stloc_0/Stloc_0.cs b/tests/IL2C.Core.Test.ILConverters/Stloc_0/Stloc_0.cs
index 66631641..b9532970 100644
--- a/tests/IL2C.Core.Test.ILConverters/Stloc_0/Stloc_0.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Stloc_0/Stloc_0.cs
@@ -12,69 +12,75 @@
namespace IL2C.ILConverters
{
- [TestCase(true, "True")]
- [TestCase(false, "False")]
- [TestCase(byte.MaxValue, "Byte")]
- [TestCase(short.MaxValue, "Int16")]
- [TestCase(int.MaxValue, "Int32")]
- [TestCase(long.MaxValue, "Int64")]
- [TestCase(sbyte.MaxValue, "SByte")]
- [TestCase(ushort.MaxValue, "UInt16")]
- [TestCase(uint.MaxValue, "UInt32")]
- [TestCase(ulong.MaxValue, "UInt64")]
- [TestCase(int.MaxValue, "IntPtr")]
- [TestCase(uint.MaxValue, "UIntPtr")]
- [TestCase(3.14159274f, "Single")]
- [TestCase(3.1415926535897931, "Double")]
- [TestCase('A', "Char")]
- [TestCase("ABC", "String")]
public sealed class Stloc_0
{
+ [TestCase(true, "True")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool True();
+ [TestCase(false, "False")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool False();
+ [TestCase(byte.MaxValue, "Byte")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern byte Byte();
+ [TestCase(short.MaxValue, "Int16")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern short Int16();
+ [TestCase(int.MaxValue, "Int32")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Int32();
+ [TestCase(long.MaxValue, "Int64")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern long Int64();
+ [TestCase(sbyte.MaxValue, "SByte")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern sbyte SByte();
+ [TestCase(ushort.MaxValue, "UInt16")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ushort UInt16();
+ [TestCase(uint.MaxValue, "UInt32")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern uint UInt32();
+ [TestCase(ulong.MaxValue, "UInt64")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ulong UInt64();
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr IntPtr();
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr IntPtrImpl();
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern UIntPtr UIntPtr();
+ [TestCase(int.MaxValue, "IntPtr")]
+ public static int IntPtr() =>
+ IntPtrImpl().ToInt32();
+
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern UIntPtr UIntPtrImpl();
+
+ [TestCase(uint.MaxValue, "UIntPtr")]
+ public static uint UIntPtr() =>
+ UIntPtrImpl().ToUInt32();
+ [TestCase(3.14159274f, "Single")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern float Single();
+ [TestCase(3.1415926535897931, "Double")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern double Double();
+ [TestCase('A', "Char")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern char Char();
+ [TestCase("ABC", "String")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string String();
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Stloc_0/Stloc_0.il b/tests/IL2C.Core.Test.ILConverters/Stloc_0/Stloc_0.il
index 213076b8..f3adb8bd 100644
--- a/tests/IL2C.Core.Test.ILConverters/Stloc_0/Stloc_0.il
+++ b/tests/IL2C.Core.Test.ILConverters/Stloc_0/Stloc_0.il
@@ -122,7 +122,7 @@
ret
}
- .method public static native int IntPtr() cil managed
+ .method private static native int IntPtrImpl() cil managed
{
.maxstack 1
.locals init (
@@ -135,7 +135,7 @@
ret
}
- .method public static native uint UIntPtr() cil managed
+ .method private static native uint UIntPtrImpl() cil managed
{
.maxstack 1
.locals init (
diff --git a/tests/IL2C.Core.Test.ILConverters/Stloc_1/Stloc_1.cs b/tests/IL2C.Core.Test.ILConverters/Stloc_1/Stloc_1.cs
index 9d1585f9..786ec5f3 100644
--- a/tests/IL2C.Core.Test.ILConverters/Stloc_1/Stloc_1.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Stloc_1/Stloc_1.cs
@@ -12,69 +12,75 @@
namespace IL2C.ILConverters
{
- [TestCase(true, "True")]
- [TestCase(false, "False")]
- [TestCase(byte.MaxValue, "Byte")]
- [TestCase(short.MaxValue, "Int16")]
- [TestCase(int.MaxValue, "Int32")]
- [TestCase(long.MaxValue, "Int64")]
- [TestCase(sbyte.MaxValue, "SByte")]
- [TestCase(ushort.MaxValue, "UInt16")]
- [TestCase(uint.MaxValue, "UInt32")]
- [TestCase(ulong.MaxValue, "UInt64")]
- [TestCase(int.MaxValue, "IntPtr")]
- [TestCase(uint.MaxValue, "UIntPtr")]
- [TestCase(3.14159274f, "Single")]
- [TestCase(3.1415926535897931, "Double")]
- [TestCase('A', "Char")]
- [TestCase("ABC", "String")]
public sealed class Stloc_1
{
+ [TestCase(true, "True")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool True();
+ [TestCase(false, "False")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool False();
+ [TestCase(byte.MaxValue, "Byte")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern byte Byte();
+ [TestCase(short.MaxValue, "Int16")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern short Int16();
+ [TestCase(int.MaxValue, "Int32")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Int32();
+ [TestCase(long.MaxValue, "Int64")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern long Int64();
+ [TestCase(sbyte.MaxValue, "SByte")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern sbyte SByte();
+ [TestCase(ushort.MaxValue, "UInt16")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ushort UInt16();
+ [TestCase(uint.MaxValue, "UInt32")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern uint UInt32();
+ [TestCase(ulong.MaxValue, "UInt64")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ulong UInt64();
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr IntPtr();
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr IntPtrImpl();
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern UIntPtr UIntPtr();
+ [TestCase(int.MaxValue, "IntPtr")]
+ public static int IntPtr() =>
+ IntPtrImpl().ToInt32();
+
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern UIntPtr UIntPtrImpl();
+
+ [TestCase(uint.MaxValue, "UIntPtr")]
+ public static uint UIntPtr() =>
+ UIntPtrImpl().ToUInt32();
+ [TestCase(3.14159274f, "Single")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern float Single();
+ [TestCase(3.1415926535897931, "Double")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern double Double();
+ [TestCase('A', "Char")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern char Char();
+ [TestCase("ABC", "String")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string String();
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Stloc_1/Stloc_1.il b/tests/IL2C.Core.Test.ILConverters/Stloc_1/Stloc_1.il
index 9005ae59..136eb52e 100644
--- a/tests/IL2C.Core.Test.ILConverters/Stloc_1/Stloc_1.il
+++ b/tests/IL2C.Core.Test.ILConverters/Stloc_1/Stloc_1.il
@@ -132,7 +132,7 @@
ret
}
- .method public static native int IntPtr() cil managed
+ .method private static native int IntPtrImpl() cil managed
{
.maxstack 1
.locals init (
@@ -146,7 +146,7 @@
ret
}
- .method public static native uint UIntPtr() cil managed
+ .method private static native uint UIntPtrImpl() cil managed
{
.maxstack 1
.locals init (
diff --git a/tests/IL2C.Core.Test.ILConverters/Stloc_2/Stloc_2.cs b/tests/IL2C.Core.Test.ILConverters/Stloc_2/Stloc_2.cs
index e43373b6..9a05d8a2 100644
--- a/tests/IL2C.Core.Test.ILConverters/Stloc_2/Stloc_2.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Stloc_2/Stloc_2.cs
@@ -12,69 +12,75 @@
namespace IL2C.ILConverters
{
- [TestCase(true, "True")]
- [TestCase(false, "False")]
- [TestCase(byte.MaxValue, "Byte")]
- [TestCase(short.MaxValue, "Int16")]
- [TestCase(int.MaxValue, "Int32")]
- [TestCase(long.MaxValue, "Int64")]
- [TestCase(sbyte.MaxValue, "SByte")]
- [TestCase(ushort.MaxValue, "UInt16")]
- [TestCase(uint.MaxValue, "UInt32")]
- [TestCase(ulong.MaxValue, "UInt64")]
- [TestCase(int.MaxValue, "IntPtr")]
- [TestCase(uint.MaxValue, "UIntPtr")]
- [TestCase(3.14159274f, "Single")]
- [TestCase(3.1415926535897931, "Double")]
- [TestCase('A', "Char")]
- [TestCase("ABC", "String")]
public sealed class Stloc_2
{
+ [TestCase(true, "True")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool True();
+ [TestCase(false, "False")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool False();
+ [TestCase(byte.MaxValue, "Byte")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern byte Byte();
+ [TestCase(short.MaxValue, "Int16")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern short Int16();
+ [TestCase(int.MaxValue, "Int32")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Int32();
+ [TestCase(long.MaxValue, "Int64")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern long Int64();
+ [TestCase(sbyte.MaxValue, "SByte")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern sbyte SByte();
+ [TestCase(ushort.MaxValue, "UInt16")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ushort UInt16();
+ [TestCase(uint.MaxValue, "UInt32")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern uint UInt32();
+ [TestCase(ulong.MaxValue, "UInt64")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ulong UInt64();
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr IntPtr();
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ public static extern IntPtr IntPtrImpl();
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern UIntPtr UIntPtr();
+ [TestCase(int.MaxValue, "IntPtr")]
+ public static int IntPtr() =>
+ IntPtrImpl().ToInt32();
+
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ public static extern UIntPtr UIntPtrImpl();
+
+ [TestCase(uint.MaxValue, "UIntPtr")]
+ public static uint UIntPtr() =>
+ UIntPtrImpl().ToUInt32();
+ [TestCase(3.14159274f, "Single")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern float Single();
+ [TestCase(3.1415926535897931, "Double")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern double Double();
+ [TestCase('A', "Char")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern char Char();
+ [TestCase("ABC", "String")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string String();
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Stloc_2/Stloc_2.il b/tests/IL2C.Core.Test.ILConverters/Stloc_2/Stloc_2.il
index 91e446ed..eeb94056 100644
--- a/tests/IL2C.Core.Test.ILConverters/Stloc_2/Stloc_2.il
+++ b/tests/IL2C.Core.Test.ILConverters/Stloc_2/Stloc_2.il
@@ -142,7 +142,7 @@
ret
}
- .method public static native int IntPtr() cil managed
+ .method private static native int IntPtrImpl() cil managed
{
.maxstack 1
.locals init (
@@ -157,7 +157,7 @@
ret
}
- .method public static native uint UIntPtr() cil managed
+ .method private static native uint UIntPtrImpl() cil managed
{
.maxstack 1
.locals init (
diff --git a/tests/IL2C.Core.Test.ILConverters/Stloc_3/Stloc_3.cs b/tests/IL2C.Core.Test.ILConverters/Stloc_3/Stloc_3.cs
index 2e29578c..f0ad5562 100644
--- a/tests/IL2C.Core.Test.ILConverters/Stloc_3/Stloc_3.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Stloc_3/Stloc_3.cs
@@ -12,69 +12,75 @@
namespace IL2C.ILConverters
{
- [TestCase(true, "True")]
- [TestCase(false, "False")]
- [TestCase(byte.MaxValue, "Byte")]
- [TestCase(short.MaxValue, "Int16")]
- [TestCase(int.MaxValue, "Int32")]
- [TestCase(long.MaxValue, "Int64")]
- [TestCase(sbyte.MaxValue, "SByte")]
- [TestCase(ushort.MaxValue, "UInt16")]
- [TestCase(uint.MaxValue, "UInt32")]
- [TestCase(ulong.MaxValue, "UInt64")]
- [TestCase(int.MaxValue, "IntPtr")]
- [TestCase(uint.MaxValue, "UIntPtr")]
- [TestCase(3.14159274f, "Single")]
- [TestCase(3.1415926535897931, "Double")]
- [TestCase('A', "Char")]
- [TestCase("ABC", "String")]
public sealed class Stloc_3
{
+ [TestCase(true, "True")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool True();
+ [TestCase(false, "False")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool False();
+ [TestCase(byte.MaxValue, "Byte")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern byte Byte();
+ [TestCase(short.MaxValue, "Int16")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern short Int16();
+ [TestCase(int.MaxValue, "Int32")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Int32();
+ [TestCase(long.MaxValue, "Int64")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern long Int64();
+ [TestCase(sbyte.MaxValue, "SByte")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern sbyte SByte();
+ [TestCase(ushort.MaxValue, "UInt16")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ushort UInt16();
+ [TestCase(uint.MaxValue, "UInt32")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern uint UInt32();
+ [TestCase(ulong.MaxValue, "UInt64")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ulong UInt64();
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr IntPtr();
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr IntPtrImpl();
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern UIntPtr UIntPtr();
+ [TestCase(int.MaxValue, "IntPtr")]
+ public static int IntPtr() =>
+ IntPtrImpl().ToInt32();
+
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern UIntPtr UIntPtrImpl();
+
+ [TestCase(uint.MaxValue, "UIntPtr")]
+ public static uint UIntPtr() =>
+ UIntPtrImpl().ToUInt32();
+ [TestCase(3.14159274f, "Single")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern float Single();
+ [TestCase(3.1415926535897931, "Double")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern double Double();
+ [TestCase('A', "Char")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern char Char();
+ [TestCase("ABC", "String")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string String();
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Stloc_3/Stloc_3.il b/tests/IL2C.Core.Test.ILConverters/Stloc_3/Stloc_3.il
index 4827baea..8083bd72 100644
--- a/tests/IL2C.Core.Test.ILConverters/Stloc_3/Stloc_3.il
+++ b/tests/IL2C.Core.Test.ILConverters/Stloc_3/Stloc_3.il
@@ -152,7 +152,7 @@
ret
}
- .method public static native int IntPtr() cil managed
+ .method private static native int IntPtrImpl() cil managed
{
.maxstack 1
.locals init (
@@ -168,7 +168,7 @@
ret
}
- .method public static native uint UIntPtr() cil managed
+ .method private static native uint UIntPtrImpl() cil managed
{
.maxstack 1
.locals init (
diff --git a/tests/IL2C.Core.Test.ILConverters/Stloc_s/Stloc_s.cs b/tests/IL2C.Core.Test.ILConverters/Stloc_s/Stloc_s.cs
index 7ce9e9c1..c9c34a8b 100644
--- a/tests/IL2C.Core.Test.ILConverters/Stloc_s/Stloc_s.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Stloc_s/Stloc_s.cs
@@ -12,73 +12,79 @@
namespace IL2C.ILConverters
{
- [TestCase(true, "True")]
- [TestCase(false, "False")]
- [TestCase(byte.MaxValue, "Byte")]
- [TestCase(short.MaxValue, "Int16")]
- [TestCase(int.MaxValue, "Int32")]
- [TestCase(long.MaxValue, "Int64")]
- [TestCase(sbyte.MaxValue, "SByte")]
- [TestCase(ushort.MaxValue, "UInt16")]
- [TestCase(uint.MaxValue, "UInt32")]
- [TestCase(ulong.MaxValue, "UInt64")]
- [TestCase(int.MaxValue, "IntPtr")]
- [TestCase(uint.MaxValue, "UIntPtr")]
- [TestCase(3.14159274f, "Single")]
- [TestCase(3.1415926535897931, "Double")]
- [TestCase('A', "Char")]
- [TestCase("ABC", "String")]
- [TestCase("ABC", "LocalVariable_255")]
public sealed class Stloc_s
{
+ [TestCase(true, "True")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool True();
+ [TestCase(false, "False")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool False();
+ [TestCase(byte.MaxValue, "Byte")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern byte Byte();
+ [TestCase(short.MaxValue, "Int16")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern short Int16();
+ [TestCase(int.MaxValue, "Int32")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Int32();
+ [TestCase(long.MaxValue, "Int64")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern long Int64();
+ [TestCase(sbyte.MaxValue, "SByte")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern sbyte SByte();
+ [TestCase(ushort.MaxValue, "UInt16")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ushort UInt16();
+ [TestCase(uint.MaxValue, "UInt32")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern uint UInt32();
+ [TestCase(ulong.MaxValue, "UInt64")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ulong UInt64();
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr IntPtr();
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr IntPtrImpl();
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern UIntPtr UIntPtr();
+ [TestCase(int.MaxValue, "IntPtr")]
+ public static int IntPtr() =>
+ IntPtrImpl().ToInt32();
+
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern UIntPtr UIntPtrImpl();
+
+ [TestCase(uint.MaxValue, "UIntPtr")]
+ public static uint UIntPtr() =>
+ UIntPtrImpl().ToUInt32();
+ [TestCase(3.14159274f, "Single")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern float Single();
+ [TestCase(3.1415926535897931, "Double")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern double Double();
+ [TestCase('A', "Char")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern char Char();
+ [TestCase("ABC", "String")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string String();
+ [TestCase("ABC", "LocalVariable_255")]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string LocalVariable_255();
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Stloc_s/Stloc_s.il b/tests/IL2C.Core.Test.ILConverters/Stloc_s/Stloc_s.il
index 5c622cff..04109f14 100644
--- a/tests/IL2C.Core.Test.ILConverters/Stloc_s/Stloc_s.il
+++ b/tests/IL2C.Core.Test.ILConverters/Stloc_s/Stloc_s.il
@@ -162,7 +162,7 @@
ret
}
- .method public static native int IntPtr() cil managed
+ .method private static native int IntPtrImpl() cil managed
{
.maxstack 1
.locals init (
@@ -179,7 +179,7 @@
ret
}
- .method public static native uint UIntPtr() cil managed
+ .method private static native uint UIntPtrImpl() cil managed
{
.maxstack 1
.locals init (
diff --git a/tests/IL2C.Core.Test.ILConverters/Stsfld/Stsfld.cs b/tests/IL2C.Core.Test.ILConverters/Stsfld/Stsfld.cs
index cd698a3e..9925d75a 100644
--- a/tests/IL2C.Core.Test.ILConverters/Stsfld/Stsfld.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Stsfld/Stsfld.cs
@@ -31,66 +31,72 @@ public static class Stsfld_Field
public static string? StringValue;
}
- [TestCase(true, "Boolean", true, IncludeTypes = new[] { typeof(Stsfld_Field) })]
- [TestCase(false, "Boolean", false, IncludeTypes = new[] { typeof(Stsfld_Field) })]
- [TestCase(byte.MaxValue, "Byte", byte.MaxValue, IncludeTypes = new[] { typeof(Stsfld_Field) })]
- [TestCase(short.MaxValue, "Int16", short.MaxValue, IncludeTypes = new[] { typeof(Stsfld_Field) })]
- [TestCase(int.MaxValue, "Int32", int.MaxValue, IncludeTypes = new[] { typeof(Stsfld_Field) })]
- [TestCase(long.MaxValue, "Int64", long.MaxValue, IncludeTypes = new[] { typeof(Stsfld_Field) })]
- [TestCase(sbyte.MaxValue, "SByte", sbyte.MaxValue, IncludeTypes = new[] { typeof(Stsfld_Field) })]
- [TestCase(ushort.MaxValue, "UInt16", ushort.MaxValue, IncludeTypes = new[] { typeof(Stsfld_Field) })]
- [TestCase(uint.MaxValue, "UInt32", uint.MaxValue, IncludeTypes = new[] { typeof(Stsfld_Field) })]
- [TestCase(ulong.MaxValue, "UInt64", ulong.MaxValue, IncludeTypes = new[] { typeof(Stsfld_Field) })]
- [TestCase(int.MaxValue, "IntPtr", int.MaxValue, IncludeTypes = new[] { typeof(Stsfld_Field) })]
- [TestCase(uint.MaxValue, "UIntPtr", uint.MaxValue, IncludeTypes = new[] { typeof(Stsfld_Field) })]
- [TestCase(3.14159274f, "Single", 3.14159274f, IncludeTypes = new[] { typeof(Stsfld_Field) })]
- [TestCase(3.1415926535897931, "Double", 3.1415926535897931, IncludeTypes = new[] { typeof(Stsfld_Field) })]
- [TestCase('A', "Char", 'A', IncludeTypes = new[] { typeof(Stsfld_Field) })]
- [TestCase("ABC", "String", "ABC", IncludeTypes = new[] { typeof(Stsfld_Field) })]
public sealed class Stsfld
{
+ [TestCase(true, "Boolean", true, IncludeTypes = new[] { typeof(Stsfld_Field) })]
+ [TestCase(false, "Boolean", false, IncludeTypes = new[] { typeof(Stsfld_Field) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern bool Boolean(bool value);
+ [TestCase(byte.MaxValue, "Byte", byte.MaxValue, IncludeTypes = new[] { typeof(Stsfld_Field) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern byte Byte(byte value);
+ [TestCase(short.MaxValue, "Int16", short.MaxValue, IncludeTypes = new[] { typeof(Stsfld_Field) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern short Int16(short value);
+ [TestCase(int.MaxValue, "Int32", int.MaxValue, IncludeTypes = new[] { typeof(Stsfld_Field) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Int32(int value);
+ [TestCase(long.MaxValue, "Int64", long.MaxValue, IncludeTypes = new[] { typeof(Stsfld_Field) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern long Int64(long value);
+ [TestCase(sbyte.MaxValue, "SByte", sbyte.MaxValue, IncludeTypes = new[] { typeof(Stsfld_Field) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern sbyte SByte(sbyte value);
+ [TestCase(ushort.MaxValue, "UInt16", ushort.MaxValue, IncludeTypes = new[] { typeof(Stsfld_Field) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ushort UInt16(ushort value);
+ [TestCase(uint.MaxValue, "UInt32", uint.MaxValue, IncludeTypes = new[] { typeof(Stsfld_Field) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern uint UInt32(uint value);
+ [TestCase(ulong.MaxValue, "UInt64", ulong.MaxValue, IncludeTypes = new[] { typeof(Stsfld_Field) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern ulong UInt64(ulong value);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr IntPtr(IntPtr value);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr IntPtrImpl(IntPtr value);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern UIntPtr UIntPtr(UIntPtr value);
+ [TestCase(int.MaxValue, "IntPtr", int.MaxValue, IncludeTypes = new[] { typeof(Stsfld_Field) })]
+ public static int IntPtr(int value) =>
+ IntPtrImpl((IntPtr)value).ToInt32();
+
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern UIntPtr UIntPtrImpl(UIntPtr value);
+
+ [TestCase(uint.MaxValue, "UIntPtr", uint.MaxValue, IncludeTypes = new[] { typeof(Stsfld_Field) })]
+ public static uint UIntPtr(uint value) =>
+ UIntPtrImpl((UIntPtr)value).ToUInt32();
+ [TestCase(3.14159274f, "Single", 3.14159274f, IncludeTypes = new[] { typeof(Stsfld_Field) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern float Single(float value);
+ [TestCase(3.1415926535897931, "Double", 3.1415926535897931, IncludeTypes = new[] { typeof(Stsfld_Field) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern double Double(double value);
+ [TestCase('A', "Char", 'A', IncludeTypes = new[] { typeof(Stsfld_Field) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern char Char(char value);
+ [TestCase("ABC", "String", "ABC", IncludeTypes = new[] { typeof(Stsfld_Field) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string String(string value);
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Stsfld/Stsfld.il b/tests/IL2C.Core.Test.ILConverters/Stsfld/Stsfld.il
index 32dc0b78..d0152990 100644
--- a/tests/IL2C.Core.Test.ILConverters/Stsfld/Stsfld.il
+++ b/tests/IL2C.Core.Test.ILConverters/Stsfld/Stsfld.il
@@ -4,8 +4,8 @@
{
.maxstack 1
ldarg.0
- stsfld bool IL2C.ILConverters.Stsfld_Field::BooleanValue
- ldsfld bool IL2C.ILConverters.Stsfld_Field::BooleanValue
+ stsfld bool [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Stsfld_Field::BooleanValue
+ ldsfld bool [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Stsfld_Field::BooleanValue
ret
}
@@ -13,8 +13,8 @@
{
.maxstack 1
ldarg.0
- stsfld uint8 IL2C.ILConverters.Stsfld_Field::ByteValue
- ldsfld uint8 IL2C.ILConverters.Stsfld_Field::ByteValue
+ stsfld uint8 [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Stsfld_Field::ByteValue
+ ldsfld uint8 [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Stsfld_Field::ByteValue
ret
}
@@ -22,8 +22,8 @@
{
.maxstack 1
ldarg.0
- stsfld int16 IL2C.ILConverters.Stsfld_Field::Int16Value
- ldsfld int16 IL2C.ILConverters.Stsfld_Field::Int16Value
+ stsfld int16 [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Stsfld_Field::Int16Value
+ ldsfld int16 [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Stsfld_Field::Int16Value
ret
}
@@ -31,8 +31,8 @@
{
.maxstack 1
ldarg.0
- stsfld int32 IL2C.ILConverters.Stsfld_Field::Int32Value
- ldsfld int32 IL2C.ILConverters.Stsfld_Field::Int32Value
+ stsfld int32 [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Stsfld_Field::Int32Value
+ ldsfld int32 [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Stsfld_Field::Int32Value
ret
}
@@ -40,8 +40,8 @@
{
.maxstack 1
ldarg.0
- stsfld int64 IL2C.ILConverters.Stsfld_Field::Int64Value
- ldsfld int64 IL2C.ILConverters.Stsfld_Field::Int64Value
+ stsfld int64 [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Stsfld_Field::Int64Value
+ ldsfld int64 [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Stsfld_Field::Int64Value
ret
}
@@ -49,8 +49,8 @@
{
.maxstack 1
ldarg.0
- stsfld int8 IL2C.ILConverters.Stsfld_Field::SByteValue
- ldsfld int8 IL2C.ILConverters.Stsfld_Field::SByteValue
+ stsfld int8 [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Stsfld_Field::SByteValue
+ ldsfld int8 [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Stsfld_Field::SByteValue
ret
}
@@ -58,8 +58,8 @@
{
.maxstack 1
ldarg.0
- stsfld uint16 IL2C.ILConverters.Stsfld_Field::UInt16Value
- ldsfld uint16 IL2C.ILConverters.Stsfld_Field::UInt16Value
+ stsfld uint16 [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Stsfld_Field::UInt16Value
+ ldsfld uint16 [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Stsfld_Field::UInt16Value
ret
}
@@ -67,8 +67,8 @@
{
.maxstack 1
ldarg.0
- stsfld uint32 IL2C.ILConverters.Stsfld_Field::UInt32Value
- ldsfld uint32 IL2C.ILConverters.Stsfld_Field::UInt32Value
+ stsfld uint32 [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Stsfld_Field::UInt32Value
+ ldsfld uint32 [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Stsfld_Field::UInt32Value
ret
}
@@ -76,26 +76,26 @@
{
.maxstack 1
ldarg.0
- stsfld uint64 IL2C.ILConverters.Stsfld_Field::UInt64Value
- ldsfld uint64 IL2C.ILConverters.Stsfld_Field::UInt64Value
+ stsfld uint64 [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Stsfld_Field::UInt64Value
+ ldsfld uint64 [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Stsfld_Field::UInt64Value
ret
}
- .method public static native int IntPtr(native int v) cil managed
+ .method private static native int IntPtrImpl(native int v) cil managed
{
.maxstack 1
ldarg.0
- stsfld native int IL2C.ILConverters.Stsfld_Field::IntPtrValue
- ldsfld native int IL2C.ILConverters.Stsfld_Field::IntPtrValue
+ stsfld native int [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Stsfld_Field::IntPtrValue
+ ldsfld native int [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Stsfld_Field::IntPtrValue
ret
}
- .method public static native uint UIntPtr(native uint v) cil managed
+ .method private static native uint UIntPtrImpl(native uint v) cil managed
{
.maxstack 1
ldarg.0
- stsfld native uint IL2C.ILConverters.Stsfld_Field::UIntPtrValue
- ldsfld native uint IL2C.ILConverters.Stsfld_Field::UIntPtrValue
+ stsfld native uint [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Stsfld_Field::UIntPtrValue
+ ldsfld native uint [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Stsfld_Field::UIntPtrValue
ret
}
@@ -103,8 +103,8 @@
{
.maxstack 1
ldarg.0
- stsfld float32 IL2C.ILConverters.Stsfld_Field::SingleValue
- ldsfld float32 IL2C.ILConverters.Stsfld_Field::SingleValue
+ stsfld float32 [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Stsfld_Field::SingleValue
+ ldsfld float32 [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Stsfld_Field::SingleValue
ret
}
@@ -112,8 +112,8 @@
{
.maxstack 1
ldarg.0
- stsfld float64 IL2C.ILConverters.Stsfld_Field::DoubleValue
- ldsfld float64 IL2C.ILConverters.Stsfld_Field::DoubleValue
+ stsfld float64 [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Stsfld_Field::DoubleValue
+ ldsfld float64 [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Stsfld_Field::DoubleValue
ret
}
@@ -121,8 +121,8 @@
{
.maxstack 1
ldarg.0
- stsfld char IL2C.ILConverters.Stsfld_Field::CharValue
- ldsfld char IL2C.ILConverters.Stsfld_Field::CharValue
+ stsfld char [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Stsfld_Field::CharValue
+ ldsfld char [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Stsfld_Field::CharValue
ret
}
@@ -130,8 +130,8 @@
{
.maxstack 1
ldarg.0
- stsfld string IL2C.ILConverters.Stsfld_Field::StringValue
- ldsfld string IL2C.ILConverters.Stsfld_Field::StringValue
+ stsfld string [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Stsfld_Field::StringValue
+ ldsfld string [IL2C.Core.Test.ILConverters]IL2C.ILConverters.Stsfld_Field::StringValue
ret
}
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Sub/Sub.cs b/tests/IL2C.Core.Test.ILConverters/Sub/Sub.cs
index 88203dd0..1004d8a4 100644
--- a/tests/IL2C.Core.Test.ILConverters/Sub/Sub.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Sub/Sub.cs
@@ -12,57 +12,69 @@
namespace IL2C.ILConverters
{
- [TestCase(12, "Int32_Int32", 36, 24)]
- [TestCase(12, "Int32_IntPtr", 36, 24)]
- [TestCase(12L, "Int64_Int64", 36L, 24L)]
- [TestCase(12, "IntPtr_Int32", 36, 24)]
- [TestCase(12, "IntPtr_IntPtr", 36, 24)]
- [TestCase(123.0f - 0.45f, "Single_Single", 123.0f, 0.45f)]
- [TestCase(123.0f - 0.45, "Single_Double", 123.0f, 0.45)]
- [TestCase(123.0 - 0.45f, "Double_Single", 123.0, 0.45f)]
- [TestCase(123.0 - 0.45, "Double_Double", 123.0, 0.45)]
- [TestCase(123, new[] { "IntRef_Int32", "Sub_IntRef_Int32" }, 123)]
- [TestCase(123, new[] { "IntRef_IntPtr", "Sub_IntRef_IntPtr" }, 123)]
- //[Case(123, new[] { "IntRef_IntRef", "Add_IntRef_IntRef" }, 123)] // TODO: will implement become from Ldelema.
public sealed class Sub
{
+ [TestCase(12, "Int32_Int32", 36, 24)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Int32_Int32(int lhs, int rhs);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr Int32_IntPtr(int lhs, IntPtr rhs);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr Int32_IntPtrImpl(int lhs, IntPtr rhs);
+
+ [TestCase(12, "Int32_IntPtr", 36, 24)]
+ public static int Int32_IntPtr(int lhs, int rhs) =>
+ Int32_IntPtrImpl(lhs, (IntPtr)rhs).ToInt32();
+ [TestCase(12L, "Int64_Int64", 36L, 24L)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern long Int64_Int64(long lhs, long rhs);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr IntPtr_Int32(IntPtr lhs, int rhs);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ public static extern IntPtr IntPtr_Int32Impl(IntPtr lhs, int rhs);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr IntPtr_IntPtr(IntPtr lhs, IntPtr rhs);
+ [TestCase(12, "IntPtr_Int32", 36, 24)]
+ public static int IntPtr_Int32(int lhs, int rhs) =>
+ IntPtr_Int32Impl((IntPtr)lhs, rhs).ToInt32();
+
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ public static extern IntPtr IntPtr_IntPtrImpl(IntPtr lhs, IntPtr rhs);
+ [TestCase(12, "IntPtr_IntPtr", 36, 24)]
+ public static int IntPtr_IntPtr(int lhs, int rhs) =>
+ IntPtr_IntPtrImpl((IntPtr)lhs, (IntPtr)rhs).ToInt32();
+
+ [TestCase(123.0f - 0.45f, "Single_Single", 123.0f, 0.45f)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern float Single_Single(float lhs, float rhs);
+ [TestCase(123.0f - 0.45, "Sub_Single_Double", 123.0f, 0.45)]
[MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern double Single_Double(float lhs, double rhs);
+ public static extern double Sub_Single_Double(float lhs, double rhs);
+ [TestCase(123.0 - 0.45f, "Sub_Double_Single", 123.0, 0.45f)]
[MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern double Double_Single(double lhs, float rhs);
+ public static extern double Sub_Double_Single(double lhs, float rhs);
+ [TestCase(123.0 - 0.45, "Double_Double", 123.0, 0.45)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern double Double_Double(double lhs, double rhs);
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern ref int Sub_IntRef_Int32(ref int lhs, int rhs);
+ [TestCase(123, new[] { "IntRef_Int32", "Sub_IntRef_Int32" }, 123)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int IntRef_Int32(int value);
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern ref int Sub_IntRef_IntPtr(ref int lhs, IntPtr rhs);
+ [TestCase(123, new[] { "IntRef_IntPtr", "Sub_IntRef_IntPtr" }, 123)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int IntRef_IntPtr(int value);
+
+ //[Case(123, new[] { "IntRef_IntRef", "Sub_IntRef_IntRef" }, 123)] // TODO: will implement become from Ldelema.
+ //[MethodImpl(MethodImplOptions.ForwardRef)]
+ //public static extern int IntRef_IntRef(int value);
}
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Sub/Sub.il b/tests/IL2C.Core.Test.ILConverters/Sub/Sub.il
index 60b94d03..bf09a533 100644
--- a/tests/IL2C.Core.Test.ILConverters/Sub/Sub.il
+++ b/tests/IL2C.Core.Test.ILConverters/Sub/Sub.il
@@ -1,98 +1,98 @@
.class public IL2C.ILConverters.Sub
{
- .method public static int32 Int32_Int32(int32 lhs, int32 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- sub
- ret
- }
+ .method public static int32 Int32_Int32(int32 lhs, int32 rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ sub
+ ret
+ }
- .method public static native int Int32_IntPtr(int32 lhs, native int rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- sub
- ret
- }
+ .method private static native int Int32_IntPtrImpl(int32 lhs, native int rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ sub
+ ret
+ }
.method public static int64 Int64_Int64(int64 lhs, int64 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- sub
- ret
- }
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ sub
+ ret
+ }
- .method public static native int IntPtr_Int32(native int lhs, int32 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- sub
- ret
- }
+ .method private static native int IntPtr_Int32Impl(native int lhs, int32 rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ sub
+ ret
+ }
- .method public static native int IntPtr_IntPtr(native int lhs, native int rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- sub
- ret
- }
+ .method private static native int IntPtr_IntPtrImpl(native int lhs, native int rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ sub
+ ret
+ }
- .method public static float32 Single_Single(float32 lhs, float32 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- sub
- ret
- }
+ .method public static float32 Single_Single(float32 lhs, float32 rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ sub
+ ret
+ }
- .method public static float64 Single_Double(float32 lhs, float64 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- sub
- ret
- }
+ .method public static float64 Sub_Single_Double(float32 lhs, float64 rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ sub
+ ret
+ }
- .method public static float64 Double_Single(float64 lhs, float32 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- sub
- ret
- }
+ .method public static float64 Sub_Double_Single(float64 lhs, float32 rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ sub
+ ret
+ }
- .method public static float64 Double_Double(float64 lhs, float64 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- sub
- ret
- }
+ .method public static float64 Double_Double(float64 lhs, float64 rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ sub
+ ret
+ }
.method private static int32& Sub_IntRef_Int32(int32& lhs, int32 rhs) cil managed
- {
- .maxstack 2
+ {
+ .maxstack 2
ldarg.0
- ldarg.1
- sub
- ret
- }
+ ldarg.1
+ sub
+ ret
+ }
.method public static int32 IntRef_Int32(int32 v) cil managed
- {
- .maxstack 3
+ {
+ .maxstack 3
.locals init (
[0] int32
)
@@ -104,21 +104,21 @@
ldc.i4.m1
call int32& IL2C.ILConverters.Sub::Sub_IntRef_Int32(int32&, int32)
ldind.i4
- ret
- }
+ ret
+ }
.method private static int32& Sub_IntRef_IntPtr(int32& lhs, native int rhs) cil managed
- {
- .maxstack 2
+ {
+ .maxstack 2
ldarg.0
- ldarg.1
- sub
- ret
- }
+ ldarg.1
+ sub
+ ret
+ }
.method public static int32 IntRef_IntPtr(int32 v) cil managed
- {
- .maxstack 3
+ {
+ .maxstack 3
.locals init (
[0] int32
)
@@ -132,6 +132,6 @@
conv.i
call int32& IL2C.ILConverters.Sub::Sub_IntRef_IntPtr(int32&, native int)
ldind.i4
- ret
- }
+ ret
+ }
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Unbox_any/Unbox_any.cs b/tests/IL2C.Core.Test.ILConverters/Unbox_any/Unbox_any.cs
index 2f42bda9..970af387 100644
--- a/tests/IL2C.Core.Test.ILConverters/Unbox_any/Unbox_any.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Unbox_any/Unbox_any.cs
@@ -12,13 +12,12 @@
namespace IL2C.ILConverters
{
- [TestCase(true, new[] { "Int32", "Unbox_Int32" }, 123)]
- [TestCase(124, "FromValueType", 123)]
public sealed class Unbox_any
{
[MethodImpl(MethodImplOptions.ForwardRef)]
private static extern int Unbox_Int32(object value);
+ [TestCase(true, new[] { "Int32", "Unbox_Int32" }, 123)]
public static bool Int32(object value)
{
var ub = Unbox_Int32(value);
@@ -26,6 +25,7 @@ public static bool Int32(object value)
}
// https://github.com/kekyo/IL2C/issues/37
+ [TestCase(124, "FromValueType", 123)]
public static int FromValueType(int value)
{
ValueType v = value + 1; // boxed
diff --git a/tests/IL2C.Core.Test.ILConverters/Xor/Xor.cs b/tests/IL2C.Core.Test.ILConverters/Xor/Xor.cs
index 1595b1d6..9d068079 100644
--- a/tests/IL2C.Core.Test.ILConverters/Xor/Xor.cs
+++ b/tests/IL2C.Core.Test.ILConverters/Xor/Xor.cs
@@ -12,26 +12,35 @@
namespace IL2C.ILConverters
{
- [TestCase(0x12345678 ^ 0x55555555, "Int32_Int32", 0x12345678, 0x55555555)]
- [TestCase(0x12345678 ^ 0x55555555, "Int32_IntPtr", 0x12345678, 0x55555555)]
- [TestCase(0x123456789abcdef ^ 0x55555555aaaaaaaa, "Int64_Int64", 0x123456789abcdef, 0x55555555aaaaaaaa)]
- [TestCase(0x12345678 ^ 0x55555555, "IntPtr_Int32", 0x12345678, 0x55555555)]
- [TestCase(0x12345678 ^ 0x55555555, "IntPtr_IntPtr", 0x12345678, 0x55555555)]
public sealed class Xor
{
+ [TestCase(0x12345678 ^ 0x55555555, "Int32_Int32", 0x12345678, 0x55555555)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern int Int32_Int32(int lhs, int rhs);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr Int32_IntPtr(int lhs, IntPtr rhs);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr Int32_IntPtrImpl(int lhs, IntPtr rhs);
+
+ [TestCase(0x12345678 ^ 0x55555555, "Int32_IntPtr", 0x12345678, 0x55555555)]
+ public static int Int32_IntPtr(int lhs, int rhs) =>
+ Int32_IntPtrImpl(lhs, (IntPtr)rhs).ToInt32();
+ [TestCase(0x123456789abcdef ^ 0x55555555aaaaaaaa, "Int64_Int64", 0x123456789abcdef, 0x55555555aaaaaaaa)]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern long Int64_Int64(long lhs, long rhs);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr IntPtr_Int32(IntPtr lhs, int rhs);
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr IntPtr_Int32Impl(IntPtr lhs, int rhs);
- [MethodImpl(MethodImplOptions.ForwardRef)]
- public static extern IntPtr IntPtr_IntPtr(IntPtr lhs, IntPtr rhs);
+ [TestCase(0x12345678 ^ 0x55555555, "IntPtr_Int32", 0x12345678, 0x55555555)]
+ public static int IntPtr_Int32(int lhs, int rhs) =>
+ IntPtr_Int32Impl((IntPtr)lhs, rhs).ToInt32();
+
+ [MethodImpl(MethodImplOptions.ForwardRef)]
+ private static extern IntPtr IntPtr_IntPtrImpl(IntPtr lhs, IntPtr rhs);
+
+ [TestCase(0x12345678 ^ 0x55555555, "IntPtr_IntPtr", 0x12345678, 0x55555555)]
+ public static int IntPtr_IntPtr(int lhs, int rhs) =>
+ IntPtr_IntPtrImpl((IntPtr)lhs, (IntPtr)rhs).ToInt32();
}
}
diff --git a/tests/IL2C.Core.Test.ILConverters/Xor/Xor.il b/tests/IL2C.Core.Test.ILConverters/Xor/Xor.il
index 416026d4..e1067e2c 100644
--- a/tests/IL2C.Core.Test.ILConverters/Xor/Xor.il
+++ b/tests/IL2C.Core.Test.ILConverters/Xor/Xor.il
@@ -1,47 +1,47 @@
.class public IL2C.ILConverters.Xor
{
- .method public static int32 Int32_Int32(int32 lhs, int32 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- xor
- ret
- }
+ .method public static int32 Int32_Int32(int32 lhs, int32 rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ xor
+ ret
+ }
- .method public static native int Int32_IntPtr(int32 lhs, native int rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- xor
- ret
- }
+ .method private static native int Int32_IntPtrImpl(int32 lhs, native int rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ xor
+ ret
+ }
.method public static int64 Int64_Int64(int64 lhs, int64 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- xor
- ret
- }
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ xor
+ ret
+ }
- .method public static native int IntPtr_Int32(native int lhs, int32 rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- xor
- ret
- }
+ .method private static native int IntPtr_Int32Impl(native int lhs, int32 rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ xor
+ ret
+ }
- .method public static native int IntPtr_IntPtr(native int lhs, native int rhs) cil managed
- {
- .maxstack 2
- ldarg.0
- ldarg.1
- xor
- ret
- }
+ .method private static native int IntPtr_IntPtrImpl(native int lhs, native int rhs) cil managed
+ {
+ .maxstack 2
+ ldarg.0
+ ldarg.1
+ xor
+ ret
+ }
}
diff --git a/tests/IL2C.Core.Test.RuntimeSystems/ArrayTypes/ArrayTypes.cs b/tests/IL2C.Core.Test.RuntimeSystems/ArrayTypes/ArrayTypes.cs
index e4fb96df..b3480372 100644
--- a/tests/IL2C.Core.Test.RuntimeSystems/ArrayTypes/ArrayTypes.cs
+++ b/tests/IL2C.Core.Test.RuntimeSystems/ArrayTypes/ArrayTypes.cs
@@ -14,51 +14,11 @@
namespace IL2C.RuntimeSystems
{
[Description("Array type generates on the runtime. Example: System.Int32[] isn't declared anything assembly. These tests are verified the IL2C can handle runtime array types and initialize array items from resources.")]
- [TestCase(1111111, "FromInt32", 0)]
- [TestCase(2222222, "FromInt32", 1)]
- [TestCase(3333333, "FromInt32", 2)]
- [TestCase(11, "FromByteResource", 0)]
- [TestCase(22, "FromByteResource", 1)]
- [TestCase(33, "FromByteResource", 2)]
- [TestCase(1111, "FromInt16Resource", 0)]
- [TestCase(-2222, "FromInt16Resource", 1)]
- [TestCase(3333, "FromInt16Resource", 2)]
- [TestCase(1111111, "FromInt32Resource", 0)]
- [TestCase(-2222222, "FromInt32Resource", 1)]
- [TestCase(3333333, "FromInt32Resource", 2)]
- [TestCase(11111111111111, "FromInt64Resource", 0)]
- [TestCase(-22222222222222, "FromInt64Resource", 1)]
- [TestCase(33333333333333, "FromInt64Resource", 2)]
- [TestCase(11, "FromSByteResource", 0)]
- [TestCase(-22, "FromSByteResource", 1)]
- [TestCase(33, "FromSByteResource", 2)]
- [TestCase(11111, "FromUInt16Resource", 0)]
- [TestCase(22222, "FromUInt16Resource", 1)]
- [TestCase(33333, "FromUInt16Resource", 2)]
- [TestCase(1111111, "FromUInt32Resource", 0)]
- [TestCase(2222222, "FromUInt32Resource", 1)]
- [TestCase(3333333, "FromUInt32Resource", 2)]
- [TestCase(11111111111111, "FromUInt64Resource", 0)]
- [TestCase(22222222222222, "FromUInt64Resource", 1)]
- [TestCase(33333333333333, "FromUInt64Resource", 2)]
- [TestCase(111.2222f, "FromSingleResource", 0)]
- [TestCase(-333.4444f, "FromSingleResource", 1)]
- [TestCase(555.6666f, "FromSingleResource", 2)]
- [TestCase(111.2222, "FromDoubleResource", 0)]
- [TestCase(-333.4444, "FromDoubleResource", 1)]
- [TestCase(555.6666, "FromDoubleResource", 2)]
- [TestCase('A', "FromCharResource", 0)]
- [TestCase('B', "FromCharResource", 1)]
- [TestCase('C', "FromCharResource", 2)]
- [TestCase(1, "FromString", 0)]
- [TestCase(22, "FromString", 1)]
- [TestCase(333, "FromString", 2)]
- [TestCase(0, "Length", 0)]
- [TestCase(1, "Length", 1)]
- [TestCase(1000, "Length", 1000)]
- [TestCase(55, "Enumerator")]
public sealed class ArrayTypes
{
+ [TestCase(1111111, "FromInt32", 0)]
+ [TestCase(2222222, "FromInt32", 1)]
+ [TestCase(3333333, "FromInt32", 2)]
public static int FromInt32(int index)
{
var arr = new int[3];
@@ -69,6 +29,9 @@ public static int FromInt32(int index)
return arr[index];
}
+ [TestCase(11, "FromByteResource", 0)]
+ [TestCase(22, "FromByteResource", 1)]
+ [TestCase(33, "FromByteResource", 2)]
public static byte FromByteResource(int index)
{
// This expression invokes to System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray().
@@ -77,6 +40,9 @@ public static byte FromByteResource(int index)
return arr[index];
}
+ [TestCase(1111, "FromInt16Resource", 0)]
+ [TestCase(-2222, "FromInt16Resource", 1)]
+ [TestCase(3333, "FromInt16Resource", 2)]
public static short FromInt16Resource(int index)
{
// This expression invokes to System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray().
@@ -85,6 +51,9 @@ public static short FromInt16Resource(int index)
return arr[index];
}
+ [TestCase(1111111, "FromInt32Resource", 0)]
+ [TestCase(-2222222, "FromInt32Resource", 1)]
+ [TestCase(3333333, "FromInt32Resource", 2)]
public static int FromInt32Resource(int index)
{
// This expression invokes to System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray().
@@ -93,6 +62,9 @@ public static int FromInt32Resource(int index)
return arr[index];
}
+ [TestCase(11111111111111, "FromInt64Resource", 0)]
+ [TestCase(-22222222222222, "FromInt64Resource", 1)]
+ [TestCase(33333333333333, "FromInt64Resource", 2)]
public static long FromInt64Resource(int index)
{
// This expression invokes to System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray().
@@ -101,6 +73,9 @@ public static long FromInt64Resource(int index)
return arr[index];
}
+ [TestCase(11, "FromSByteResource", 0)]
+ [TestCase(-22, "FromSByteResource", 1)]
+ [TestCase(33, "FromSByteResource", 2)]
public static sbyte FromSByteResource(int index)
{
// This expression invokes to System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray().
@@ -109,6 +84,9 @@ public static sbyte FromSByteResource(int index)
return arr[index];
}
+ [TestCase(11111, "FromUInt16Resource", 0)]
+ [TestCase(22222, "FromUInt16Resource", 1)]
+ [TestCase(33333, "FromUInt16Resource", 2)]
public static ushort FromUInt16Resource(int index)
{
// This expression invokes to System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray().
@@ -117,6 +95,9 @@ public static ushort FromUInt16Resource(int index)
return arr[index];
}
+ [TestCase(1111111, "FromUInt32Resource", 0)]
+ [TestCase(2222222, "FromUInt32Resource", 1)]
+ [TestCase(3333333, "FromUInt32Resource", 2)]
public static uint FromUInt32Resource(int index)
{
// This expression invokes to System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray().
@@ -125,6 +106,9 @@ public static uint FromUInt32Resource(int index)
return arr[index];
}
+ [TestCase(11111111111111, "FromUInt64Resource", 0)]
+ [TestCase(22222222222222, "FromUInt64Resource", 1)]
+ [TestCase(33333333333333, "FromUInt64Resource", 2)]
public static ulong FromUInt64Resource(int index)
{
// This expression invokes to System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray().
@@ -133,6 +117,9 @@ public static ulong FromUInt64Resource(int index)
return arr[index];
}
+ [TestCase(111.2222f, "FromSingleResource", 0)]
+ [TestCase(-333.4444f, "FromSingleResource", 1)]
+ [TestCase(555.6666f, "FromSingleResource", 2)]
public static float FromSingleResource(int index)
{
// This expression invokes to System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray().
@@ -141,6 +128,9 @@ public static float FromSingleResource(int index)
return arr[index];
}
+ [TestCase(111.2222, "FromDoubleResource", 0)]
+ [TestCase(-333.4444, "FromDoubleResource", 1)]
+ [TestCase(555.6666, "FromDoubleResource", 2)]
public static double FromDoubleResource(int index)
{
// This expression invokes to System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray().
@@ -149,6 +139,9 @@ public static double FromDoubleResource(int index)
return arr[index];
}
+ [TestCase('A', "FromCharResource", 0)]
+ [TestCase('B', "FromCharResource", 1)]
+ [TestCase('C', "FromCharResource", 2)]
public static char FromCharResource(int index)
{
// This expression invokes to System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray().
@@ -157,6 +150,9 @@ public static char FromCharResource(int index)
return arr[index];
}
+ [TestCase(1, "FromString", 0)]
+ [TestCase(22, "FromString", 1)]
+ [TestCase(333, "FromString", 2)]
public static int FromString(int index)
{
// Not use InitializeArray()
@@ -165,6 +161,9 @@ public static int FromString(int index)
return r;
}
+ [TestCase(0, "Length", 0)]
+ [TestCase(1, "Length", 1)]
+ [TestCase(1000, "Length", 1000)]
public static int Length(int length)
{
var arr = new int[length];
@@ -172,6 +171,7 @@ public static int Length(int length)
return arr.Length;
}
+ [TestCase(55, "Enumerator")]
public static int Enumerator()
{
var arr = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
diff --git a/tests/IL2C.Core.Test.RuntimeSystems/DelegateTypes/CSharpEvent.cs b/tests/IL2C.Core.Test.RuntimeSystems/DelegateTypes/CSharpEvent.cs
index 402a96f6..41d90158 100644
--- a/tests/IL2C.Core.Test.RuntimeSystems/DelegateTypes/CSharpEvent.cs
+++ b/tests/IL2C.Core.Test.RuntimeSystems/DelegateTypes/CSharpEvent.cs
@@ -47,10 +47,9 @@ public void DoEvent(int value)
// So it handles the case with hacky code at IL2C.ILConverters.CallConverterUtilities.
// This test case validates it.
[TestId("DelegateTypes")]
- [TestCase(6123, "AddCSharpEvent", 1000, IncludeTypes = new[] { typeof(CSharpEventImpl), typeof(CSharpEventDelegate), typeof(CSharpEventReceiver) })]
- [TestCase(4123, "RemoveCSharpEvent", 1000, IncludeTypes = new[] { typeof(CSharpEventImpl), typeof(CSharpEventDelegate), typeof(CSharpEventReceiver) })]
public sealed class CSharpEvent
{
+ [TestCase(6123, "AddCSharpEvent", 1000, IncludeTypes = new[] { typeof(CSharpEventImpl), typeof(CSharpEventDelegate), typeof(CSharpEventReceiver) })]
public static int AddCSharpEvent(int value)
{
var receiver = new CSharpEventReceiver();
@@ -66,6 +65,7 @@ public static int AddCSharpEvent(int value)
return receiver.Value;
}
+ [TestCase(4123, "RemoveCSharpEvent", 1000, IncludeTypes = new[] { typeof(CSharpEventImpl), typeof(CSharpEventDelegate), typeof(CSharpEventReceiver) })]
public static int RemoveCSharpEvent(int value)
{
var receiver = new CSharpEventReceiver();
diff --git a/tests/IL2C.Core.Test.RuntimeSystems/DelegateTypes/DelegateTypes.cs b/tests/IL2C.Core.Test.RuntimeSystems/DelegateTypes/DelegateTypes.cs
index d01aae3a..a6a2557b 100644
--- a/tests/IL2C.Core.Test.RuntimeSystems/DelegateTypes/DelegateTypes.cs
+++ b/tests/IL2C.Core.Test.RuntimeSystems/DelegateTypes/DelegateTypes.cs
@@ -25,12 +25,6 @@ public string AnotherInstance_Int32ToStringImpl(int value)
}
[Description("The delegate types contain special member fields, the objref instance reference and the raw method pointer. These tests are verified the IL2C can invoke delegate types combination features between static, instance, virtual method and multicasting at the runtime.")]
- [TestCase("12345678ABC", new[] { "Static_Int32ToString", "Static_Int32ToStringImpl" }, 12345678, IncludeTypes = new[] { typeof(Int32ToStringDelegate) })]
- [TestCase(1111, new[] { "Static_Void_RefInt", "Static_Void_RefIntImpl" }, 1000, IncludeTypes = new[] { typeof(RefIntDelegate) })]
- [TestCase("87654321ABC123", new[] { "Instance_Int32ToString", "Instance_Int32ToStringImpl" }, 87654321, IncludeTypes = new[] { typeof(Int32ToStringDelegate) })]
- [TestCase(1123, new[] { "Instance_Void_RefInt", "Instance_Void_RefIntImpl" }, 1000, IncludeTypes = new[] { typeof(RefIntDelegate) })]
- [TestCase("11223344DEF456", new[] { "AnotherInstance_Int32ToString", "AnotherInstance_Int32ToStringImpl" }, 11223344, IncludeTypes = new[] { typeof(Int32ToStringDelegate), typeof(AnotherDelegateTypes) })]
- [TestCase("87654321ABC123", new[] { "Virtual_Int32ToString", "Virtual_Int32ToStringImpl" }, 87654321, IncludeTypes = new[] { typeof(Int32ToStringDelegate) })]
public sealed class DelegateTypes
{
#region Static
@@ -39,6 +33,7 @@ private static string Static_Int32ToStringImpl(int value)
return value.ToString() + "ABC";
}
+ [TestCase("12345678ABC", new[] { "Static_Int32ToString", "Static_Int32ToStringImpl" }, 12345678, IncludeTypes = new[] { typeof(Int32ToStringDelegate) })]
public static string Static_Int32ToString(int value)
{
var dlg = new Int32ToStringDelegate(Static_Int32ToStringImpl);
@@ -50,6 +45,7 @@ private static void Static_Void_RefIntImpl(ref int value)
value += 111;
}
+ [TestCase(1111, new[] { "Static_Void_RefInt", "Static_Void_RefIntImpl" }, 1000, IncludeTypes = new[] { typeof(RefIntDelegate) })]
public static int Static_Void_RefInt(int value)
{
var dlg = new RefIntDelegate(Static_Void_RefIntImpl);
@@ -67,6 +63,7 @@ private string Instance_Int32ToStringImpl(int value)
return value.ToString() + "ABC" + v1.ToString();
}
+ [TestCase("87654321ABC123", new[] { "Instance_Int32ToString", "Instance_Int32ToStringImpl" }, 87654321, IncludeTypes = new[] { typeof(Int32ToStringDelegate) })]
public static string Instance_Int32ToString(int value)
{
var inst = new DelegateTypes();
@@ -79,6 +76,7 @@ private void Instance_Void_RefIntImpl(ref int value)
value += v1;
}
+ [TestCase(1123, new[] { "Instance_Void_RefInt", "Instance_Void_RefIntImpl" }, 1000, IncludeTypes = new[] { typeof(RefIntDelegate) })]
public static int Instance_Void_RefInt(int value)
{
var inst = new DelegateTypes();
@@ -88,6 +86,7 @@ public static int Instance_Void_RefInt(int value)
return v;
}
+ [TestCase("11223344DEF456", new[] { "AnotherInstance_Int32ToString", "AnotherInstance_Int32ToStringImpl" }, 11223344, IncludeTypes = new[] { typeof(Int32ToStringDelegate), typeof(AnotherDelegateTypes) })]
public static string AnotherInstance_Int32ToString(int value)
{
var inst = new AnotherDelegateTypes();
diff --git a/tests/IL2C.Core.Test.RuntimeSystems/DelegateTypes/DelegateTypesWIthVirtual.cs b/tests/IL2C.Core.Test.RuntimeSystems/DelegateTypes/DelegateTypesWIthVirtual.cs
index ef4b10d3..4be74ad9 100644
--- a/tests/IL2C.Core.Test.RuntimeSystems/DelegateTypes/DelegateTypesWIthVirtual.cs
+++ b/tests/IL2C.Core.Test.RuntimeSystems/DelegateTypes/DelegateTypesWIthVirtual.cs
@@ -10,7 +10,6 @@
namespace IL2C.RuntimeSystems
{
[TestId("DelegateTypes")]
- [TestCase("87654321ABC123", new[] { "Virtual_Int32ToString", "Virtual_Int32ToStringImpl" }, 87654321, IncludeTypes = new[] { typeof(Int32ToStringDelegate) })]
public class DelegateTypesWithVirtual1
{
private int v1 = 123;
@@ -20,6 +19,7 @@ public virtual string Virtual_Int32ToStringImpl(int value)
return value.ToString() + "ABC" + v1.ToString();
}
+ [TestCase("87654321ABC123", new[] { "Virtual_Int32ToString", "Virtual_Int32ToStringImpl" }, 87654321, IncludeTypes = new[] { typeof(Int32ToStringDelegate) })]
public static string Virtual_Int32ToString(int value)
{
var inst = new DelegateTypesWithVirtual1();
@@ -39,8 +39,6 @@ public virtual string Override_Int32ToStringImpl(int value)
}
[TestId("DelegateTypes")]
- [TestCase("87654321ABC123", new[] { "Override_Int32ToString", "Override_Int32ToStringImpl" }, 87654321, IncludeBaseTypes = true, IncludeTypes = new[] { typeof(Int32ToStringDelegate) })]
- [TestCase("87654321ABC123", new[] { "Base_Int32ToString", "Override_Int32ToStringImpl" }, 87654321, IncludeBaseTypes = true, IncludeTypes = new[] { typeof(Int32ToStringDelegate) })]
public class DelegateTypesWithVirtual2 : DelegateTypesWithVirtual_Base
{
private int v1 = 123;
@@ -50,6 +48,7 @@ public override string Override_Int32ToStringImpl(int value)
return value.ToString() + "ABC" + v1.ToString();
}
+ [TestCase("87654321ABC123", new[] { "Override_Int32ToString", "Override_Int32ToStringImpl" }, 87654321, IncludeBaseTypes = true, IncludeTypes = new[] { typeof(Int32ToStringDelegate) })]
public static string Override_Int32ToString(int value)
{
var inst = new DelegateTypesWithVirtual2();
@@ -57,6 +56,7 @@ public static string Override_Int32ToString(int value)
return dlg(value);
}
+ [TestCase("87654321ABC123", new[] { "Base_Int32ToString", "Override_Int32ToStringImpl" }, 87654321, IncludeBaseTypes = true, IncludeTypes = new[] { typeof(Int32ToStringDelegate) })]
public static string Base_Int32ToString(int value)
{
DelegateTypesWithVirtual_Base inst = new DelegateTypesWithVirtual2();
diff --git a/tests/IL2C.Core.Test.RuntimeSystems/DelegateTypes/MulticastDelegateTypes.cs b/tests/IL2C.Core.Test.RuntimeSystems/DelegateTypes/MulticastDelegateTypes.cs
index df2c3882..ce026de2 100644
--- a/tests/IL2C.Core.Test.RuntimeSystems/DelegateTypes/MulticastDelegateTypes.cs
+++ b/tests/IL2C.Core.Test.RuntimeSystems/DelegateTypes/MulticastDelegateTypes.cs
@@ -12,11 +12,6 @@ namespace IL2C.RuntimeSystems
public delegate string RefIntToStringDelegate(ref int value);
[TestId("DelegateTypes")]
- [TestCase(1333, new[] { "Static_Void_RefInt_Multicast", "Static_Void_RefIntImpl1", "Static_Void_RefIntImpl2" }, 1000, IncludeTypes = new[] { typeof(RefIntDelegate) })]
- [TestCase("1222", new[] { "Static_RefIntToString_Multicast", "Static_RefIntToStringImpl" }, 1000, IncludeTypes = new[] { typeof(RefIntToStringDelegate) })]
- [TestCase("1234ABC", new[] { "Combination_RefIntToString_Multicast1", "Static_RefIntToStringImpl", "Instance_RefIntToStringImpl" }, 1000, IncludeTypes = new[] { typeof(RefIntToStringDelegate) })]
- [TestCase("1234", new[] { "Combination_RefIntToString_Multicast2", "Static_RefIntToStringImpl", "Instance_RefIntToStringImpl" }, 1000, IncludeTypes = new[] { typeof(RefIntToStringDelegate) })]
- [TestCase("1357ABC", new[] { "Combination_RefIntToString_Multicast3", "Static_RefIntToStringImpl", "Instance_RefIntToStringImpl" }, 1000, IncludeTypes = new[] { typeof(RefIntToStringDelegate) })]
public sealed class MulticastDelegateTypes
{
private static void Static_Void_RefIntImpl1(ref int value)
@@ -29,6 +24,7 @@ private static void Static_Void_RefIntImpl2(ref int value)
value += 222;
}
+ [TestCase(1333, new[] { "Static_Void_RefInt_Multicast", "Static_Void_RefIntImpl1", "Static_Void_RefIntImpl2" }, 1000, IncludeTypes = new[] { typeof(RefIntDelegate) })]
public static int Static_Void_RefInt_Multicast(int value)
{
var dlg1 = new RefIntDelegate(Static_Void_RefIntImpl1);
@@ -47,6 +43,7 @@ private static string Static_RefIntToStringImpl(ref int value)
return value.ToString();
}
+ [TestCase("1222", new[] { "Static_RefIntToString_Multicast", "Static_RefIntToStringImpl" }, 1000, IncludeTypes = new[] { typeof(RefIntToStringDelegate) })]
public static string Static_RefIntToString_Multicast(int value)
{
var dlg1 = new RefIntToStringDelegate(Static_RefIntToStringImpl);
@@ -65,6 +62,7 @@ private string Instance_RefIntToStringImpl(ref int value)
return value.ToString() + "ABC";
}
+ [TestCase("1234ABC", new[] { "Combination_RefIntToString_Multicast1", "Static_RefIntToStringImpl", "Instance_RefIntToStringImpl" }, 1000, IncludeTypes = new[] { typeof(RefIntToStringDelegate) })]
public static string Combination_RefIntToString_Multicast1(int value)
{
var inst = new MulticastDelegateTypes();
@@ -76,6 +74,7 @@ public static string Combination_RefIntToString_Multicast1(int value)
return dlg1(ref v);
}
+ [TestCase("1234", new[] { "Combination_RefIntToString_Multicast2", "Static_RefIntToStringImpl", "Instance_RefIntToStringImpl" }, 1000, IncludeTypes = new[] { typeof(RefIntToStringDelegate) })]
public static string Combination_RefIntToString_Multicast2(int value)
{
var inst = new MulticastDelegateTypes();
@@ -87,6 +86,7 @@ public static string Combination_RefIntToString_Multicast2(int value)
return dlg1(ref v);
}
+ [TestCase("1357ABC", new[] { "Combination_RefIntToString_Multicast3", "Static_RefIntToStringImpl", "Instance_RefIntToStringImpl" }, 1000, IncludeTypes = new[] { typeof(RefIntToStringDelegate) })]
public static string Combination_RefIntToString_Multicast3(int value)
{
var inst = new MulticastDelegateTypes();
diff --git a/tests/IL2C.Core.Test.RuntimeSystems/EnumTypes/EnumTypes.cs b/tests/IL2C.Core.Test.RuntimeSystems/EnumTypes/EnumTypes.cs
index 7613b370..75a50be2 100644
--- a/tests/IL2C.Core.Test.RuntimeSystems/EnumTypes/EnumTypes.cs
+++ b/tests/IL2C.Core.Test.RuntimeSystems/EnumTypes/EnumTypes.cs
@@ -30,43 +30,43 @@ public enum Int64EnumType : long
}
[Description("The enum types have the underlying primitive integer types. These tests are verified the IL2C can manage enum underlying types at the boxing-unboxing conversion with narrowing-widing combinations.")]
- [TestCase(Int32EnumType.Min, "Int32", int.MinValue, IncludeTypes = new[] { typeof(Int32EnumType) })]
- [TestCase(Int32EnumType.MinusOne, "Int32", -1, IncludeTypes = new[] { typeof(Int32EnumType) })]
- [TestCase(Int32EnumType.Zero, "Int32", 0, IncludeTypes = new[] { typeof(Int32EnumType) })]
- [TestCase(Int32EnumType.One, "Int32", 1, IncludeTypes = new[] { typeof(Int32EnumType) })]
- [TestCase(Int32EnumType.Max, "Int32", int.MaxValue, IncludeTypes = new[] { typeof(Int32EnumType) })]
- [TestCase(Int32EnumType.Zero, "ByteToInt32", 0, IncludeTypes = new[] { typeof(Int32EnumType) })]
- [TestCase(Int32EnumType.One, "ByteToInt32", 1, IncludeTypes = new[] { typeof(Int32EnumType) })]
- [TestCase((Int32EnumType)255, "ByteToInt32", 255, IncludeTypes = new[] { typeof(Int32EnumType) })]
- [TestCase(Int64EnumType.Min, "Int64", long.MinValue, IncludeTypes = new[] { typeof(Int64EnumType) })]
- [TestCase(Int64EnumType.MinusOne, "Int64", -1L, IncludeTypes = new[] { typeof(Int64EnumType) })]
- [TestCase(Int64EnumType.Zero, "Int64", 0L, IncludeTypes = new[] { typeof(Int64EnumType) })]
- [TestCase(Int64EnumType.One, "Int64", 1L, IncludeTypes = new[] { typeof(Int64EnumType) })]
- [TestCase(Int64EnumType.Max, "Int64", long.MaxValue, IncludeTypes = new[] { typeof(Int64EnumType) })]
- [TestCase((Int64EnumType)int.MinValue, "Int32ToInt64", int.MinValue, IncludeTypes = new[] { typeof(Int64EnumType) })]
- [TestCase(Int64EnumType.MinusOne, "Int32ToInt64", -1, IncludeTypes = new[] { typeof(Int64EnumType) })]
- [TestCase(Int64EnumType.Zero, "Int32ToInt64", 0, IncludeTypes = new[] { typeof(Int64EnumType) })]
- [TestCase(Int64EnumType.One, "Int32ToInt64", 1, IncludeTypes = new[] { typeof(Int64EnumType) })]
- [TestCase((Int64EnumType)int.MaxValue, "Int32ToInt64", int.MaxValue, IncludeTypes = new[] { typeof(Int64EnumType) })]
public sealed class EnumTypes
{
+ [TestCase(Int32EnumType.Min, "Int32", int.MinValue, IncludeTypes = new[] { typeof(Int32EnumType) })]
+ [TestCase(Int32EnumType.MinusOne, "Int32", -1, IncludeTypes = new[] { typeof(Int32EnumType) })]
+ [TestCase(Int32EnumType.Zero, "Int32", 0, IncludeTypes = new[] { typeof(Int32EnumType) })]
+ [TestCase(Int32EnumType.One, "Int32", 1, IncludeTypes = new[] { typeof(Int32EnumType) })]
+ [TestCase(Int32EnumType.Max, "Int32", int.MaxValue, IncludeTypes = new[] { typeof(Int32EnumType) })]
public static Int32EnumType Int32(int value)
{
return (Int32EnumType)value;
}
// Expanding
+ [TestCase(Int32EnumType.Zero, "ByteToInt32", 0, IncludeTypes = new[] { typeof(Int32EnumType) })]
+ [TestCase(Int32EnumType.One, "ByteToInt32", 1, IncludeTypes = new[] { typeof(Int32EnumType) })]
+ [TestCase((Int32EnumType)255, "ByteToInt32", 255, IncludeTypes = new[] { typeof(Int32EnumType) })]
public static Int32EnumType ByteToInt32(byte value)
{
return (Int32EnumType)value;
}
+ [TestCase(Int64EnumType.Min, "Int64", long.MinValue, IncludeTypes = new[] { typeof(Int64EnumType) })]
+ [TestCase(Int64EnumType.MinusOne, "Int64", -1L, IncludeTypes = new[] { typeof(Int64EnumType) })]
+ [TestCase(Int64EnumType.Zero, "Int64", 0L, IncludeTypes = new[] { typeof(Int64EnumType) })]
+ [TestCase(Int64EnumType.One, "Int64", 1L, IncludeTypes = new[] { typeof(Int64EnumType) })]
+ [TestCase(Int64EnumType.Max, "Int64", long.MaxValue, IncludeTypes = new[] { typeof(Int64EnumType) })]
public static Int64EnumType Int64(long value)
{
return (Int64EnumType)value;
}
// Expanding
+ [TestCase((Int64EnumType)int.MinValue, "Int32ToInt64", int.MinValue, IncludeTypes = new[] { typeof(Int64EnumType) })]
+ [TestCase(Int64EnumType.MinusOne, "Int32ToInt64", -1, IncludeTypes = new[] { typeof(Int64EnumType) })]
+ [TestCase(Int64EnumType.Zero, "Int32ToInt64", 0, IncludeTypes = new[] { typeof(Int64EnumType) })]
+ [TestCase(Int64EnumType.One, "Int32ToInt64", 1, IncludeTypes = new[] { typeof(Int64EnumType) })]
+ [TestCase((Int64EnumType)int.MaxValue, "Int32ToInt64", int.MaxValue, IncludeTypes = new[] { typeof(Int64EnumType) })]
public static Int64EnumType Int32ToInt64(int value)
{
return (Int64EnumType)value;
diff --git a/tests/IL2C.Core.Test.RuntimeSystems/ExceptionHandling/ExceptionHandling.cs b/tests/IL2C.Core.Test.RuntimeSystems/ExceptionHandling/ExceptionHandling.cs
index 002f34e6..dc7063f6 100644
--- a/tests/IL2C.Core.Test.RuntimeSystems/ExceptionHandling/ExceptionHandling.cs
+++ b/tests/IL2C.Core.Test.RuntimeSystems/ExceptionHandling/ExceptionHandling.cs
@@ -15,39 +15,10 @@
namespace IL2C.RuntimeSystems
{
[Description("These tests are verified the IL2C translates with simple and/or complext exception handling.")]
- [TestCase(123, "RaiseAndCaughtLocal", false)]
- [TestCase(456, "RaiseAndCaughtLocal", true)]
- [TestCase("ABC", "RaiseCaughtAndAccessLocal", "ABC")]
- [TestCase(null, "RaiseCaughtAndAccessLocal", null!)]
- [TestCase("ABC", "RaiseCaughtNarrowingLocal", "ABC")]
- [TestCase(null, "RaiseCaughtNarrowingLocal", null!)]
- [TestCase("ABC", "RaiseCaughtWildcardLocal", "ABC")]
- [TestCase(null, "RaiseCaughtWildcardLocal", null!)]
- [TestCase(123, "RaiseAndCaughtMultipleHandlerLocal", 0)]
- [TestCase(456, "RaiseAndCaughtMultipleHandlerLocal", 1)]
- [TestCase(789, "RaiseAndCaughtMultipleHandlerLocal", 2)]
- [TestCase(29, "FinallyWithNonThrowingLocal", 123)]
- [TestCase(129, "FinallyWithThrowingAndNestedLocal", 123)]
- [TestCase(129, "FinallyAndCaughtWithThrowingAndNestedLocal", 123, true)]
- [TestCase(29, "FinallyAndCaughtWithThrowingAndNestedLocal", 123, false)]
- [TestCase(30, new[] { "FinallyAndCaughtWithThrowingAndNestedGlobal", "RaiseException" }, 123, false, false)]
- [TestCase(30, new[] { "FinallyAndCaughtWithThrowingAndNestedGlobal", "RaiseException" }, 123, false, true)]
- [TestCase(12, new[] { "FinallyAndCaughtWithThrowingAndNestedGlobal", "RaiseException" }, 123, true, false)]
- [TestCase(112, new[] { "FinallyAndCaughtWithThrowingAndNestedGlobal", "RaiseException" }, 123, true, true)]
- [TestCase(123, "RaiseAndNestedCaughtLocal", 123)]
- [TestCase(123, "RaiseAndNestedCaughtOuterLocal", 123)]
- [TestCase(223, "RaiseCaughtAndRethrowLocal", 123)]
- [TestCase(223, "RaiseCaughtAndThrowNewExceptionLocal", 123)]
- [TestCase(223, "FinallyThrowNewExceptionLocal", 123)]
- [TestCase(123, new[] { "RaiseAndCaughtGlobal", "RaiseException" }, false)]
- [TestCase(456, new[] { "RaiseAndCaughtGlobal", "RaiseException" }, true)]
- [TestCase(true, "RaiseCaughtAndNestedBlockLocal")]
- [TestCase(true, "RaiseCaughtAndRethrowOnNestedBlockLocal")]
- [TestCase(true, "RaiseCaughtAndRethrowOnMultipleNestedBlockLocal")]
- [TestCase(true, "RaiseCaughtAndRethrowInsideLocal")]
- [TestCase(true, "RaiseCaughtAndRethrowOutsideLocal")]
public sealed class ExceptionHandling
{
+ [TestCase(123, "RaiseAndCaughtLocal", false)]
+ [TestCase(456, "RaiseAndCaughtLocal", true)]
public static int RaiseAndCaughtLocal(bool sw)
{
try
@@ -61,7 +32,9 @@ public static int RaiseAndCaughtLocal(bool sw)
return 123;
}
- public static string? RaiseCaughtAndAccessLocal(string value)
+ [TestCase("ABC", "RaiseCaughtAndAccessLocal", "ABC")]
+ [TestCase(null, "RaiseCaughtAndAccessLocal", null!, Assert = TestCaseAsserts.PerfectMatch)]
+ public static string? RaiseCaughtAndAccessLocal(string? value)
{
try
{
@@ -74,7 +47,9 @@ public static int RaiseAndCaughtLocal(bool sw)
return null;
}
- public static string? RaiseCaughtNarrowingLocal(string value)
+ [TestCase("ABC", "RaiseCaughtNarrowingLocal", "ABC")]
+ [TestCase(null, "RaiseCaughtNarrowingLocal", null!, Assert = TestCaseAsserts.PerfectMatch)]
+ public static string? RaiseCaughtNarrowingLocal(string? value)
{
try
{
@@ -87,7 +62,9 @@ public static int RaiseAndCaughtLocal(bool sw)
return null;
}
- public static string? RaiseCaughtWildcardLocal(string value)
+ [TestCase("ABC", "RaiseCaughtWildcardLocal", "ABC")]
+ [TestCase(null, "RaiseCaughtWildcardLocal", null!, Assert = TestCaseAsserts.PerfectMatch)]
+ public static string? RaiseCaughtWildcardLocal(string? value)
{
try
{
@@ -100,6 +77,9 @@ public static int RaiseAndCaughtLocal(bool sw)
return null;
}
+ [TestCase(123, "RaiseAndCaughtMultipleHandlerLocal", 0)]
+ [TestCase(456, "RaiseAndCaughtMultipleHandlerLocal", 1)]
+ [TestCase(789, "RaiseAndCaughtMultipleHandlerLocal", 2)]
public static int RaiseAndCaughtMultipleHandlerLocal(int sw)
{
try
@@ -118,6 +98,7 @@ public static int RaiseAndCaughtMultipleHandlerLocal(int sw)
return 123;
}
+ [TestCase(29, "FinallyWithNonThrowingLocal", 123)]
public static int FinallyWithNonThrowingLocal(int value)
{
int r = 0;
@@ -133,6 +114,7 @@ public static int FinallyWithNonThrowingLocal(int value)
return r;
}
+ [TestCase(129, "FinallyWithThrowingAndNestedLocal", 123)]
public static int FinallyWithThrowingAndNestedLocal(int value)
{
int r = value;
@@ -155,6 +137,8 @@ public static int FinallyWithThrowingAndNestedLocal(int value)
return r;
}
+ [TestCase(129, "FinallyAndCaughtWithThrowingAndNestedLocal", 123, true)]
+ [TestCase(29, "FinallyAndCaughtWithThrowingAndNestedLocal", 123, false)]
public static int FinallyAndCaughtWithThrowingAndNestedLocal(int value, bool rethrow)
{
int r = 0;
@@ -187,6 +171,10 @@ private static void RaiseException(bool sw)
if (sw) throw new Exception();
}
+ [TestCase(30, new[] { "FinallyAndCaughtWithThrowingAndNestedGlobal", "RaiseException" }, 123, false, false)]
+ [TestCase(30, new[] { "FinallyAndCaughtWithThrowingAndNestedGlobal", "RaiseException" }, 123, false, true)]
+ [TestCase(12, new[] { "FinallyAndCaughtWithThrowingAndNestedGlobal", "RaiseException" }, 123, true, false)]
+ [TestCase(112, new[] { "FinallyAndCaughtWithThrowingAndNestedGlobal", "RaiseException" }, 123, true, true)]
public static int FinallyAndCaughtWithThrowingAndNestedGlobal(int value, bool sw, bool rethrow)
{
int r = 500;
@@ -214,6 +202,7 @@ public static int FinallyAndCaughtWithThrowingAndNestedGlobal(int value, bool sw
return r;
}
+ [TestCase(123, "RaiseAndNestedCaughtLocal", 123)]
public static int RaiseAndNestedCaughtLocal(int value)
{
int r = 0;
@@ -236,6 +225,7 @@ public static int RaiseAndNestedCaughtLocal(int value)
return r;
}
+ [TestCase(123, "RaiseAndNestedCaughtOuterLocal", 123)]
public static int RaiseAndNestedCaughtOuterLocal(int value)
{
int r = 0;
@@ -258,6 +248,7 @@ public static int RaiseAndNestedCaughtOuterLocal(int value)
return r;
}
+ [TestCase(223, "RaiseCaughtAndRethrowLocal", 123)]
public static int RaiseCaughtAndRethrowLocal(int value)
{
int r = 0;
@@ -281,6 +272,7 @@ public static int RaiseCaughtAndRethrowLocal(int value)
return r;
}
+ [TestCase(223, "RaiseCaughtAndThrowNewExceptionLocal", 123)]
public static int RaiseCaughtAndThrowNewExceptionLocal(int value)
{
int r = 0;
@@ -304,6 +296,7 @@ public static int RaiseCaughtAndThrowNewExceptionLocal(int value)
return r;
}
+ [TestCase(223, "FinallyThrowNewExceptionLocal", 123)]
public static int FinallyThrowNewExceptionLocal(int value)
{
int r = 0;
@@ -327,6 +320,8 @@ public static int FinallyThrowNewExceptionLocal(int value)
return r;
}
+ [TestCase(123, new[] { "RaiseAndCaughtGlobal", "RaiseException" }, false)]
+ [TestCase(456, new[] { "RaiseAndCaughtGlobal", "RaiseException" }, true)]
public static int RaiseAndCaughtGlobal(bool sw)
{
try
@@ -340,6 +335,7 @@ public static int RaiseAndCaughtGlobal(bool sw)
return 123;
}
+ [TestCase(true, "RaiseCaughtAndNestedBlockLocal")]
public static bool RaiseCaughtAndNestedBlockLocal()
{
var ex1 = new Exception();
@@ -361,6 +357,7 @@ public static bool RaiseCaughtAndNestedBlockLocal()
}
}
+ [TestCase(true, "RaiseCaughtAndRethrowOnNestedBlockLocal")]
public static bool RaiseCaughtAndRethrowOnNestedBlockLocal()
{
var ex1 = new Exception();
@@ -381,6 +378,7 @@ public static bool RaiseCaughtAndRethrowOnNestedBlockLocal()
}
}
+ [TestCase(true, "RaiseCaughtAndRethrowOnMultipleNestedBlockLocal")]
public static bool RaiseCaughtAndRethrowOnMultipleNestedBlockLocal()
{
var ex1 = new Exception();
@@ -410,6 +408,7 @@ public static bool RaiseCaughtAndRethrowOnMultipleNestedBlockLocal()
}
}
+ [TestCase(true, "RaiseCaughtAndRethrowInsideLocal")]
public static bool RaiseCaughtAndRethrowInsideLocal()
{
var ex1 = new Exception();
@@ -448,6 +447,7 @@ public static bool RaiseCaughtAndRethrowInsideLocal()
}
}
+ [TestCase(true, "RaiseCaughtAndRethrowOutsideLocal")]
public static bool RaiseCaughtAndRethrowOutsideLocal()
{
var ex1 = new Exception();
diff --git a/tests/IL2C.Core.Test.RuntimeSystems/ExceptionThrownByCLI/ArrayIndexOutOfRangeExceptions.cs b/tests/IL2C.Core.Test.RuntimeSystems/ExceptionThrownByCLI/ArrayIndexOutOfRangeExceptions.cs
index 4307414f..50881bc0 100644
--- a/tests/IL2C.Core.Test.RuntimeSystems/ExceptionThrownByCLI/ArrayIndexOutOfRangeExceptions.cs
+++ b/tests/IL2C.Core.Test.RuntimeSystems/ExceptionThrownByCLI/ArrayIndexOutOfRangeExceptions.cs
@@ -15,16 +15,12 @@
namespace IL2C.RuntimeSystems
{
[TestId("ExceptionThrownByCLI")]
- [TestCase(false, "ArrayIndexOutOfRangeByLoad", 0)]
- [TestCase(false, "ArrayIndexOutOfRangeByLoad", 6)]
- [TestCase(true, "ArrayIndexOutOfRangeByLoad", -1)]
- [TestCase(true, "ArrayIndexOutOfRangeByLoad", 7)]
- [TestCase(false, "ArrayIndexOutOfRangeByStore", 0)]
- [TestCase(false, "ArrayIndexOutOfRangeByStore", 6)]
- [TestCase(true, "ArrayIndexOutOfRangeByStore", -1)]
- [TestCase(true, "ArrayIndexOutOfRangeByStore", 7)]
public sealed class ArrayIndexOutOfRangeExceptions
{
+ [TestCase(false, "ArrayIndexOutOfRangeByLoad", 0)]
+ [TestCase(false, "ArrayIndexOutOfRangeByLoad", 6)]
+ [TestCase(true, "ArrayIndexOutOfRangeByLoad", -1)]
+ [TestCase(true, "ArrayIndexOutOfRangeByLoad", 7)]
public static bool ArrayIndexOutOfRangeByLoad(int index)
{
try
@@ -39,6 +35,10 @@ public static bool ArrayIndexOutOfRangeByLoad(int index)
return false;
}
+ [TestCase(false, "ArrayIndexOutOfRangeByStore", 0)]
+ [TestCase(false, "ArrayIndexOutOfRangeByStore", 6)]
+ [TestCase(true, "ArrayIndexOutOfRangeByStore", -1)]
+ [TestCase(true, "ArrayIndexOutOfRangeByStore", 7)]
public static bool ArrayIndexOutOfRangeByStore(int index)
{
try
diff --git a/tests/IL2C.Core.Test.RuntimeSystems/ExceptionThrownByCLI/InvalidCastExceptions.cs b/tests/IL2C.Core.Test.RuntimeSystems/ExceptionThrownByCLI/InvalidCastExceptions.cs
index 611d6f7d..52c4f9f1 100644
--- a/tests/IL2C.Core.Test.RuntimeSystems/ExceptionThrownByCLI/InvalidCastExceptions.cs
+++ b/tests/IL2C.Core.Test.RuntimeSystems/ExceptionThrownByCLI/InvalidCastExceptions.cs
@@ -22,29 +22,11 @@ namespace IL2C.RuntimeSystems
[Description("These tests are verified the IL2C throw some exceptions from the internal runtimes by ECMA-335 I.12.4.2.1.")]
[TestId("ExceptionThrownByCLI")]
- [TestCase(true, "InvalidCastExceptionFromStringToString", Assert = TestCaseAsserts.IgnoreValidateInvokeResult)]
- [TestCase(true, "InvalidCastExceptionFromInt32ToString", Assert = TestCaseAsserts.IgnoreValidateInvokeResult)]
- [TestCase(true, new[] { "InvalidCastExceptionFromDelegateToString", "TestTarget" }, IncludeTypes = new[] { typeof(ObjectModelInstructionsTestDelegate) }, Assert = TestCaseAsserts.IgnoreValidateInvokeResult)]
- [TestCase(true, "InvalidCastExceptionFromByteToByte", Assert = TestCaseAsserts.IgnoreValidateInvokeResult)]
- [TestCase(true, "InvalidCastExceptionFromByteToInt16", Assert = TestCaseAsserts.IgnoreValidateInvokeResult)]
- [TestCase(true, "InvalidCastExceptionFromByteToInt32", Assert = TestCaseAsserts.IgnoreValidateInvokeResult)]
- [TestCase(true, "InvalidCastExceptionFromByteToInt64", Assert = TestCaseAsserts.IgnoreValidateInvokeResult)]
- [TestCase(true, "InvalidCastExceptionFromInt16ToByte", Assert = TestCaseAsserts.IgnoreValidateInvokeResult)]
- [TestCase(true, "InvalidCastExceptionFromInt16ToInt16", Assert = TestCaseAsserts.IgnoreValidateInvokeResult)]
- [TestCase(true, "InvalidCastExceptionFromInt16ToInt32", Assert = TestCaseAsserts.IgnoreValidateInvokeResult)]
- [TestCase(true, "InvalidCastExceptionFromInt16ToInt64", Assert = TestCaseAsserts.IgnoreValidateInvokeResult)]
- [TestCase(true, "InvalidCastExceptionFromInt32ToByte", Assert = TestCaseAsserts.IgnoreValidateInvokeResult)]
- [TestCase(true, "InvalidCastExceptionFromInt32ToInt16", Assert = TestCaseAsserts.IgnoreValidateInvokeResult)]
- [TestCase(true, "InvalidCastExceptionFromInt32ToInt32", Assert = TestCaseAsserts.IgnoreValidateInvokeResult)]
- [TestCase(true, "InvalidCastExceptionFromInt32ToInt64", Assert = TestCaseAsserts.IgnoreValidateInvokeResult)]
- [TestCase(true, "InvalidCastExceptionFromInt64ToByte", Assert = TestCaseAsserts.IgnoreValidateInvokeResult)]
- [TestCase(true, "InvalidCastExceptionFromInt64ToInt16", Assert = TestCaseAsserts.IgnoreValidateInvokeResult)]
- [TestCase(true, "InvalidCastExceptionFromInt64ToInt32", Assert = TestCaseAsserts.IgnoreValidateInvokeResult)]
- [TestCase(true, "InvalidCastExceptionFromInt64ToInt64", Assert = TestCaseAsserts.IgnoreValidateInvokeResult)]
public sealed class InvalidCastExceptions
{
// These cases become from ECMA-335 I.12.4.2.1 - Exceptions thrown by the CLI - Object Model Instructions
+ [TestCase(true, "InvalidCastExceptionFromStringToString")]
public static bool InvalidCastExceptionFromStringToString()
{
object value = "ABC";
@@ -54,11 +36,12 @@ public static bool InvalidCastExceptionFromStringToString()
}
catch (InvalidCastException)
{
- return false;
+ return true;
}
return true;
}
+ [TestCase(true, "InvalidCastExceptionFromInt32ToString")]
public static bool InvalidCastExceptionFromInt32ToString()
{
object value = 123;
@@ -66,12 +49,8 @@ public static bool InvalidCastExceptionFromInt32ToString()
{
var foo = (string)value;
}
- catch (InvalidCastException ex)
+ catch (InvalidCastException)
{
- if (ex.Message != "Specified cast is not valid.")
- {
- throw;
- }
return true;
}
return false;
@@ -82,6 +61,7 @@ public static string TestTarget(string from)
return from;
}
+ [TestCase(true, new[] { "InvalidCastExceptionFromDelegateToString", "TestTarget" }, IncludeTypes = new[] { typeof(ObjectModelInstructionsTestDelegate) })]
public static bool InvalidCastExceptionFromDelegateToString()
{
try
@@ -89,17 +69,14 @@ public static bool InvalidCastExceptionFromDelegateToString()
object dlg = new ObjectModelInstructionsTestDelegate(TestTarget);
var foo = (string)dlg;
}
- catch (InvalidCastException ex)
+ catch (InvalidCastException)
{
- if (ex.Message != "Specified cast is not valid.")
- {
- throw;
- }
return true;
}
return false;
}
+ [TestCase(false, "InvalidCastExceptionFromByteToByte")]
public static bool InvalidCastExceptionFromByteToByte()
{
object value = (byte)123;
@@ -109,11 +86,12 @@ public static bool InvalidCastExceptionFromByteToByte()
}
catch (InvalidCastException)
{
- return false;
+ return true;
}
- return true;
+ return false;
}
+ [TestCase(true, "InvalidCastExceptionFromByteToInt16")]
public static bool InvalidCastExceptionFromByteToInt16()
{
object value = (byte)123;
@@ -121,17 +99,14 @@ public static bool InvalidCastExceptionFromByteToInt16()
{
var foo = (short)value;
}
- catch (InvalidCastException ex)
+ catch (InvalidCastException)
{
- if (ex.Message != "Specified cast is not valid.")
- {
- throw;
- }
return true;
}
return false;
}
+ [TestCase(true, "InvalidCastExceptionFromByteToInt32")]
public static bool InvalidCastExceptionFromByteToInt32()
{
object value = (byte)123;
@@ -139,17 +114,14 @@ public static bool InvalidCastExceptionFromByteToInt32()
{
var foo = (int)value;
}
- catch (InvalidCastException ex)
+ catch (InvalidCastException)
{
- if (ex.Message != "Specified cast is not valid.")
- {
- throw;
- }
return true;
}
return false;
}
+ [TestCase(true, "InvalidCastExceptionFromByteToInt64")]
public static bool InvalidCastExceptionFromByteToInt64()
{
object value = (byte)123;
@@ -157,17 +129,14 @@ public static bool InvalidCastExceptionFromByteToInt64()
{
var foo = (long)value;
}
- catch (InvalidCastException ex)
+ catch (InvalidCastException)
{
- if (ex.Message != "Specified cast is not valid.")
- {
- throw;
- }
return true;
}
return false;
}
+ [TestCase(true, "InvalidCastExceptionFromInt16ToByte")]
public static bool InvalidCastExceptionFromInt16ToByte()
{
object value = (short)123;
@@ -175,17 +144,14 @@ public static bool InvalidCastExceptionFromInt16ToByte()
{
var foo = (byte)value;
}
- catch (InvalidCastException ex)
+ catch (InvalidCastException)
{
- if (ex.Message != "Specified cast is not valid.")
- {
- throw;
- }
return true;
}
return false;
}
+ [TestCase(false, "InvalidCastExceptionFromInt16ToInt16")]
public static bool InvalidCastExceptionFromInt16ToInt16()
{
object value = (short)123;
@@ -195,11 +161,12 @@ public static bool InvalidCastExceptionFromInt16ToInt16()
}
catch (InvalidCastException)
{
- return false;
+ return true;
}
- return true;
+ return false;
}
+ [TestCase(true, "InvalidCastExceptionFromInt16ToInt32")]
public static bool InvalidCastExceptionFromInt16ToInt32()
{
object value = (short)123;
@@ -207,17 +174,14 @@ public static bool InvalidCastExceptionFromInt16ToInt32()
{
var foo = (int)value;
}
- catch (InvalidCastException ex)
+ catch (InvalidCastException)
{
- if (ex.Message != "Specified cast is not valid.")
- {
- throw;
- }
return true;
}
return false;
}
+ [TestCase(true, "InvalidCastExceptionFromInt16ToInt64")]
public static bool InvalidCastExceptionFromInt16ToInt64()
{
object value = (short)123;
@@ -225,17 +189,14 @@ public static bool InvalidCastExceptionFromInt16ToInt64()
{
var foo = (long)value;
}
- catch (InvalidCastException ex)
+ catch (InvalidCastException)
{
- if (ex.Message != "Specified cast is not valid.")
- {
- throw;
- }
return true;
}
return false;
}
+ [TestCase(true, "InvalidCastExceptionFromInt32ToByte")]
public static bool InvalidCastExceptionFromInt32ToByte()
{
object value = 123;
@@ -243,17 +204,14 @@ public static bool InvalidCastExceptionFromInt32ToByte()
{
var foo = (byte)value;
}
- catch (InvalidCastException ex)
+ catch (InvalidCastException)
{
- if (ex.Message != "Specified cast is not valid.")
- {
- throw;
- }
return true;
}
return false;
}
+ [TestCase(true, "InvalidCastExceptionFromInt32ToInt16")]
public static bool InvalidCastExceptionFromInt32ToInt16()
{
object value = 123;
@@ -261,17 +219,14 @@ public static bool InvalidCastExceptionFromInt32ToInt16()
{
var foo = (short)value;
}
- catch (InvalidCastException ex)
+ catch (InvalidCastException)
{
- if (ex.Message != "Specified cast is not valid.")
- {
- throw;
- }
return true;
}
return false;
}
+ [TestCase(false, "InvalidCastExceptionFromInt32ToInt32")]
public static bool InvalidCastExceptionFromInt32ToInt32()
{
object value = 123;
@@ -281,11 +236,12 @@ public static bool InvalidCastExceptionFromInt32ToInt32()
}
catch (InvalidCastException)
{
- return false;
+ return true;
}
- return true;
+ return false;
}
+ [TestCase(true, "InvalidCastExceptionFromInt32ToInt64")]
public static bool InvalidCastExceptionFromInt32ToInt64()
{
object value = 123;
@@ -293,17 +249,14 @@ public static bool InvalidCastExceptionFromInt32ToInt64()
{
var foo = (long)value;
}
- catch (InvalidCastException ex)
+ catch (InvalidCastException)
{
- if (ex.Message != "Specified cast is not valid.")
- {
- throw;
- }
return true;
}
return false;
}
+ [TestCase(true, "InvalidCastExceptionFromInt64ToByte")]
public static bool InvalidCastExceptionFromInt64ToByte()
{
object value = (long)123;
@@ -311,17 +264,14 @@ public static bool InvalidCastExceptionFromInt64ToByte()
{
var foo = (byte)value;
}
- catch (InvalidCastException ex)
+ catch (InvalidCastException)
{
- if (ex.Message != "Specified cast is not valid.")
- {
- throw;
- }
return true;
}
return false;
}
+ [TestCase(true, "InvalidCastExceptionFromInt64ToInt16")]
public static bool InvalidCastExceptionFromInt64ToInt16()
{
object value = (long)123;
@@ -329,36 +279,30 @@ public static bool InvalidCastExceptionFromInt64ToInt16()
{
var foo = (short)value;
}
- catch (InvalidCastException ex)
+ catch (InvalidCastException)
{
- if (ex.Message != "Specified cast is not valid.")
- {
- throw;
- }
return true;
}
return false;
}
- public static bool InvalidCastExceptionFromInt64ToInt64()
+ [TestCase(true, "InvalidCastExceptionFromInt64ToInt32")]
+ public static bool InvalidCastExceptionFromInt64ToInt32()
{
object value = (long)123;
try
{
var foo = (int)value;
}
- catch (InvalidCastException ex)
+ catch (InvalidCastException)
{
- if (ex.Message != "Specified cast is not valid.")
- {
- throw;
- }
return true;
}
return false;
}
- public static bool InvalidCastExceptionFromInt64ToInt32()
+ [TestCase(false, "InvalidCastExceptionFromInt64ToInt64")]
+ public static bool InvalidCastExceptionFromInt64ToInt64()
{
object value = (long)123;
try
@@ -367,9 +311,9 @@ public static bool InvalidCastExceptionFromInt64ToInt32()
}
catch (InvalidCastException)
{
- return false;
+ return true;
}
- return true;
+ return false;
}
}
}
diff --git a/tests/IL2C.Core.Test.RuntimeSystems/ExceptionThrownByCLI/NullReferenceExceptions.cs b/tests/IL2C.Core.Test.RuntimeSystems/ExceptionThrownByCLI/NullReferenceExceptions.cs
index 1d90e95c..1009792b 100644
--- a/tests/IL2C.Core.Test.RuntimeSystems/ExceptionThrownByCLI/NullReferenceExceptions.cs
+++ b/tests/IL2C.Core.Test.RuntimeSystems/ExceptionThrownByCLI/NullReferenceExceptions.cs
@@ -8,71 +8,66 @@
////////////////////////////////////////////////////////////////////////////
using System;
-using System.ComponentModel;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
namespace IL2C.RuntimeSystems
{
[TestId("ExceptionThrownByCLI")]
- [TestCase(false, "NullReference", "ABC")]
- [TestCase(true, "NullReference", null!)]
- [TestCase(false, "NullReferenceTwoTimes", "ABC")] // Test for re-register signal handler
- [TestCase(true, "NullReferenceTwoTimes", null!)]
- [TestCase(false, "NullReferenceAtTheUnbox", (object)123)]
- [TestCase(true, "NullReferenceAtTheUnbox", null!)]
public sealed class NullReferenceExceptions
{
+ [TestCase(false, "NullReference", "ABC")]
+ [TestCase(true, "NullReference", null!)]
public static bool NullReference(object v)
{
try
{
var r = v.ToString();
}
- catch (NullReferenceException ex)
+ catch (NullReferenceException)
{
- return ex.Message == "Object reference not set to an instance of an object.";
+ return true;
}
return false;
}
+ [TestCase(false, "NullReferenceTwoTimes", "ABC")] // Test for re-register signal handler
+ [TestCase(true, "NullReferenceTwoTimes", null!)]
public static bool NullReferenceTwoTimes(object v)
{
+ var s1 = false;
try
{
var r = v.ToString();
}
- catch (NullReferenceException ex)
+ catch (NullReferenceException)
{
- if (ex.Message != "Object reference not set to an instance of an object.")
- {
- return false;
- }
+ s1 = true;
}
+ var s2 = false;
try
{
var r = v.ToString();
}
- catch (NullReferenceException ex)
+ catch (NullReferenceException)
{
- return ex.Message == "Object reference not set to an instance of an object.";
+ s2 = true;
}
- return false;
+ return s1 && s2;
}
+ [TestCase(false, "NullReferenceAtTheUnbox", (object)123)]
+ [TestCase(true, "NullReferenceAtTheUnbox", null!)]
public static bool NullReferenceAtTheUnbox(object value)
{
try
{
var v = (int)value;
}
- catch (NullReferenceException ex)
+ catch (NullReferenceException)
{
- return ex.Message == "Object reference not set to an instance of an object.";
+ return true;
}
-
return false;
}
}
diff --git a/tests/IL2C.Core.Test.RuntimeSystems/GarbageCollection/GarbageCollection.cs b/tests/IL2C.Core.Test.RuntimeSystems/GarbageCollection/GarbageCollection.cs
index e3f27e0e..4587bd25 100644
--- a/tests/IL2C.Core.Test.RuntimeSystems/GarbageCollection/GarbageCollection.cs
+++ b/tests/IL2C.Core.Test.RuntimeSystems/GarbageCollection/GarbageCollection.cs
@@ -94,7 +94,7 @@ public FinalzerImplementedWithPinned(FinalizerCalleeHolder holder)
~FinalzerImplementedWithPinned()
{
- var holder = (FinalizerCalleeHolder)(handle.Target);
+ var holder = (FinalizerCalleeHolder)(handle.Target!);
holder.Called = 1;
}
}
@@ -172,6 +172,7 @@ public void Run()
while (!abort)
{
GC.Collect();
+ Thread.Sleep(1);
}
}
}
@@ -185,42 +186,27 @@ public ConcurrentCollectValueHolder(int value) =>
}
[Description("These tests are verified the IL2C manages tracing the object references and collect garbages from the heap memory.")]
- [TestCase("ABCDEF", "ObjRefInsideObjRef", IncludeTypes = new[] { typeof(ObjRefInsideObjRefType) })]
- [TestCase("ABCDEF", "ObjRefInsideValueType", IncludeTypes = new[] { typeof(ObjRefInsideValueTypeType) })]
- [TestCase("ABCDEF", "ObjRefInsideValueTypeInsideObjRef", IncludeTypes = new[] { typeof(ObjRefInsideValueTypeInsideObjRefType), typeof(ObjRefInsideValueTypeType) })]
- [TestCase("ABCDEF", "ObjRefInsideObjRefInsideValueType", IncludeTypes = new[] { typeof(ObjRefInsideObjRefInsideValueTypeType), typeof(ObjRefInsideObjRefType) })]
- [TestCase("ABCDEF1", "MultipleInsideValueType", 0, IncludeTypes = new[] { typeof(MultipleInsideValueTypeType), typeof(ObjRefInsideValueTypeType), typeof(ObjRefInsideObjRefType) })]
- [TestCase("ABCDEF2", "MultipleInsideValueType", 1, IncludeTypes = new[] { typeof(MultipleInsideValueTypeType), typeof(ObjRefInsideValueTypeType), typeof(ObjRefInsideObjRefType) })]
- [TestCase("ABCDEF3", "MultipleInsideValueType", 2, IncludeTypes = new[] { typeof(MultipleInsideValueTypeType), typeof(ObjRefInsideValueTypeType), typeof(ObjRefInsideObjRefType) })]
- [TestCase("ABCDEFABCGHI", new[] { "ArrayForObjRefInsideObjRefTypeTracking", "MakeArrayForObjRefInsideObjRefType" }, "ABC", "DEF", "GHI", IncludeTypes = new[] { typeof(ObjRefInsideObjRefType) })]
- [TestCase("ABCDEFABCGHI", new[] { "ArrayForObjRefInsideValueTypeTypeTracking", "MakeArrayForObjRefInsideValueTypeType" }, "ABC", "DEF", "GHI", IncludeTypes = new[] { typeof(ObjRefInsideValueTypeType) })]
- [TestCase("ABCDEFGHI", new[] { "DelegateMarkHandlerTracking", "MakeDelegateMarkHandlerForObjRefTestDelegate" }, "ABC", "DEF", IncludeTypes = new[] { typeof(DelegateMarkHandlerForObjRef), typeof(DelegateMarkHandlerForObjRefTestDelegate) })]
- [TestCase("ABCGHIJKL", new[] { "MulticastDelegateMarkHandlerTracking", "MakeMulticastDelegateMarkHandlerForObjRefTestDelegate" }, "ABC", "DEF", "GHI", IncludeTypes = new[] { typeof(DelegateMarkHandlerForObjRef), typeof(DelegateMarkHandlerForObjRefTestDelegate) })]
- [TestCase(12345, new[] { "TraceStaticField", "RunTraceStaticField" }, 12345, IncludeTypes = new[] { typeof(StaticFieldTracible), typeof(StaticFieldInstanceType) })]
- [TestCase(1, new[] { "CallFinalizerByCollect", "RunCallFinalizer" }, IncludeTypes = new[] { typeof(FinalzerImplemented), typeof(FinalizerCalleeHolder) })]
- [TestCase(1, new[] { "CallFinalizerByCollectWithGeneration", "RunCallFinalizer" }, 0, IncludeTypes = new[] { typeof(FinalzerImplemented), typeof(FinalizerCalleeHolder) })]
- [TestCase(1, new[] { "CallFinalizerByCollectWithGeneration", "RunCallFinalizer" }, 1, IncludeTypes = new[] { typeof(FinalzerImplemented), typeof(FinalizerCalleeHolder) })]
- [TestCase(1, new[] { "CallFinalizerByCollectWithGeneration", "RunCallFinalizer" }, 2, IncludeTypes = new[] { typeof(FinalzerImplemented), typeof(FinalizerCalleeHolder) })]
- [TestCase(0, new[] { "DontCallFinalizerByCollectWithPinned", "RunDontCallFinalizerWithPinned" }, IncludeTypes = new[] { typeof(FinalzerImplementedWithPinned), typeof(FinalizerCalleeHolder) })]
- [TestCase(123, new[] { "DontCollectWithResurrect", "RunDontCollectWithResurrect" }, 123, IncludeTypes = new[] { typeof(FinalzerImplementedWithResurrect) })]
- [TestCase(2, new[] { "CallFinalizerByCollectWithReRegister", "RunCallFinalizerWithReRegister" }, IncludeTypes = new[] { typeof(FinalzerImplementedWithReRegister), typeof(FinalizerCalleeHolder) })]
- [TestCase(0, new[] { "SuppressFinalize", "RunCallFinalizerWithSuppressed" }, IncludeTypes = new[] { typeof(FinalzerImplemented), typeof(FinalizerCalleeHolder) })]
- [TestCase(1, new[] { "ReRegisterForFinalize", "RunCallFinalizerWithSuppressedAndReRegistered" }, IncludeTypes = new[] { typeof(FinalzerImplemented), typeof(FinalizerCalleeHolder) })]
- [TestCase(200000, "ConcurrentCollect", 10, 100000, IncludeTypes = new[] { typeof(ConcurrentCollectClosure), typeof(ConcurrentCollectValueHolder) })]
public sealed class GarbageCollection
{
+ [TestCase("ABCDEF", "ObjRefInsideObjRef", IncludeTypes = new[] { typeof(ObjRefInsideObjRefType) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string ObjRefInsideObjRef();
+ [TestCase("ABCDEF", "ObjRefInsideValueType", IncludeTypes = new[] { typeof(ObjRefInsideValueTypeType) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string ObjRefInsideValueType();
+ [TestCase("ABCDEF", "ObjRefInsideValueTypeInsideObjRef", IncludeTypes = new[] { typeof(ObjRefInsideValueTypeInsideObjRefType), typeof(ObjRefInsideValueTypeType) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string ObjRefInsideValueTypeInsideObjRef();
+ [TestCase("ABCDEF", "ObjRefInsideObjRefInsideValueType", IncludeTypes = new[] { typeof(ObjRefInsideObjRefInsideValueTypeType), typeof(ObjRefInsideObjRefType) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string ObjRefInsideObjRefInsideValueType();
+ [TestCase("ABCDEF1", "MultipleInsideValueType", 0, IncludeTypes = new[] { typeof(MultipleInsideValueTypeType), typeof(ObjRefInsideValueTypeType), typeof(ObjRefInsideObjRefType) })]
+ [TestCase("ABCDEF2", "MultipleInsideValueType", 1, IncludeTypes = new[] { typeof(MultipleInsideValueTypeType), typeof(ObjRefInsideValueTypeType), typeof(ObjRefInsideObjRefType) })]
+ [TestCase("ABCDEF3", "MultipleInsideValueType", 2, IncludeTypes = new[] { typeof(MultipleInsideValueTypeType), typeof(ObjRefInsideValueTypeType), typeof(ObjRefInsideObjRefType) })]
[MethodImpl(MethodImplOptions.ForwardRef)]
public static extern string MultipleInsideValueType(int index);
@@ -235,6 +221,7 @@ private static void RunTraceStaticField(int value)
private static ObjRefInsideObjRefType[] MakeArrayForObjRefInsideObjRefType(string a, string b, string c) =>
new[] { new ObjRefInsideObjRefType(a + b), new ObjRefInsideObjRefType(a + c) };
+ [TestCase("ABCDEFABCGHI", new[] { "ArrayForObjRefInsideObjRefTypeTracking", "MakeArrayForObjRefInsideObjRefType" }, "ABC", "DEF", "GHI", IncludeTypes = new[] { typeof(ObjRefInsideObjRefType) })]
public static string ArrayForObjRefInsideObjRefTypeTracking(string a, string b, string c)
{
// Test for Array_MarkHandler.
@@ -249,6 +236,7 @@ public static string ArrayForObjRefInsideObjRefTypeTracking(string a, string b,
private static ObjRefInsideValueTypeType[] MakeArrayForObjRefInsideValueTypeType(string a, string b, string c) =>
new[] { new ObjRefInsideValueTypeType(a + b), new ObjRefInsideValueTypeType(a + c) };
+ [TestCase("ABCDEFABCGHI", new[] { "ArrayForObjRefInsideValueTypeTypeTracking", "MakeArrayForObjRefInsideValueTypeType" }, "ABC", "DEF", "GHI", IncludeTypes = new[] { typeof(ObjRefInsideValueTypeType) })]
public static string ArrayForObjRefInsideValueTypeTypeTracking(string a, string b, string c)
{
// Test for Array_MarkHandler.
@@ -266,6 +254,7 @@ private static DelegateMarkHandlerForObjRefTestDelegate MakeDelegateMarkHandlerF
return new DelegateMarkHandlerForObjRefTestDelegate(target.CombineForStrings);
}
+ [TestCase("ABCDEFGHI", new[] { "DelegateMarkHandlerTracking", "MakeDelegateMarkHandlerForObjRefTestDelegate" }, "ABC", "DEF", IncludeTypes = new[] { typeof(DelegateMarkHandlerForObjRef), typeof(DelegateMarkHandlerForObjRefTestDelegate) })]
public static string DelegateMarkHandlerTracking(string a, string b)
{
// Test for Delegate_MarkHandler.
@@ -286,6 +275,7 @@ private static DelegateMarkHandlerForObjRefTestDelegate MakeMulticastDelegateMar
new DelegateMarkHandlerForObjRefTestDelegate(target2.CombineForStrings);
}
+ [TestCase("ABCGHIJKL", new[] { "MulticastDelegateMarkHandlerTracking", "MakeMulticastDelegateMarkHandlerForObjRefTestDelegate" }, "ABC", "DEF", "GHI", IncludeTypes = new[] { typeof(DelegateMarkHandlerForObjRef), typeof(DelegateMarkHandlerForObjRefTestDelegate) })]
public static string MulticastDelegateMarkHandlerTracking(string a, string b, string c)
{
// Test for Delegate_MarkHandler (tracks each delegate target)
@@ -297,6 +287,7 @@ public static string MulticastDelegateMarkHandlerTracking(string a, string b, st
return d("JKL");
}
+ [TestCase(12345, new[] { "TraceStaticField", "RunTraceStaticField" }, 12345, IncludeTypes = new[] { typeof(StaticFieldTracible), typeof(StaticFieldInstanceType) })]
public static int TraceStaticField(int value)
{
RunTraceStaticField(value);
@@ -312,6 +303,7 @@ private static void RunCallFinalizer(FinalizerCalleeHolder holder)
var implemented = new FinalzerImplemented(holder);
}
+ [TestCase(1, new[] { "CallFinalizerByCollect", "RunCallFinalizer" }, IncludeTypes = new[] { typeof(FinalzerImplemented), typeof(FinalizerCalleeHolder) })]
public static int CallFinalizerByCollect()
{
var holder = new FinalizerCalleeHolder();
@@ -323,6 +315,9 @@ public static int CallFinalizerByCollect()
return holder.Called;
}
+ [TestCase(1, new[] { "CallFinalizerByCollectWithGeneration", "RunCallFinalizer" }, 0, IncludeTypes = new[] { typeof(FinalzerImplemented), typeof(FinalizerCalleeHolder) })]
+ [TestCase(1, new[] { "CallFinalizerByCollectWithGeneration", "RunCallFinalizer" }, 1, IncludeTypes = new[] { typeof(FinalzerImplemented), typeof(FinalizerCalleeHolder) })]
+ [TestCase(1, new[] { "CallFinalizerByCollectWithGeneration", "RunCallFinalizer" }, 2, IncludeTypes = new[] { typeof(FinalzerImplemented), typeof(FinalizerCalleeHolder) })]
public static int CallFinalizerByCollectWithGeneration(int generation)
{
var holder = new FinalizerCalleeHolder();
@@ -340,6 +335,7 @@ private static void RunDontCallFinalizerWithPinned(FinalizerCalleeHolder holder)
var handle = GCHandle.Alloc(implemented, GCHandleType.Pinned);
}
+ [TestCase(0, new[] { "DontCallFinalizerByCollectWithPinned", "RunDontCallFinalizerWithPinned" }, IncludeTypes = new[] { typeof(FinalzerImplementedWithPinned), typeof(FinalizerCalleeHolder) })]
public static int DontCallFinalizerByCollectWithPinned()
{
var holder = new FinalizerCalleeHolder();
@@ -356,6 +352,12 @@ private static void RunDontCollectWithResurrect(int value)
var implemented = new FinalzerImplementedWithResurrect(value);
}
+ // TODO: Unknown failure on mono linux x64
+ // System.NullReferenceException : Object reference not set to an instance of an object
+ // at IL2C.RuntimeSystems.GarbageCollection.DontCollectWithResurrect (System.Int32 value) [0x00014] in :0
+ // Analyse: Since it is difficult to imagine that the instance reference is suddenly lost, the finalizer may not be called in the first place.
+ [TestCase(123, new[] { "DontCollectWithResurrect", "RunDontCollectWithResurrect" }, 123, IncludeTypes = new[] { typeof(FinalzerImplementedWithResurrect) },
+ RunOnPlatforms = RunOnPlatforms.DotNet)]
public static int DontCollectWithResurrect(int value)
{
RunDontCollectWithResurrect(value);
@@ -371,6 +373,7 @@ private static void RunCallFinalizerWithReRegister(FinalizerCalleeHolder holder)
var implemented = new FinalzerImplementedWithReRegister(holder);
}
+ [TestCase(2, new[] { "CallFinalizerByCollectWithReRegister", "RunCallFinalizerWithReRegister" }, IncludeTypes = new[] { typeof(FinalzerImplementedWithReRegister), typeof(FinalizerCalleeHolder) })]
public static int CallFinalizerByCollectWithReRegister()
{
var holder = new FinalizerCalleeHolder();
@@ -396,6 +399,7 @@ private static void RunCallFinalizerWithSuppressed(FinalizerCalleeHolder holder)
GC.SuppressFinalize(implemented);
}
+ [TestCase(0, new[] { "SuppressFinalize", "RunCallFinalizerWithSuppressed" }, IncludeTypes = new[] { typeof(FinalzerImplemented), typeof(FinalizerCalleeHolder) })]
public static int SuppressFinalize()
{
var holder = new FinalizerCalleeHolder();
@@ -414,6 +418,7 @@ private static void RunCallFinalizerWithSuppressedAndReRegistered(FinalizerCalle
GC.ReRegisterForFinalize(implemented);
}
+ [TestCase(1, new[] { "ReRegisterForFinalize", "RunCallFinalizerWithSuppressedAndReRegistered" }, IncludeTypes = new[] { typeof(FinalzerImplemented), typeof(FinalizerCalleeHolder) })]
public static int ReRegisterForFinalize()
{
var holder = new FinalizerCalleeHolder();
@@ -425,6 +430,7 @@ public static int ReRegisterForFinalize()
return holder.Called;
}
+ [TestCase(80000000, "ConcurrentCollect", 10, 40000000, IncludeTypes = new[] { typeof(ConcurrentCollectClosure), typeof(ConcurrentCollectValueHolder) })]
public static int ConcurrentCollect(int count, int increments)
{
var target = new ConcurrentCollectClosure();
diff --git a/tests/IL2C.Core.Test.RuntimeSystems/GarbageCollection/GarbageCollection.il b/tests/IL2C.Core.Test.RuntimeSystems/GarbageCollection/GarbageCollection.il
index 84d07130..5ec30527 100644
--- a/tests/IL2C.Core.Test.RuntimeSystems/GarbageCollection/GarbageCollection.il
+++ b/tests/IL2C.Core.Test.RuntimeSystems/GarbageCollection/GarbageCollection.il
@@ -4,13 +4,13 @@
{
.maxstack 3
.locals init (
- [0] class IL2C.RuntimeSystems.ObjRefInsideObjRefType
+ [0] class [IL2C.Core.Test.RuntimeSystems]IL2C.RuntimeSystems.ObjRefInsideObjRefType
)
ldstr "ABC"
ldstr "DEF"
call string string::Concat(string, string)
- newobj instance void IL2C.RuntimeSystems.ObjRefInsideObjRefType::.ctor(string)
+ newobj instance void [IL2C.Core.Test.RuntimeSystems]IL2C.RuntimeSystems.ObjRefInsideObjRefType::.ctor(string)
stloc.0
// Release concat string from the evaluation stack
@@ -23,7 +23,7 @@
call void [netstandard]System.GC::WaitForPendingFinalizers()
ldloc.0
- ldfld string IL2C.RuntimeSystems.ObjRefInsideObjRefType::Value
+ ldfld string [IL2C.Core.Test.RuntimeSystems]IL2C.RuntimeSystems.ObjRefInsideObjRefType::Value
ret
}
@@ -31,14 +31,14 @@
{
.maxstack 3
.locals init (
- [0] valuetype IL2C.RuntimeSystems.ObjRefInsideValueTypeType
+ [0] valuetype [IL2C.Core.Test.RuntimeSystems]IL2C.RuntimeSystems.ObjRefInsideValueTypeType
)
ldloca.s 0
ldstr "ABC"
ldstr "DEF"
call string string::Concat(string, string)
- call instance void IL2C.RuntimeSystems.ObjRefInsideValueTypeType::.ctor(string)
+ call instance void [IL2C.Core.Test.RuntimeSystems]IL2C.RuntimeSystems.ObjRefInsideValueTypeType::.ctor(string)
// Release concat string from the evaluation stack
ldstr "dummy1"
@@ -50,7 +50,7 @@
call void [netstandard]System.GC::WaitForPendingFinalizers()
ldloc.0
- ldfld string IL2C.RuntimeSystems.ObjRefInsideValueTypeType::Value
+ ldfld string [IL2C.Core.Test.RuntimeSystems]IL2C.RuntimeSystems.ObjRefInsideValueTypeType::Value
ret
}
@@ -58,13 +58,13 @@
{
.maxstack 3
.locals init (
- [0] class IL2C.RuntimeSystems.ObjRefInsideValueTypeInsideObjRefType
+ [0] class [IL2C.Core.Test.RuntimeSystems]IL2C.RuntimeSystems.ObjRefInsideValueTypeInsideObjRefType
)
ldstr "ABC"
ldstr "DEF"
call string string::Concat(string, string)
- newobj instance void IL2C.RuntimeSystems.ObjRefInsideValueTypeInsideObjRefType::.ctor(string)
+ newobj instance void [IL2C.Core.Test.RuntimeSystems]IL2C.RuntimeSystems.ObjRefInsideValueTypeInsideObjRefType::.ctor(string)
stloc.0
// Release concat string from the evaluation stack
@@ -77,8 +77,8 @@
call void [netstandard]System.GC::WaitForPendingFinalizers()
ldloc.0
- ldflda valuetype IL2C.RuntimeSystems.ObjRefInsideValueTypeType IL2C.RuntimeSystems.ObjRefInsideValueTypeInsideObjRefType::Value
- ldfld string IL2C.RuntimeSystems.ObjRefInsideValueTypeType::Value
+ ldflda valuetype [IL2C.Core.Test.RuntimeSystems]IL2C.RuntimeSystems.ObjRefInsideValueTypeType [IL2C.Core.Test.RuntimeSystems]IL2C.RuntimeSystems.ObjRefInsideValueTypeInsideObjRefType::Value
+ ldfld string [IL2C.Core.Test.RuntimeSystems]IL2C.RuntimeSystems.ObjRefInsideValueTypeType::Value
ret
}
@@ -86,14 +86,14 @@
{
.maxstack 3
.locals init (
- [0] valuetype IL2C.RuntimeSystems.ObjRefInsideObjRefInsideValueTypeType
+ [0] valuetype [IL2C.Core.Test.RuntimeSystems]IL2C.RuntimeSystems.ObjRefInsideObjRefInsideValueTypeType
)
ldloca.s 0
ldstr "ABC"
ldstr "DEF"
call string string::Concat(string, string)
- call instance void IL2C.RuntimeSystems.ObjRefInsideObjRefInsideValueTypeType::.ctor(string)
+ call instance void [IL2C.Core.Test.RuntimeSystems]IL2C.RuntimeSystems.ObjRefInsideObjRefInsideValueTypeType::.ctor(string)
// Release concat string from the evaluation stack
ldstr "dummy1"
@@ -105,8 +105,8 @@
call void [netstandard]System.GC::WaitForPendingFinalizers()
ldloca.s 0
- ldfld class IL2C.RuntimeSystems.ObjRefInsideObjRefType IL2C.RuntimeSystems.ObjRefInsideObjRefInsideValueTypeType::Value
- ldfld string IL2C.RuntimeSystems.ObjRefInsideObjRefType::Value
+ ldfld class [IL2C.Core.Test.RuntimeSystems]IL2C.RuntimeSystems.ObjRefInsideObjRefType [IL2C.Core.Test.RuntimeSystems]IL2C.RuntimeSystems.ObjRefInsideObjRefInsideValueTypeType::Value
+ ldfld string [IL2C.Core.Test.RuntimeSystems]IL2C.RuntimeSystems.ObjRefInsideObjRefType::Value
ret
}
@@ -114,7 +114,7 @@
{
.maxstack 5
.locals init (
- [0] valuetype IL2C.RuntimeSystems.MultipleInsideValueTypeType
+ [0] valuetype [IL2C.Core.Test.RuntimeSystems]IL2C.RuntimeSystems.MultipleInsideValueTypeType
)
ldloca.s 0
@@ -127,7 +127,7 @@
ldstr "ABC"
ldstr "DEF3"
call string string::Concat(string, string)
- call instance void IL2C.RuntimeSystems.MultipleInsideValueTypeType::.ctor(string, string, string)
+ call instance void [IL2C.Core.Test.RuntimeSystems]IL2C.RuntimeSystems.MultipleInsideValueTypeType::.ctor(string, string, string)
// Release concat string from the evaluation stack
ldstr "dummy1"
@@ -147,7 +147,7 @@
ceq
brfalse.s L1
ldloca.s 0
- ldfld string IL2C.RuntimeSystems.MultipleInsideValueTypeType::Value1
+ ldfld string [IL2C.Core.Test.RuntimeSystems]IL2C.RuntimeSystems.MultipleInsideValueTypeType::Value1
ret
L1: ldarg.0
@@ -155,13 +155,13 @@
ceq
brfalse.s L2
ldloca.s 0
- ldflda valuetype IL2C.RuntimeSystems.ObjRefInsideValueTypeType IL2C.RuntimeSystems.MultipleInsideValueTypeType::Value2
- ldfld string IL2C.RuntimeSystems.ObjRefInsideValueTypeType::Value
+ ldflda valuetype [IL2C.Core.Test.RuntimeSystems]IL2C.RuntimeSystems.ObjRefInsideValueTypeType [IL2C.Core.Test.RuntimeSystems]IL2C.RuntimeSystems.MultipleInsideValueTypeType::Value2
+ ldfld string [IL2C.Core.Test.RuntimeSystems]IL2C.RuntimeSystems.ObjRefInsideValueTypeType::Value
ret
L2: ldloca.s 0
- ldfld class IL2C.RuntimeSystems.ObjRefInsideObjRefType IL2C.RuntimeSystems.MultipleInsideValueTypeType::Value3
- ldfld string IL2C.RuntimeSystems.ObjRefInsideObjRefType::Value
+ ldfld class [IL2C.Core.Test.RuntimeSystems]IL2C.RuntimeSystems.ObjRefInsideObjRefType [IL2C.Core.Test.RuntimeSystems]IL2C.RuntimeSystems.MultipleInsideValueTypeType::Value3
+ ldfld string [IL2C.Core.Test.RuntimeSystems]IL2C.RuntimeSystems.ObjRefInsideObjRefType::Value
ret
}
}
diff --git a/tests/IL2C.Core.Test.RuntimeSystems/IL2C.Core.Test.RuntimeSystems.csproj b/tests/IL2C.Core.Test.RuntimeSystems/IL2C.Core.Test.RuntimeSystems.csproj
index f029f455..8a23debd 100644
--- a/tests/IL2C.Core.Test.RuntimeSystems/IL2C.Core.Test.RuntimeSystems.csproj
+++ b/tests/IL2C.Core.Test.RuntimeSystems/IL2C.Core.Test.RuntimeSystems.csproj
@@ -1,28 +1,58 @@
+
+
+
+
+
+
- net48;netstandard2.0
+ net48;net6.0
+
+ net47;net6.0
+
Library
+ False
enable
+ true
+ $(DefineConstants);$(OS)
IL2C.Core.Test.RuntimeSystems
IL2C.RuntimeSystems
+
+ CommentOnly
+ true
+ Debug
+ false
+
+
+
+
-
+
-
+
-
-
+
+
+
+
+
+
+ $([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)\..\..\src\IL2C.Build\bin\$(Configuration)\$(_IL2C_PlatformName)'))
+
diff --git a/tests/IL2C.Core.Test.RuntimeSystems/Interoperability/Interoperability.cs b/tests/IL2C.Core.Test.RuntimeSystems/Interoperability/Interoperability.cs
index 47418dcf..6aa239a5 100644
--- a/tests/IL2C.Core.Test.RuntimeSystems/Interoperability/Interoperability.cs
+++ b/tests/IL2C.Core.Test.RuntimeSystems/Interoperability/Interoperability.cs
@@ -8,9 +8,7 @@
////////////////////////////////////////////////////////////////////////////
using System;
-using System.Collections.Generic;
using System.ComponentModel;
-using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
@@ -21,44 +19,94 @@ public struct NativePointerInside
public NativePointer Pointer;
}
- [Description("These tests are verified the IL2C manages interoperability with the P/Invoke adn IL2C/Invoke method and internalcall method.")]
- [TestCase(null, new[] { "InternalCallWithUnicodeStringArgument", "OutputDebugString1" }, "ABC", Assert = TestCaseAsserts.IgnoreValidateInvokeResult)]
- [TestCase(null, new[] { "DllImportWithUnicodeStringArgument", "OutputDebugString2" }, "ABC", Assert = TestCaseAsserts.IgnoreValidateInvokeResult)]
- [TestCase(12345678, "TransparencyForNativePointer", 12345678)]
- [TestCase(12345678, "TransparencyForNativePointerInsideNativeType", 12345678, IncludeTypes = new[] { typeof(NativePointerInside) })]
- [TestCase("ABCDEF", new[] { "BypassObjRefWithObjRefHandle", "ConcatAndToObjRefHandle" }, "ABC", "DEF")]
+ [Description("These tests are verified the IL2C manages interoperability with the P/Invoke and IL2C/Invoke method and internalcall method.")]
public sealed class Interoperability
{
- [NativeMethod("windows.h", SymbolName = "OutputDebugStringW", CharSet = NativeCharSet.Unicode)]
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern void OutputDebugString1(string message);
-
- public static void InternalCallWithUnicodeStringArgument(string message)
+ [NativeType("time.h", SymbolName = "struct tm")]
+ internal struct tm
{
- OutputDebugString1(message);
+ public int tm_sec;
+ public int tm_min;
+ public int tm_hour;
+ public int tm_mday;
+ public int tm_mon;
+ public int tm_year;
+ public int tm_wday;
+ public int tm_yday;
+ public int tm_isdst;
}
- [DllImport("kernel32", EntryPoint = "OutputDebugStringW")]
- private static extern void OutputDebugString2(string message);
+ [NativeMethod("time.h")]
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ private static extern long mktime(in tm tmValue);
- public static void DllImportWithUnicodeStringArgument(string message)
+ // HACK: If you call `mktime` directly from within the IL2CInvokeMkTime method,
+ // CoreCLR will trigger a JIT when it executes the method, and
+ // detecting on the fly that the `mktime` is ECall undefined.
+ // Therefore, we will use this trampoline method to separate both methods.
+ private static long mktime_Trampoline(in tm tmValue) =>
+ mktime(in tmValue);
+
+ [TestCase(1666496096L, new[] { "IL2CInvokeMkTime", "mktime" })]
+ public static long IL2CInvokeMkTime()
{
- OutputDebugString2(message);
+ // 2022/10/23 12:34:56
+ var tmValue = new tm
+ {
+ tm_year = 2022 - 1900,
+ tm_mon = 10 - 1,
+ tm_mday = 23,
+ tm_hour = 12,
+ tm_min = 34,
+ tm_sec = 56,
+ tm_wday = 0,
+ tm_yday = 0,
+ tm_isdst = 0,
+ };
+
+ // Can test in native execution context.
+ if (IL2CServices.IsInNativeExecution)
+ {
+ return mktime_Trampoline(tmValue);
+ }
+ else
+ {
+ return 1666496096L;
+ }
}
- public static IntPtr TransparencyForNativePointer(IntPtr value)
+ [DllImport("kernel32", EntryPoint = "lstrlenW", CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Unicode)]
+ private static extern int lstrlenW(string message);
+
+ [TestCase(3, new[] { "PInvokeLStrLenW", "lstrlenW" }, "ABC",
+ RunOnOSs = RunOnOSs.Windows)]
+ public static int PInvokeLStrLenW(string message) =>
+ lstrlenW(message);
+
+ [DllImport("libc", EntryPoint = "wcslen", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
+ private static extern IntPtr wcslen(string message);
+
+ [TestCase(3, new[] { "PInvokeWcsLen", "wcslen" }, "ABC",
+ RunOnOSs = RunOnOSs.None)]
+ //RunOnOSs = RunOnOSs.Posix)] // TODO: #124
+ public static int PInvokeWcsLen(string message) =>
+ wcslen(message).ToInt32();
+
+ [TestCase(12345678, "TransparencyForNativePointer", 12345678)]
+ public static int TransparencyForNativePointer(int value)
{
- NativePointer np = value;
+ NativePointer np = (IntPtr)value;
IntPtr ip = np;
- return ip;
+ return ip.ToInt32();
}
- public static IntPtr TransparencyForNativePointerInsideNativeType(IntPtr value)
+ [TestCase(12345678, "TransparencyForNativePointerInsideNativeType", 12345678, IncludeTypes = new[] { typeof(NativePointerInside) })]
+ public static int TransparencyForNativePointerInsideNativeType(int value)
{
NativePointerInside npi;
- npi.Pointer = value;
+ npi.Pointer = (IntPtr)value;
IntPtr ip = npi.Pointer;
- return ip;
+ return ip.ToInt32();
}
private static IntPtr ConcatAndToObjRefHandle(string a, string b)
@@ -68,11 +116,12 @@ private static IntPtr ConcatAndToObjRefHandle(string a, string b)
return GCHandle.ToIntPtr(handle);
}
+ [TestCase("ABCDEF", new[] { "BypassObjRefWithObjRefHandle", "ConcatAndToObjRefHandle" }, "ABC", "DEF")]
public static string BypassObjRefWithObjRefHandle(string a, string b)
{
var objRefHandle = ConcatAndToObjRefHandle(a, b);
var handle = GCHandle.FromIntPtr(objRefHandle);
- var result = (string)handle.Target;
+ var result = (string)handle.Target!;
handle.Free();
return result;
}
diff --git a/tests/IL2C.Core.Test.RuntimeSystems/Properties/AssemblyInfo.cs b/tests/IL2C.Core.Test.RuntimeSystems/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000..9052f96f
--- /dev/null
+++ b/tests/IL2C.Core.Test.RuntimeSystems/Properties/AssemblyInfo.cs
@@ -0,0 +1,12 @@
+////////////////////////////////////////////////////////////////////////////
+//
+// IL2C - A translator for ECMA-335 CIL/MSIL to C language.
+// Copyright (c) Kouji Matsui (@kozy_kekyo, @kekyo@mastodon.cloud)
+//
+// Licensed under Apache-v2: https://opensource.org/licenses/Apache-2.0
+//
+////////////////////////////////////////////////////////////////////////////
+
+using IL2C;
+
+[assembly: SetCulture("en-us")]
diff --git a/tests/IL2C.Core.Test.RuntimeSystems/Threading/Threading.cs b/tests/IL2C.Core.Test.RuntimeSystems/Threading/Threading.cs
index 64f674ad..eba0ce12 100644
--- a/tests/IL2C.Core.Test.RuntimeSystems/Threading/Threading.cs
+++ b/tests/IL2C.Core.Test.RuntimeSystems/Threading/Threading.cs
@@ -42,10 +42,10 @@ public RunAndFinishClosureWithParameter(int a)
this.a = a;
}
- public void Run(object parameter)
+ public void Run(object? parameter)
{
Thread.Sleep(100);
- var b = (int)parameter;
+ var b = (int)parameter!;
this.Result = this.a + b;
}
}
@@ -151,19 +151,9 @@ public void Run()
}
[Description("These tests are verified the IL2C can handle threading features.")]
- [TestCase(333, "RunAndFinishInstanceMethod", 111, 222, IncludeTypes = new[] { typeof(RunAndFinishClosure) })]
- [TestCase(333, "RunAndFinishInstanceWithParameterMethod", 111, 222, IncludeTypes = new[] { typeof(RunAndFinishClosureWithParameter) })]
- [TestCase(true, "MultipleRunAndFinishInstanceMethod", 100, 10, IncludeTypes = new[] { typeof(RunAndFinishClosure) })]
- [TestCase(true, "MultipleRunAndFinishInstanceMethod", 100, 100, IncludeTypes = new[] { typeof(RunAndFinishClosure) })]
- [TestCase(true, "WillGetDifferentThreadId", IncludeTypes = new[] { typeof(WillGetDifferentThreadIdClosure) })]
- [TestCase(100, "RaceFreeWithObjectMonitorLock", 10, IncludeTypes = new[] { typeof(RaceFreeMonitorLockClosure) })]
- [TestCase(100, "RaceFreeWithConstStringMonitorLock", 10, IncludeTypes = new[] { typeof(RaceFreeMonitorLockClosure) })]
- [TestCase(100, "RaceFreeWithObjectMonitorLock2", 10, IncludeTypes = new[] { typeof(RaceFreeMonitorLock2Closure) })]
- [TestCase(100, "RaceFreeWithConstStringMonitorLock2", 10, IncludeTypes = new[] { typeof(RaceFreeMonitorLock2Closure) })]
- [TestCase(100, "RaceFreeWithObjectMonitorTryLock", 10, IncludeTypes = new[] { typeof(RaceFreeMonitorTryLockClosure) })]
- [TestCase(100, "RaceFreeWithConstStringMonitorTryLock", 10, IncludeTypes = new[] { typeof(RaceFreeMonitorTryLockClosure) })]
public sealed class Threading
{
+ [TestCase(333, "RunAndFinishInstanceMethod", 111, 222, IncludeTypes = new[] { typeof(RunAndFinishClosure) })]
public static int RunAndFinishInstanceMethod(int a, int b)
{
var target = new RunAndFinishClosure(a, b);
@@ -174,6 +164,7 @@ public static int RunAndFinishInstanceMethod(int a, int b)
return target.Result;
}
+ [TestCase(333, "RunAndFinishInstanceWithParameterMethod", 111, 222, IncludeTypes = new[] { typeof(RunAndFinishClosureWithParameter) })]
public static int RunAndFinishInstanceWithParameterMethod(int a, int b)
{
var target = new RunAndFinishClosureWithParameter(a);
@@ -184,6 +175,8 @@ public static int RunAndFinishInstanceWithParameterMethod(int a, int b)
return target.Result;
}
+ [TestCase(true, "MultipleRunAndFinishInstanceMethod", 100, 10, IncludeTypes = new[] { typeof(RunAndFinishClosure) })]
+ [TestCase(true, "MultipleRunAndFinishInstanceMethod", 100, 100, IncludeTypes = new[] { typeof(RunAndFinishClosure) })]
public static bool MultipleRunAndFinishInstanceMethod(int a, int count)
{
var targets = new RunAndFinishClosure[count];
@@ -215,6 +208,7 @@ public static bool MultipleRunAndFinishInstanceMethod(int a, int count)
return true;
}
+ [TestCase(true, "WillGetDifferentThreadId", IncludeTypes = new[] { typeof(WillGetDifferentThreadIdClosure) })]
public static bool WillGetDifferentThreadId()
{
var target = new WillGetDifferentThreadIdClosure();
@@ -225,6 +219,7 @@ public static bool WillGetDifferentThreadId()
return target.TestThreadId != target.RunThreadId;
}
+ [TestCase(100, "RaceFreeWithObjectMonitorLock", 10, IncludeTypes = new[] { typeof(RaceFreeMonitorLockClosure) })]
public static int RaceFreeWithObjectMonitorLock(int count)
{
var target = new RaceFreeMonitorLockClosure(new object());
@@ -246,6 +241,7 @@ public static int RaceFreeWithObjectMonitorLock(int count)
return target.Value;
}
+ [TestCase(100, "RaceFreeWithConstStringMonitorLock", 10, IncludeTypes = new[] { typeof(RaceFreeMonitorLockClosure) })]
public static int RaceFreeWithConstStringMonitorLock(int count)
{
var target = new RaceFreeMonitorLockClosure("LOCK TARGET");
@@ -267,6 +263,7 @@ public static int RaceFreeWithConstStringMonitorLock(int count)
return target.Value;
}
+ [TestCase(100, "RaceFreeWithObjectMonitorLock2", 10, IncludeTypes = new[] { typeof(RaceFreeMonitorLock2Closure) })]
public static int RaceFreeWithObjectMonitorLock2(int count)
{
var target = new RaceFreeMonitorLock2Closure(new object());
@@ -288,6 +285,7 @@ public static int RaceFreeWithObjectMonitorLock2(int count)
return target.Value;
}
+ [TestCase(100, "RaceFreeWithConstStringMonitorLock2", 10, IncludeTypes = new[] { typeof(RaceFreeMonitorLock2Closure) })]
public static int RaceFreeWithConstStringMonitorLock2(int count)
{
var target = new RaceFreeMonitorLock2Closure("LOCK TARGET");
@@ -309,6 +307,7 @@ public static int RaceFreeWithConstStringMonitorLock2(int count)
return target.Value;
}
+ [TestCase(100, "RaceFreeWithObjectMonitorTryLock", 10, IncludeTypes = new[] { typeof(RaceFreeMonitorTryLockClosure) })]
public static int RaceFreeWithObjectMonitorTryLock(int count)
{
var target = new RaceFreeMonitorTryLockClosure(new object());
@@ -330,6 +329,7 @@ public static int RaceFreeWithObjectMonitorTryLock(int count)
return target.Value;
}
+ [TestCase(100, "RaceFreeWithConstStringMonitorTryLock", 10, IncludeTypes = new[] { typeof(RaceFreeMonitorTryLockClosure) })]
public static int RaceFreeWithConstStringMonitorTryLock(int count)
{
var target = new RaceFreeMonitorTryLockClosure("LOCK TARGET");
diff --git a/tests/IL2C.Core.Test.RuntimeSystems/TypeInitializer/TypeInitializer.cs b/tests/IL2C.Core.Test.RuntimeSystems/TypeInitializer/TypeInitializer.cs
index fd6f0bef..9aa7b017 100644
--- a/tests/IL2C.Core.Test.RuntimeSystems/TypeInitializer/TypeInitializer.cs
+++ b/tests/IL2C.Core.Test.RuntimeSystems/TypeInitializer/TypeInitializer.cs
@@ -83,112 +83,112 @@ public static class TypeInitializer_NonTrackingGCs
[TestId("TypeInitializer")]
[Description("These tests are verified the IL2C can handle the type initializer special translation cases.")]
- [TestCase(true, "Bool", IncludeTypes = new[] { typeof(TypeInitializer_Field) })]
- [TestCase((byte)1, "Byte", IncludeTypes = new[] { typeof(TypeInitializer_Field) })]
- [TestCase((short)1, "Int16", IncludeTypes = new[] { typeof(TypeInitializer_Field) })]
- [TestCase((int)3, "Int32", IncludeTypes = new[] { typeof(TypeInitializer_Field) })]
- [TestCase((long)1, "Int64", IncludeTypes = new[] { typeof(TypeInitializer_Field) })]
- [TestCase((sbyte)1, "SByte", IncludeTypes = new[] { typeof(TypeInitializer_Field) })]
- [TestCase((ushort)1, "UInt16", IncludeTypes = new[] { typeof(TypeInitializer_Field) })]
- [TestCase((uint)1, "UInt32", IncludeTypes = new[] { typeof(TypeInitializer_Field) })]
- [TestCase((ulong)1, "UInt64", IncludeTypes = new[] { typeof(TypeInitializer_Field) })]
- [TestCase((int)1, "IntPtr", IncludeTypes = new[] { typeof(TypeInitializer_Field) })]
- [TestCase((uint)1, "UIntPtr", IncludeTypes = new[] { typeof(TypeInitializer_Field) })]
- [TestCase((float)1, "Single", IncludeTypes = new[] { typeof(TypeInitializer_Field) })]
- [TestCase((double)1, "Double", IncludeTypes = new[] { typeof(TypeInitializer_Field) })]
- [TestCase((char)1, "Char", IncludeTypes = new[] { typeof(TypeInitializer_Field) })]
- [TestCase("ABC", "String", IncludeTypes = new[] { typeof(TypeInitializer_Field) })]
- [TestCase(0, "Int32_None", IncludeTypes = new[] { typeof(TypeInitializer_None) })]
- [TestCase(null, "String_None", IncludeTypes = new[] { typeof(TypeInitializer_None) })]
- [TestCase(0, "NonTracked", IncludeTypes = new[] { typeof(TypeInitializer_NonTrackingGCs) })]
public sealed partial class TypeInitializer
{
+ [TestCase(true, "Bool", IncludeTypes = new[] { typeof(TypeInitializer_Field) })]
public static bool Bool()
{
return TypeInitializer_Field.BooleanValue;
}
+ [TestCase((byte)1, "Byte", IncludeTypes = new[] { typeof(TypeInitializer_Field) })]
public static byte Byte()
{
return TypeInitializer_Field.ByteValue;
}
+ [TestCase((short)1, "Int16", IncludeTypes = new[] { typeof(TypeInitializer_Field) })]
public static short Int16()
{
return TypeInitializer_Field.Int16Value;
}
+ [TestCase((int)3, "Int32", IncludeTypes = new[] { typeof(TypeInitializer_Field) })]
public static int Int32()
{
return TypeInitializer_Field.Int32Value;
}
+ [TestCase((long)1, "Int64", IncludeTypes = new[] { typeof(TypeInitializer_Field) })]
public static long Int64()
{
return TypeInitializer_Field.Int64Value;
}
+ [TestCase((sbyte)1, "SByte", IncludeTypes = new[] { typeof(TypeInitializer_Field) })]
public static sbyte SByte()
{
return TypeInitializer_Field.SByteValue;
}
+ [TestCase((ushort)1, "UInt16", IncludeTypes = new[] { typeof(TypeInitializer_Field) })]
public static ushort UInt16()
{
return TypeInitializer_Field.UInt16Value;
}
+ [TestCase((uint)1, "UInt32", IncludeTypes = new[] { typeof(TypeInitializer_Field) })]
public static uint UInt32()
{
return TypeInitializer_Field.UInt32Value;
}
+ [TestCase((ulong)1, "UInt64", IncludeTypes = new[] { typeof(TypeInitializer_Field) })]
public static ulong UInt64()
{
return TypeInitializer_Field.UInt64Value;
}
- public static IntPtr IntPtr()
+ [TestCase((int)1, "IntPtr", IncludeTypes = new[] { typeof(TypeInitializer_Field) })]
+ public static int IntPtr()
{
- return TypeInitializer_Field.IntPtrValue;
+ return TypeInitializer_Field.IntPtrValue.ToInt32();
}
- public static UIntPtr UIntPtr()
+ [TestCase((uint)1, "UIntPtr", IncludeTypes = new[] { typeof(TypeInitializer_Field) })]
+ public static uint UIntPtr()
{
- return TypeInitializer_Field.UIntPtrValue;
+ return TypeInitializer_Field.UIntPtrValue.ToUInt32();
}
+ [TestCase((float)1, "Single", IncludeTypes = new[] { typeof(TypeInitializer_Field) })]
public static float Single()
{
return TypeInitializer_Field.SingleValue;
}
+ [TestCase((double)1, "Double", IncludeTypes = new[] { typeof(TypeInitializer_Field) })]
public static double Double()
{
return TypeInitializer_Field.DoubleValue;
}
+ [TestCase((char)1, "Char", IncludeTypes = new[] { typeof(TypeInitializer_Field) })]
public static char Char()
{
return TypeInitializer_Field.CharValue;
}
+ [TestCase("ABC", "String", IncludeTypes = new[] { typeof(TypeInitializer_Field) })]
public static string String()
{
return TypeInitializer_Field.StringValue;
}
+ [TestCase(0, "Int32_None", IncludeTypes = new[] { typeof(TypeInitializer_None) })]
public static int Int32_None()
{
return TypeInitializer_None.Int32Value;
}
+ [TestCase(null, "String_None", IncludeTypes = new[] { typeof(TypeInitializer_None) }, Assert = TestCaseAsserts.PerfectMatch)]
public static string? String_None()
{
return TypeInitializer_None.StringValue;
}
// Only manual revewing generated C source code.
+ [TestCase(0, "NonTracked", IncludeTypes = new[] { typeof(TypeInitializer_NonTrackingGCs) })]
public static int NonTracked()
{
return TypeInitializer_NonTrackingGCs.Int32Value;
diff --git a/tests/IL2C.Core.Test.RuntimeSystems/TypeInitializer/TypeInitializerAtomicity.cs b/tests/IL2C.Core.Test.RuntimeSystems/TypeInitializer/TypeInitializerAtomicity.cs
index 3accd1c7..b2f86179 100644
--- a/tests/IL2C.Core.Test.RuntimeSystems/TypeInitializer/TypeInitializerAtomicity.cs
+++ b/tests/IL2C.Core.Test.RuntimeSystems/TypeInitializer/TypeInitializerAtomicity.cs
@@ -48,11 +48,9 @@ public void Run()
}
}
- [TestCase(1230, "MultipleExecution", 10, IncludeTypes = new[] { typeof(MultipleExecutionClosure), typeof(TypeInitializer_Atomicity) })]
- [TestCase(0, "MultipleExecutionWithNoTypeInitializer", 40, IncludeTypes = new[] { typeof(MultipleExecutionClosure_NoTypeInitializer), typeof(TypeInitializer_Atomicity_NoTypeInitializer) })]
- [TestCase(246, "AfterInitialized", IncludeTypes = new[] { typeof(TypeInitializer_Atomicity) })]
partial class TypeInitializer
{
+ [TestCase(1230, "MultipleExecution", 10, IncludeTypes = new[] { typeof(MultipleExecutionClosure), typeof(TypeInitializer_Atomicity) })]
public static int MultipleExecution(int count)
{
var targets = new MultipleExecutionClosure[count];
@@ -84,6 +82,7 @@ public static int MultipleExecution(int count)
return sum;
}
+ [TestCase(0, "MultipleExecutionWithNoTypeInitializer", 40, IncludeTypes = new[] { typeof(MultipleExecutionClosure_NoTypeInitializer), typeof(TypeInitializer_Atomicity_NoTypeInitializer) })]
public static int MultipleExecutionWithNoTypeInitializer(int count)
{
var targets = new MultipleExecutionClosure_NoTypeInitializer[count];
@@ -113,6 +112,7 @@ public static int MultipleExecutionWithNoTypeInitializer(int count)
return sum;
}
+ [TestCase(246, "AfterInitialized", IncludeTypes = new[] { typeof(TypeInitializer_Atomicity) })]
public static int AfterInitialized()
{
var value0 = TypeInitializer_Atomicity.Int32Value;
diff --git a/tests/IL2C.Core.Test.RuntimeSystems/TypeRelations/TypeImplements.cs b/tests/IL2C.Core.Test.RuntimeSystems/TypeRelations/TypeImplements.cs
index 39621b39..64cbd086 100644
--- a/tests/IL2C.Core.Test.RuntimeSystems/TypeRelations/TypeImplements.cs
+++ b/tests/IL2C.Core.Test.RuntimeSystems/TypeRelations/TypeImplements.cs
@@ -238,219 +238,219 @@ public class InstanceMultipleImplement3DepthType : InstanceMultipleImplement2Dep
}
[TestId("TypeRelations")]
- [TestCase("223", "InstanceImplement", 123, IncludeTypes = new[] { typeof(InstanceImplementType), typeof(IInterfaceType1) })]
- [TestCase("223", "InstanceImplementFromInterface", 123, IncludeTypes = new[] { typeof(InstanceImplementType), typeof(IInterfaceType1) })]
- [TestCase("223", "InstanceMultipleImplement1", 123, IncludeTypes = new[] { typeof(InstanceMultipleImplementType), typeof(IInterfaceType1), typeof(IInterfaceType2) })]
- [TestCase("223", "InstanceMultipleImplementFromInterface1", 123, IncludeTypes = new[] { typeof(InstanceMultipleImplementType), typeof(IInterfaceType1), typeof(IInterfaceType2) })]
- [TestCase("323", "InstanceMultipleImplement2", 123L, IncludeTypes = new[] { typeof(InstanceMultipleImplementType), typeof(IInterfaceType1), typeof(IInterfaceType2) })]
- [TestCase("323", "InstanceMultipleImplementFromInterface2", 123L, IncludeTypes = new[] { typeof(InstanceMultipleImplementType), typeof(IInterfaceType1), typeof(IInterfaceType2) })]
- [TestCase("223", "InstanceMultipleImplementUnified1", 123, IncludeTypes = new[] { typeof(InstanceMultipleImplementUnifiedType), typeof(IInterfaceType1), typeof(IInterfaceType3) })]
- [TestCase("223", "InstanceMultipleImplementUnifiedFromInterface1", 123, IncludeTypes = new[] { typeof(InstanceMultipleImplementUnifiedType), typeof(IInterfaceType1), typeof(IInterfaceType3) })]
- [TestCase("223", "InstanceMultipleImplementUnifiedFromInterface3", 123, IncludeTypes = new[] { typeof(InstanceMultipleImplementUnifiedType), typeof(IInterfaceType1), typeof(IInterfaceType3) })]
- [TestCase("223", "InstanceMultipleImplementCombination", 123, IncludeTypes = new[] { typeof(InstanceMultipleImplementCombinationType), typeof(IInterfaceType1), typeof(IInterfaceType3) })]
- [TestCase("223", "InstanceMultipleImplementCombinationFromInterface1", 123, IncludeTypes = new[] { typeof(InstanceMultipleImplementCombinationType), typeof(IInterfaceType1), typeof(IInterfaceType3) })]
- [TestCase("323", "InstanceMultipleImplementCombinationFromInterface3", 123, IncludeTypes = new[] { typeof(InstanceMultipleImplementCombinationType), typeof(IInterfaceType1), typeof(IInterfaceType3) })]
- [TestCase("223", "InstanceMultipleImplementExplicitlyFromInterface1", 123, IncludeTypes = new[] { typeof(InstanceMultipleImplementExplicitlyType), typeof(IInterfaceType1), typeof(IInterfaceType3) })]
- [TestCase("323", "InstanceMultipleImplementExplicitlyFromInterface3", 123, IncludeTypes = new[] { typeof(InstanceMultipleImplementExplicitlyType), typeof(IInterfaceType1), typeof(IInterfaceType3) })]
- [TestCase("223", "InstanceMultipleCombinedImplement", 123, IncludeTypes = new[] { typeof(InstanceMultipleCombinedImplementType), typeof(IInterfaceType4) })]
- [TestCase("223", "InstanceMultipleCombined1ImplementFromInterface4", 123, IncludeTypes = new[] { typeof(InstanceMultipleCombinedImplementType), typeof(IInterfaceType4) })]
- [TestCase("323", "InstanceMultipleCombined2ImplementFromInterface4", 123L, IncludeTypes = new[] { typeof(InstanceMultipleCombinedImplementType), typeof(IInterfaceType4) })]
- [TestCase("223", "InstanceMultipleCombinedAndParallelImplement", 123, IncludeTypes = new[] { typeof(InstanceMultipleCombinedAndParallelImplementType), typeof(IInterfaceType4) })]
- [TestCase("323", "InstanceMultipleCombinedAndParallel1ImplementFromInterface4", 123, IncludeTypes = new[] { typeof(InstanceMultipleCombinedAndParallelImplementType), typeof(IInterfaceType4) })]
- [TestCase("423", "InstanceMultipleCombinedAndParallel2ImplementFromInterface4", 123L, IncludeTypes = new[] { typeof(InstanceMultipleCombinedAndParallelImplementType), typeof(IInterfaceType4) })]
- [TestCase("223", "InstanceMultipleCombinedImplementCombination1", 123, IncludeTypes = new[] { typeof(InstanceMultipleCombinedImplementCombinationType1), typeof(IInterfaceType1), typeof(IInterfaceType4) })]
- [TestCase("223", "InstanceMultipleCombined2ImplementCombination1FromInterface1", 123, IncludeTypes = new[] { typeof(InstanceMultipleCombinedImplementCombinationType1), typeof(IInterfaceType1), typeof(IInterfaceType4) })]
- [TestCase("323", "InstanceMultipleCombined1ImplementCombination1FromInterface4", 123, IncludeTypes = new[] { typeof(InstanceMultipleCombinedImplementCombinationType1), typeof(IInterfaceType1), typeof(IInterfaceType4) })]
- [TestCase("423", "InstanceMultipleCombined2ImplementCombination1FromInterface4", 123L, IncludeTypes = new[] { typeof(InstanceMultipleCombinedImplementCombinationType1), typeof(IInterfaceType1), typeof(IInterfaceType4) })]
- [TestCase("223", "InstanceMultipleCombinedImplementCombination2", 123, IncludeTypes = new[] { typeof(InstanceMultipleCombinedImplementCombinationType2), typeof(IInterfaceType1), typeof(IInterfaceType4) })]
- [TestCase("323", "InstanceMultipleCombined2ImplementCombination2FromInterface1", 123, IncludeTypes = new[] { typeof(InstanceMultipleCombinedImplementCombinationType2), typeof(IInterfaceType1), typeof(IInterfaceType4) })]
- [TestCase("223", "InstanceMultipleCombined1ImplementCombination2FromInterface4", 123, IncludeTypes = new[] { typeof(InstanceMultipleCombinedImplementCombinationType2), typeof(IInterfaceType1), typeof(IInterfaceType4) })]
- [TestCase("423", "InstanceMultipleCombined2ImplementCombination2FromInterface4", 123L, IncludeTypes = new[] { typeof(InstanceMultipleCombinedImplementCombinationType2), typeof(IInterfaceType1), typeof(IInterfaceType4) })]
- [TestCase("523", "InstanceMultipleImplementDepth", 123, IncludeTypes = new[] { typeof(InstanceMultipleImplement3DepthType), typeof(InstanceMultipleImplement2DepthType), typeof(InstanceMultipleImplement1DepthType), typeof(InstanceMultipleImplementDepthBaseType), typeof(IInterfaceType1), typeof(IInterfaceType3) })]
- [TestCase("323", "InstanceMultipleImplementDepthFromInterface1", 123, IncludeTypes = new[] { typeof(InstanceMultipleImplement3DepthType), typeof(InstanceMultipleImplement2DepthType), typeof(InstanceMultipleImplement1DepthType), typeof(InstanceMultipleImplementDepthBaseType), typeof(IInterfaceType1), typeof(IInterfaceType3) })]
- [TestCase("423", "InstanceMultipleImplementDepthFromInterface3", 123, IncludeTypes = new[] { typeof(InstanceMultipleImplement3DepthType), typeof(InstanceMultipleImplement2DepthType), typeof(InstanceMultipleImplement1DepthType), typeof(InstanceMultipleImplementDepthBaseType), typeof(IInterfaceType1), typeof(IInterfaceType3) })]
public sealed class TypeImplements
{
+ [TestCase("223", "InstanceImplement", 123, IncludeTypes = new[] { typeof(InstanceImplementType), typeof(IInterfaceType1) })]
public static string InstanceImplement(int value)
{
var inst = new InstanceImplementType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("223", "InstanceImplementFromInterface", 123, IncludeTypes = new[] { typeof(InstanceImplementType), typeof(IInterfaceType1) })]
public static string InstanceImplementFromInterface(int value)
{
IInterfaceType1 inst = new InstanceImplementType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("223", "InstanceMultipleImplement1", 123, IncludeTypes = new[] { typeof(InstanceMultipleImplementType), typeof(IInterfaceType1), typeof(IInterfaceType2) })]
public static string InstanceMultipleImplement1(int value)
{
var inst = new InstanceMultipleImplementType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("223", "InstanceMultipleImplementFromInterface1", 123, IncludeTypes = new[] { typeof(InstanceMultipleImplementType), typeof(IInterfaceType1), typeof(IInterfaceType2) })]
public static string InstanceMultipleImplementFromInterface1(int value)
{
IInterfaceType1 inst = new InstanceMultipleImplementType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("323", "InstanceMultipleImplement2", 123L, IncludeTypes = new[] { typeof(InstanceMultipleImplementType), typeof(IInterfaceType1), typeof(IInterfaceType2) })]
public static string InstanceMultipleImplement2(long value)
{
var inst = new InstanceMultipleImplementType();
return inst.GetStringFromInt64(value);
}
+ [TestCase("323", "InstanceMultipleImplementFromInterface2", 123L, IncludeTypes = new[] { typeof(InstanceMultipleImplementType), typeof(IInterfaceType1), typeof(IInterfaceType2) })]
public static string InstanceMultipleImplementFromInterface2(long value)
{
IInterfaceType2 inst = new InstanceMultipleImplementType();
return inst.GetStringFromInt64(value);
}
+ [TestCase("223", "InstanceMultipleImplementUnified1", 123, IncludeTypes = new[] { typeof(InstanceMultipleImplementUnifiedType), typeof(IInterfaceType1), typeof(IInterfaceType3) })]
public static string InstanceMultipleImplementUnified1(int value)
{
var inst = new InstanceMultipleImplementUnifiedType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("223", "InstanceMultipleImplementUnifiedFromInterface1", 123, IncludeTypes = new[] { typeof(InstanceMultipleImplementUnifiedType), typeof(IInterfaceType1), typeof(IInterfaceType3) })]
public static string InstanceMultipleImplementUnifiedFromInterface1(int value)
{
IInterfaceType1 inst = new InstanceMultipleImplementUnifiedType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("223", "InstanceMultipleImplementUnifiedFromInterface3", 123, IncludeTypes = new[] { typeof(InstanceMultipleImplementUnifiedType), typeof(IInterfaceType1), typeof(IInterfaceType3) })]
public static string InstanceMultipleImplementUnifiedFromInterface3(int value)
{
IInterfaceType3 inst = new InstanceMultipleImplementUnifiedType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("223", "InstanceMultipleImplementCombination", 123, IncludeTypes = new[] { typeof(InstanceMultipleImplementCombinationType), typeof(IInterfaceType1), typeof(IInterfaceType3) })]
public static string InstanceMultipleImplementCombination(int value)
{
var inst = new InstanceMultipleImplementCombinationType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("223", "InstanceMultipleImplementCombinationFromInterface1", 123, IncludeTypes = new[] { typeof(InstanceMultipleImplementCombinationType), typeof(IInterfaceType1), typeof(IInterfaceType3) })]
public static string InstanceMultipleImplementCombinationFromInterface1(int value)
{
IInterfaceType1 inst = new InstanceMultipleImplementCombinationType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("323", "InstanceMultipleImplementCombinationFromInterface3", 123, IncludeTypes = new[] { typeof(InstanceMultipleImplementCombinationType), typeof(IInterfaceType1), typeof(IInterfaceType3) })]
public static string InstanceMultipleImplementCombinationFromInterface3(int value)
{
IInterfaceType3 inst = new InstanceMultipleImplementCombinationType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("223", "InstanceMultipleImplementExplicitlyFromInterface1", 123, IncludeTypes = new[] { typeof(InstanceMultipleImplementExplicitlyType), typeof(IInterfaceType1), typeof(IInterfaceType3) })]
public static string InstanceMultipleImplementExplicitlyFromInterface1(int value)
{
IInterfaceType1 inst = new InstanceMultipleImplementExplicitlyType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("323", "InstanceMultipleImplementExplicitlyFromInterface3", 123, IncludeTypes = new[] { typeof(InstanceMultipleImplementExplicitlyType), typeof(IInterfaceType1), typeof(IInterfaceType3) })]
public static string InstanceMultipleImplementExplicitlyFromInterface3(int value)
{
IInterfaceType3 inst = new InstanceMultipleImplementExplicitlyType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("223", "InstanceMultipleCombinedImplement", 123, IncludeTypes = new[] { typeof(InstanceMultipleCombinedImplementType), typeof(IInterfaceType4) })]
public static string InstanceMultipleCombinedImplement(int value)
{
var inst = new InstanceMultipleCombinedImplementType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("223", "InstanceMultipleCombined1ImplementFromInterface4", 123, IncludeTypes = new[] { typeof(InstanceMultipleCombinedImplementType), typeof(IInterfaceType4) })]
public static string InstanceMultipleCombined1ImplementFromInterface4(int value)
{
IInterfaceType4 inst = new InstanceMultipleCombinedImplementType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("323", "InstanceMultipleCombined2ImplementFromInterface4", 123L, IncludeTypes = new[] { typeof(InstanceMultipleCombinedImplementType), typeof(IInterfaceType4) })]
public static string InstanceMultipleCombined2ImplementFromInterface4(long value)
{
IInterfaceType4 inst = new InstanceMultipleCombinedImplementType();
return inst.GetStringFromInt64(value);
}
+ [TestCase("223", "InstanceMultipleCombinedAndParallelImplement", 123, IncludeTypes = new[] { typeof(InstanceMultipleCombinedAndParallelImplementType), typeof(IInterfaceType4) })]
public static string InstanceMultipleCombinedAndParallelImplement(int value)
{
var inst = new InstanceMultipleCombinedAndParallelImplementType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("323", "InstanceMultipleCombinedAndParallel1ImplementFromInterface4", 123, IncludeTypes = new[] { typeof(InstanceMultipleCombinedAndParallelImplementType), typeof(IInterfaceType4) })]
public static string InstanceMultipleCombinedAndParallel1ImplementFromInterface4(int value)
{
IInterfaceType4 inst = new InstanceMultipleCombinedAndParallelImplementType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("423", "InstanceMultipleCombinedAndParallel2ImplementFromInterface4", 123L, IncludeTypes = new[] { typeof(InstanceMultipleCombinedAndParallelImplementType), typeof(IInterfaceType4) })]
public static string InstanceMultipleCombinedAndParallel2ImplementFromInterface4(long value)
{
IInterfaceType4 inst = new InstanceMultipleCombinedAndParallelImplementType();
return inst.GetStringFromInt64(value);
}
+ [TestCase("223", "InstanceMultipleCombinedImplementCombination1", 123, IncludeTypes = new[] { typeof(InstanceMultipleCombinedImplementCombinationType1), typeof(IInterfaceType1), typeof(IInterfaceType4) })]
public static string InstanceMultipleCombinedImplementCombination1(int value)
{
var inst = new InstanceMultipleCombinedImplementCombinationType1();
return inst.GetStringFromInt32(value);
}
+ [TestCase("223", "InstanceMultipleCombined1ImplementCombination1FromInterface1", 123, IncludeTypes = new[] { typeof(InstanceMultipleCombinedImplementCombinationType1), typeof(IInterfaceType1), typeof(IInterfaceType4) })]
public static string InstanceMultipleCombined1ImplementCombination1FromInterface1(int value)
{
IInterfaceType1 inst = new InstanceMultipleCombinedImplementCombinationType1();
return inst.GetStringFromInt32(value);
}
+ [TestCase("323", "InstanceMultipleCombined1ImplementCombination1FromInterface4", 123, IncludeTypes = new[] { typeof(InstanceMultipleCombinedImplementCombinationType1), typeof(IInterfaceType1), typeof(IInterfaceType4) })]
public static string InstanceMultipleCombined1ImplementCombination1FromInterface4(int value)
{
IInterfaceType4 inst = new InstanceMultipleCombinedImplementCombinationType1();
return inst.GetStringFromInt32(value);
}
+ [TestCase("423", "InstanceMultipleCombined2ImplementCombination1FromInterface4", 123L, IncludeTypes = new[] { typeof(InstanceMultipleCombinedImplementCombinationType1), typeof(IInterfaceType1), typeof(IInterfaceType4) })]
public static string InstanceMultipleCombined2ImplementCombination1FromInterface4(long value)
{
IInterfaceType4 inst = new InstanceMultipleCombinedImplementCombinationType1();
return inst.GetStringFromInt64(value);
}
+ [TestCase("223", "InstanceMultipleCombinedImplementCombination2", 123, IncludeTypes = new[] { typeof(InstanceMultipleCombinedImplementCombinationType2), typeof(IInterfaceType1), typeof(IInterfaceType4) })]
public static string InstanceMultipleCombinedImplementCombination2(int value)
{
var inst = new InstanceMultipleCombinedImplementCombinationType2();
return inst.GetStringFromInt32(value);
}
+ [TestCase("323", "InstanceMultipleCombined1ImplementCombination2FromInterface1", 123, IncludeTypes = new[] { typeof(InstanceMultipleCombinedImplementCombinationType2), typeof(IInterfaceType1), typeof(IInterfaceType4) })]
public static string InstanceMultipleCombined1ImplementCombination2FromInterface1(int value)
{
IInterfaceType1 inst = new InstanceMultipleCombinedImplementCombinationType2();
return inst.GetStringFromInt32(value);
}
+ [TestCase("223", "InstanceMultipleCombined1ImplementCombination2FromInterface4", 123, IncludeTypes = new[] { typeof(InstanceMultipleCombinedImplementCombinationType2), typeof(IInterfaceType1), typeof(IInterfaceType4) })]
public static string InstanceMultipleCombined1ImplementCombination2FromInterface4(int value)
{
IInterfaceType4 inst = new InstanceMultipleCombinedImplementCombinationType2();
return inst.GetStringFromInt32(value);
}
+ [TestCase("423", "InstanceMultipleCombined2ImplementCombination2FromInterface4", 123L, IncludeTypes = new[] { typeof(InstanceMultipleCombinedImplementCombinationType2), typeof(IInterfaceType1), typeof(IInterfaceType4) })]
public static string InstanceMultipleCombined2ImplementCombination2FromInterface4(long value)
{
IInterfaceType4 inst = new InstanceMultipleCombinedImplementCombinationType2();
return inst.GetStringFromInt64(value);
}
+ [TestCase("523", "InstanceMultipleImplementDepth", 123, IncludeTypes = new[] { typeof(InstanceMultipleImplement3DepthType), typeof(InstanceMultipleImplement2DepthType), typeof(InstanceMultipleImplement1DepthType), typeof(InstanceMultipleImplementDepthBaseType), typeof(IInterfaceType1), typeof(IInterfaceType3) })]
public static string InstanceMultipleImplementDepth(int value)
{
var inst = new InstanceMultipleImplement3DepthType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("323", "InstanceMultipleImplementDepthFromInterface1", 123, IncludeTypes = new[] { typeof(InstanceMultipleImplement3DepthType), typeof(InstanceMultipleImplement2DepthType), typeof(InstanceMultipleImplement1DepthType), typeof(InstanceMultipleImplementDepthBaseType), typeof(IInterfaceType1), typeof(IInterfaceType3) })]
public static string InstanceMultipleImplementDepthFromInterface1(int value)
{
IInterfaceType1 inst = new InstanceMultipleImplement3DepthType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("423", "InstanceMultipleImplementDepthFromInterface3", 123, IncludeTypes = new[] { typeof(InstanceMultipleImplement3DepthType), typeof(InstanceMultipleImplement2DepthType), typeof(InstanceMultipleImplement1DepthType), typeof(InstanceMultipleImplementDepthBaseType), typeof(IInterfaceType1), typeof(IInterfaceType3) })]
public static string InstanceMultipleImplementDepthFromInterface3(int value)
{
IInterfaceType3 inst = new InstanceMultipleImplement3DepthType();
diff --git a/tests/IL2C.Core.Test.RuntimeSystems/TypeRelations/TypeInheritance.cs b/tests/IL2C.Core.Test.RuntimeSystems/TypeRelations/TypeInheritance.cs
index 92061e8c..95ee85f9 100644
--- a/tests/IL2C.Core.Test.RuntimeSystems/TypeRelations/TypeInheritance.cs
+++ b/tests/IL2C.Core.Test.RuntimeSystems/TypeRelations/TypeInheritance.cs
@@ -202,184 +202,184 @@ public override string GetStringFromInt32(int value)
[TestId("TypeRelations")]
[Description("CLR type system contains single-inheritance class types and multiple-implementation interface types. These tests are verified the IL2C can handle the member methods both simple instance methods and complex overriden virtual methods.")]
- [TestCase("223", "InstanceBase", 123, IncludeTypes = new[] { typeof(InstanceBaseType) })]
- [TestCase("323", "InstanceNew", 123, IncludeTypes = new[] { typeof(InstanceBaseType), typeof(InstanceNewType) })]
- [TestCase("223", "InstanceNewFromBase", 123, IncludeTypes = new[] { typeof(InstanceBaseType), typeof(InstanceNewType) })]
- [TestCase("323", "InstanceNewVirtual", 123, IncludeTypes = new[] { typeof(InstanceBaseType), typeof(InstanceNewVirtualType) })]
- [TestCase("223", "InstanceNewVirtualFromBase", 123, IncludeTypes = new[] { typeof(InstanceBaseType), typeof(InstanceNewVirtualType) })]
- [TestCase("423", "InstanceNewVirtualOverride", 123, IncludeTypes = new[] { typeof(InstanceBaseType), typeof(InstanceNewVirtualType), typeof(InstanceNewVirtualOverrideType) })]
- [TestCase("223", "InstanceNewVirtualOverrideFromBase", 123, IncludeTypes = new[] { typeof(InstanceBaseType), typeof(InstanceNewVirtualType), typeof(InstanceNewVirtualOverrideType) })]
- [TestCase("423", "InstanceNewVirtualOverrideFromNewVirtual", 123, IncludeTypes = new[] { typeof(InstanceBaseType), typeof(InstanceNewVirtualType), typeof(InstanceNewVirtualOverrideType) })]
- [TestCase("223ABC", "InstanceNewCallBase", 123, IncludeTypes = new[] { typeof(InstanceBaseType), typeof(InstanceNewCallBaseType) })]
- [TestCase("223ABC", "InstanceNewVirtualCallBase", 123, IncludeTypes = new[] { typeof(InstanceBaseType), typeof(InstanceNewVirtualCallBaseType) })]
- [TestCase("323ABC", "InstanceNewVirtualOverrideCallBase", 123, IncludeTypes = new[] { typeof(InstanceBaseType), typeof(InstanceNewVirtualType), typeof(InstanceNewVirtualOverrideCallBaseType) })]
- [TestCase("223", "VirtualBase", 123, IncludeTypes = new[] { typeof(VirtualBaseType) })]
- [TestCase("323", "VirtualOverride", 123, IncludeTypes = new[] { typeof(VirtualBaseType), typeof(VirtualOverrideType) })]
- [TestCase("323", "VirtualOverrideFromBase", 123, IncludeTypes = new[] { typeof(VirtualBaseType), typeof(VirtualOverrideType) })]
- [TestCase("323", "VirtualNew", 123, IncludeTypes = new[] { typeof(VirtualBaseType), typeof(VirtualNewType) })]
- [TestCase("223", "VirtualNewFromBase", 123, IncludeTypes = new[] { typeof(VirtualBaseType), typeof(VirtualNewType) })]
- [TestCase("323", "VirtualNewVirtual", 123, IncludeTypes = new[] { typeof(VirtualBaseType), typeof(VirtualNewVirtualType) })]
- [TestCase("223", "VirtualNewVirtualFromBase", 123, IncludeTypes = new[] { typeof(VirtualBaseType), typeof(VirtualNewVirtualType) })]
- [TestCase("423", "VirtualNewVirtualOverride", 123, IncludeTypes = new[] { typeof(VirtualBaseType), typeof(VirtualNewVirtualType), typeof(VirtualNewVirtualOverrideType) })]
- [TestCase("223", "VirtualNewVirtualOverrideFromBase", 123, IncludeTypes = new[] { typeof(VirtualBaseType), typeof(VirtualNewVirtualType), typeof(VirtualNewVirtualOverrideType) })]
- [TestCase("423", "VirtualNewVirtualOverrideFromNewVirtual", 123, IncludeTypes = new[] { typeof(VirtualBaseType), typeof(VirtualNewVirtualType), typeof(VirtualNewVirtualOverrideType) })]
- [TestCase("223ABC", "VirtualOverrideCallBase", 123, IncludeTypes = new[] { typeof(VirtualBaseType), typeof(VirtualOverrideCallBaseType) })]
- [TestCase("223ABC", "VirtualNewCallBase", 123, IncludeTypes = new[] { typeof(VirtualBaseType), typeof(VirtualNewCallBaseType) })]
- [TestCase("223ABC", "VirtualNewVirtualCallBase", 123, IncludeTypes = new[] { typeof(VirtualBaseType), typeof(VirtualNewVirtualCallBaseType) })]
- [TestCase("323ABC", "VirtualOverrideOverrideCallBase", 123, IncludeTypes = new[] { typeof(VirtualBaseType), typeof(VirtualOverrideType), typeof(VirtualOverrideOverrideCallBaseType) })]
- [TestCase("323ABC", "VirtualNewVirtualOverrideCallBase", 123, IncludeTypes = new[] { typeof(VirtualBaseType), typeof(VirtualNewVirtualType), typeof(VirtualNewVirtualOverrideCallBaseType) })]
public sealed class TypeInheritance
{
+ [TestCase("223", "InstanceBase", 123, IncludeTypes = new[] { typeof(InstanceBaseType) })]
public static string InstanceBase(int value)
{
var inst = new InstanceBaseType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("323", "InstanceNew", 123, IncludeTypes = new[] { typeof(InstanceBaseType), typeof(InstanceNewType) })]
public static string InstanceNew(int value)
{
var inst = new InstanceNewType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("223", "InstanceNewFromBase", 123, IncludeTypes = new[] { typeof(InstanceBaseType), typeof(InstanceNewType) })]
public static string InstanceNewFromBase(int value)
{
InstanceBaseType inst = new InstanceNewType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("323", "InstanceNewVirtual", 123, IncludeTypes = new[] { typeof(InstanceBaseType), typeof(InstanceNewVirtualType) })]
public static string InstanceNewVirtual(int value)
{
var inst = new InstanceNewVirtualType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("223", "InstanceNewVirtualFromBase", 123, IncludeTypes = new[] { typeof(InstanceBaseType), typeof(InstanceNewVirtualType) })]
public static string InstanceNewVirtualFromBase(int value)
{
InstanceBaseType inst = new InstanceNewVirtualType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("423", "InstanceNewVirtualOverride", 123, IncludeTypes = new[] { typeof(InstanceBaseType), typeof(InstanceNewVirtualType), typeof(InstanceNewVirtualOverrideType) })]
public static string InstanceNewVirtualOverride(int value)
{
var inst = new InstanceNewVirtualOverrideType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("223", "InstanceNewVirtualOverrideFromBase", 123, IncludeTypes = new[] { typeof(InstanceBaseType), typeof(InstanceNewVirtualType), typeof(InstanceNewVirtualOverrideType) })]
public static string InstanceNewVirtualOverrideFromBase(int value)
{
InstanceBaseType inst = new InstanceNewVirtualOverrideType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("423", "InstanceNewVirtualOverrideFromNewVirtual", 123, IncludeTypes = new[] { typeof(InstanceBaseType), typeof(InstanceNewVirtualType), typeof(InstanceNewVirtualOverrideType) })]
public static string InstanceNewVirtualOverrideFromNewVirtual(int value)
{
InstanceNewVirtualType inst = new InstanceNewVirtualOverrideType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("223ABC", "InstanceNewCallBase", 123, IncludeTypes = new[] { typeof(InstanceBaseType), typeof(InstanceNewCallBaseType) })]
public static string InstanceNewCallBase(int value)
{
var inst = new InstanceNewCallBaseType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("223ABC", "InstanceNewVirtualCallBase", 123, IncludeTypes = new[] { typeof(InstanceBaseType), typeof(InstanceNewVirtualCallBaseType) })]
public static string InstanceNewVirtualCallBase(int value)
{
var inst = new InstanceNewVirtualCallBaseType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("323ABC", "InstanceNewVirtualOverrideCallBase", 123, IncludeTypes = new[] { typeof(InstanceBaseType), typeof(InstanceNewVirtualType), typeof(InstanceNewVirtualOverrideCallBaseType) })]
public static string InstanceNewVirtualOverrideCallBase(int value)
{
var inst = new InstanceNewVirtualOverrideCallBaseType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("223", "VirtualBase", 123, IncludeTypes = new[] { typeof(VirtualBaseType) })]
public static string VirtualBase(int value)
{
var inst = new VirtualBaseType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("323", "VirtualOverride", 123, IncludeTypes = new[] { typeof(VirtualBaseType), typeof(VirtualOverrideType) })]
public static string VirtualOverride(int value)
{
var inst = new VirtualOverrideType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("323", "VirtualOverrideFromBase", 123, IncludeTypes = new[] { typeof(VirtualBaseType), typeof(VirtualOverrideType) })]
public static string VirtualOverrideFromBase(int value)
{
VirtualBaseType inst = new VirtualOverrideType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("323", "VirtualNew", 123, IncludeTypes = new[] { typeof(VirtualBaseType), typeof(VirtualNewType) })]
public static string VirtualNew(int value)
{
var inst = new VirtualNewType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("223", "VirtualNewFromBase", 123, IncludeTypes = new[] { typeof(VirtualBaseType), typeof(VirtualNewType) })]
public static string VirtualNewFromBase(int value)
{
VirtualBaseType inst = new VirtualNewType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("323", "VirtualNewVirtual", 123, IncludeTypes = new[] { typeof(VirtualBaseType), typeof(VirtualNewVirtualType) })]
public static string VirtualNewVirtual(int value)
{
var inst = new VirtualNewVirtualType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("223", "VirtualNewVirtualFromBase", 123, IncludeTypes = new[] { typeof(VirtualBaseType), typeof(VirtualNewVirtualType) })]
public static string VirtualNewVirtualFromBase(int value)
{
VirtualBaseType inst = new VirtualNewVirtualType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("423", "VirtualNewVirtualOverride", 123, IncludeTypes = new[] { typeof(VirtualBaseType), typeof(VirtualNewVirtualType), typeof(VirtualNewVirtualOverrideType) })]
public static string VirtualNewVirtualOverride(int value)
{
var inst = new VirtualNewVirtualOverrideType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("223", "VirtualNewVirtualOverrideFromBase", 123, IncludeTypes = new[] { typeof(VirtualBaseType), typeof(VirtualNewVirtualType), typeof(VirtualNewVirtualOverrideType) })]
public static string VirtualNewVirtualOverrideFromBase(int value)
{
VirtualBaseType inst = new VirtualNewVirtualOverrideType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("423", "VirtualNewVirtualOverrideFromNewVirtual", 123, IncludeTypes = new[] { typeof(VirtualBaseType), typeof(VirtualNewVirtualType), typeof(VirtualNewVirtualOverrideType) })]
public static string VirtualNewVirtualOverrideFromNewVirtual(int value)
{
VirtualNewVirtualType inst = new VirtualNewVirtualOverrideType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("223ABC", "VirtualOverrideCallBase", 123, IncludeTypes = new[] { typeof(VirtualBaseType), typeof(VirtualOverrideCallBaseType) })]
public static string VirtualOverrideCallBase(int value)
{
var inst = new VirtualOverrideCallBaseType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("223ABC", "VirtualNewCallBase", 123, IncludeTypes = new[] { typeof(VirtualBaseType), typeof(VirtualNewCallBaseType) })]
public static string VirtualNewCallBase(int value)
{
var inst = new VirtualNewCallBaseType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("223ABC", "VirtualNewVirtualCallBase", 123, IncludeTypes = new[] { typeof(VirtualBaseType), typeof(VirtualNewVirtualCallBaseType) })]
public static string VirtualNewVirtualCallBase(int value)
{
var inst = new VirtualNewVirtualCallBaseType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("323ABC", "VirtualOverrideOverrideCallBase", 123, IncludeTypes = new[] { typeof(VirtualBaseType), typeof(VirtualOverrideType), typeof(VirtualOverrideOverrideCallBaseType) })]
public static string VirtualOverrideOverrideCallBase(int value)
{
var inst = new VirtualOverrideOverrideCallBaseType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("323ABC", "VirtualNewVirtualOverrideCallBase", 123, IncludeTypes = new[] { typeof(VirtualBaseType), typeof(VirtualNewVirtualType), typeof(VirtualNewVirtualOverrideCallBaseType) })]
public static string VirtualNewVirtualOverrideCallBase(int value)
{
var inst = new VirtualNewVirtualOverrideCallBaseType();
diff --git a/tests/IL2C.Core.Test.RuntimeSystems/TypeRelations/TypeInheritanceAndImplements.cs b/tests/IL2C.Core.Test.RuntimeSystems/TypeRelations/TypeInheritanceAndImplements.cs
index 8219c879..aaddeac8 100644
--- a/tests/IL2C.Core.Test.RuntimeSystems/TypeRelations/TypeInheritanceAndImplements.cs
+++ b/tests/IL2C.Core.Test.RuntimeSystems/TypeRelations/TypeInheritanceAndImplements.cs
@@ -285,282 +285,285 @@ public class VirtualNewVirtualMultipleImplement3DepthType : VirtualNewVirtualMul
}
[TestId("TypeRelations")]
- [TestCase("223", "InstanceImplicitlyImplement", 123, IncludeTypes = new[] { typeof(InstanceImplicitlyImplementType), typeof(InstanceBaseType), typeof(IInterfaceType1) })]
- [TestCase("223", "InstanceImplicitlyImplementFromInterface", 123, IncludeTypes = new[] { typeof(InstanceImplicitlyImplementType), typeof(InstanceBaseType), typeof(IInterfaceType1) })]
- [TestCase("323", "InstanceNewAndImplement", 123, IncludeTypes = new[] { typeof(InstanceNewAndImplementType), typeof(InstanceBaseType), typeof(IInterfaceType1) })]
- [TestCase("323", "InstanceNewAndImplementFromInterface", 123, IncludeTypes = new[] { typeof(InstanceNewAndImplementType), typeof(InstanceBaseType), typeof(IInterfaceType1) })]
- [TestCase("323", "InstanceNewAndImplicitlyImplement", 123, IncludeTypes = new[] { typeof(InstanceNewAndImplicitlyImplementType), typeof(InstanceImplicitlyImplementType), typeof(InstanceBaseType), typeof(IInterfaceType1) })]
- [TestCase("223", "InstanceNewAndImplicitlyImplementFromInterface", 123, IncludeTypes = new[] { typeof(InstanceNewAndImplicitlyImplementType), typeof(InstanceImplicitlyImplementType), typeof(InstanceBaseType), typeof(IInterfaceType1) })]
- [TestCase("423", "InstanceNewAndNewImplement", 123, IncludeTypes = new[] { typeof(InstanceNewAndNewImplementType), typeof(InstanceNewAndImplementType), typeof(InstanceBaseType), typeof(IInterfaceType1) })]
- [TestCase("423", "InstanceNewAndNewImplementFromInterface", 123, IncludeTypes = new[] { typeof(InstanceNewAndNewImplementType), typeof(InstanceNewAndImplementType), typeof(InstanceBaseType), typeof(IInterfaceType1) })]
- [TestCase("323", "InstanceNewAndImplicitlyAndNewImplement", 123, IncludeTypes = new[] { typeof(InstanceNewAndImplicitlyAndNewImplementType), typeof(InstanceImplicitlyImplementType), typeof(InstanceBaseType), typeof(IInterfaceType1) })]
- [TestCase("323", "InstanceNewAndImplicitlyAndNewImplementFromInterface", 123, IncludeTypes = new[] { typeof(InstanceNewAndImplicitlyAndNewImplementType), typeof(InstanceImplicitlyImplementType), typeof(InstanceBaseType), typeof(IInterfaceType1) })]
- [TestCase("223", "VirtualImplicitlyImplement", 123, IncludeTypes = new[] { typeof(VirtualImplicitlyImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
- [TestCase("223", "VirtualImplicitlyImplementFromInterface", 123, IncludeTypes = new[] { typeof(VirtualImplicitlyImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
- [TestCase("323", "VirtualNewAndImplement", 123, IncludeTypes = new[] { typeof(VirtualNewAndImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
- [TestCase("323", "VirtualNewAndImplementFromInterface", 123, IncludeTypes = new[] { typeof(VirtualNewAndImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
- [TestCase("323", "VirtualNewAndImplicitlyImplement", 123, IncludeTypes = new[] { typeof(VirtualNewAndImplicitlyImplementType), typeof(VirtualImplicitlyImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
- [TestCase("223", "VirtualNewAndImplicitlyImplementFromInterface", 123, IncludeTypes = new[] { typeof(VirtualNewAndImplicitlyImplementType), typeof(VirtualImplicitlyImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
- [TestCase("423", "VirtualNewAndNewImplement", 123, IncludeTypes = new[] { typeof(VirtualNewAndNewImplementType), typeof(VirtualNewAndImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
- [TestCase("423", "VirtualNewAndNewImplementFromInterface", 123, IncludeTypes = new[] { typeof(VirtualNewAndNewImplementType), typeof(VirtualNewAndImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
- [TestCase("323", "VirtualOverrideAndImplement", 123, IncludeTypes = new[] { typeof(VirtualOverrideAndImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
- [TestCase("323", "VirtualOverrideAndImplementFromInterface", 123, IncludeTypes = new[] { typeof(VirtualOverrideAndImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
- [TestCase("323", "VirtualOverrideAndImplicitlyImplement", 123, IncludeTypes = new[] { typeof(VirtualOverrideAndImplicitlyImplementType), typeof(VirtualImplicitlyImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
- [TestCase("323", "VirtualOverrideAndImplicitlyImplementFromInterface", 123, IncludeTypes = new[] { typeof(VirtualOverrideAndImplicitlyImplementType), typeof(VirtualImplicitlyImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
- [TestCase("423", "VirtualOverrideAndNewImplement", 123, IncludeTypes = new[] { typeof(VirtualOverrideAndNewImplementType), typeof(VirtualOverrideAndImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
- [TestCase("323", "VirtualOverrideAndNewImplementFromInterface", 123, IncludeTypes = new[] { typeof(VirtualOverrideAndNewImplementType), typeof(VirtualOverrideAndImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
- [TestCase("423", "VirtualOverrideAndImplicitlyAndNewImplement", 123, IncludeTypes = new[] { typeof(VirtualOverrideAndImplicitlyAndNewImplementType), typeof(VirtualOverrideAndImplicitlyImplementType), typeof(VirtualImplicitlyImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
- [TestCase("323", "VirtualOverrideAndImplicitlyAndNewImplementFromInterface", 123, IncludeTypes = new[] { typeof(VirtualOverrideAndImplicitlyAndNewImplementType), typeof(VirtualOverrideAndImplicitlyImplementType), typeof(VirtualImplicitlyImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
- [TestCase("423", "VirtualOverrideAndNewVirtualImplement", 123, IncludeTypes = new[] { typeof(VirtualOverrideAndNewVirtualImplementType), typeof(VirtualOverrideAndImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
- [TestCase("323", "VirtualOverrideAndNewVirtualImplementFromInterface", 123, IncludeTypes = new[] { typeof(VirtualOverrideAndNewVirtualImplementType), typeof(VirtualOverrideAndImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
- [TestCase("523", "VirtualOverrideAndNewVirtualAndOverrideImplement", 123, IncludeTypes = new[] { typeof(VirtualOverrideAndNewVirtualAndOverrideImplementType), typeof(VirtualOverrideAndNewVirtualImplementType), typeof(VirtualOverrideAndImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
- [TestCase("323", "VirtualOverrideAndNewVirtualAndOverrideImplementFromInterface", 123, IncludeTypes = new[] { typeof(VirtualOverrideAndNewVirtualAndOverrideImplementType), typeof(VirtualOverrideAndNewVirtualImplementType), typeof(VirtualOverrideAndImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
- [TestCase("523", "VirtualOverrideAndNewVirtualAndOverrideReImplement", 123, IncludeTypes = new[] { typeof(VirtualOverrideAndNewVirtualAndOverrideReImplementType), typeof(VirtualOverrideAndNewVirtualImplementType), typeof(VirtualOverrideAndImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
- [TestCase("523", "VirtualOverrideAndNewVirtualAndOverrideReImplementFromInterface", 123, IncludeTypes = new[] { typeof(VirtualOverrideAndNewVirtualAndOverrideReImplementType), typeof(VirtualOverrideAndNewVirtualImplementType), typeof(VirtualOverrideAndImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
- [TestCase("223AAABBBCCCDDD", "VirtualNewVirtualStacked", 123, IncludeTypes = new[] { typeof(VirtualNewVirtualStacked4Type), typeof(VirtualNewVirtualStacked3Type), typeof(VirtualNewVirtualStacked2Type), typeof(VirtualNewVirtualStacked1Type), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
- [TestCase("223AAABBBCCC", "VirtualNewVirtualStackedFromInterface", 123, IncludeTypes = new[] { typeof(VirtualNewVirtualStacked4Type), typeof(VirtualNewVirtualStacked3Type), typeof(VirtualNewVirtualStacked2Type), typeof(VirtualNewVirtualStacked1Type), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
- [TestCase("523", "VirtualOverrideMultipleImplementDepth", 123, IncludeTypes = new[] { typeof(VirtualOverrideMultipleImplement3DepthType), typeof(VirtualOverrideMultipleImplement2DepthType), typeof(VirtualOverrideMultipleImplement1DepthType), typeof(VirtualMultipleImplementDepthBaseType), typeof(IInterfaceType1), typeof(IInterfaceType3) })]
- [TestCase("523", "VirtualOverrideMultipleImplementDepthFromInterface1", 123, IncludeTypes = new[] { typeof(VirtualOverrideMultipleImplement3DepthType), typeof(VirtualOverrideMultipleImplement2DepthType), typeof(VirtualOverrideMultipleImplement1DepthType), typeof(VirtualMultipleImplementDepthBaseType), typeof(IInterfaceType1), typeof(IInterfaceType3) })]
- [TestCase("523", "VirtualOverrideMultipleImplementDepthFromInterface3", 123, IncludeTypes = new[] { typeof(VirtualOverrideMultipleImplement3DepthType), typeof(VirtualOverrideMultipleImplement2DepthType), typeof(VirtualOverrideMultipleImplement1DepthType), typeof(VirtualMultipleImplementDepthBaseType), typeof(IInterfaceType1), typeof(IInterfaceType3) })]
- [TestCase("523", "VirtualNewVirtualMultipleImplementDepth", 123, IncludeTypes = new[] { typeof(VirtualNewVirtualMultipleImplement3DepthType), typeof(VirtualNewVirtualMultipleImplement2DepthType), typeof(VirtualNewVirtualMultipleImplement1DepthType), typeof(VirtualMultipleImplementDepthBaseType), typeof(IInterfaceType1), typeof(IInterfaceType3) })]
- [TestCase("323", "VirtualNewVirtualMultipleImplementDepthFromInterface1", 123, IncludeTypes = new[] { typeof(VirtualNewVirtualMultipleImplement3DepthType), typeof(VirtualNewVirtualMultipleImplement2DepthType), typeof(VirtualNewVirtualMultipleImplement1DepthType), typeof(VirtualMultipleImplementDepthBaseType), typeof(IInterfaceType1), typeof(IInterfaceType3) })]
- [TestCase("423", "VirtualNewVirtualMultipleImplementDepthFromInterface3", 123, IncludeTypes = new[] { typeof(VirtualNewVirtualMultipleImplement3DepthType), typeof(VirtualNewVirtualMultipleImplement2DepthType), typeof(VirtualNewVirtualMultipleImplement1DepthType), typeof(VirtualMultipleImplementDepthBaseType), typeof(IInterfaceType1), typeof(IInterfaceType3) })]
public sealed class TypeInheritanceAndImplements
{
+ [TestCase("223", "InstanceImplicitlyImplement", 123, IncludeTypes = new[] { typeof(InstanceImplicitlyImplementType), typeof(InstanceBaseType), typeof(IInterfaceType1) })]
public static string InstanceImplicitlyImplement(int value)
{
var inst = new InstanceImplicitlyImplementType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("223", "InstanceImplicitlyImplementFromInterface", 123, IncludeTypes = new[] { typeof(InstanceImplicitlyImplementType), typeof(InstanceBaseType), typeof(IInterfaceType1) })]
public static string InstanceImplicitlyImplementFromInterface(int value)
{
IInterfaceType1 inst = new InstanceImplicitlyImplementType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("323", "InstanceNewAndImplement", 123, IncludeTypes = new[] { typeof(InstanceNewAndImplementType), typeof(InstanceBaseType), typeof(IInterfaceType1) })]
public static string InstanceNewAndImplement(int value)
{
var inst = new InstanceNewAndImplementType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("323", "InstanceNewAndImplementFromInterface", 123, IncludeTypes = new[] { typeof(InstanceNewAndImplementType), typeof(InstanceBaseType), typeof(IInterfaceType1) })]
public static string InstanceNewAndImplementFromInterface(int value)
{
IInterfaceType1 inst = new InstanceNewAndImplementType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("323", "InstanceNewAndImplicitlyImplement", 123, IncludeTypes = new[] { typeof(InstanceNewAndImplicitlyImplementType), typeof(InstanceImplicitlyImplementType), typeof(InstanceBaseType), typeof(IInterfaceType1) })]
public static string InstanceNewAndImplicitlyImplement(int value)
{
var inst = new InstanceNewAndImplicitlyImplementType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("223", "InstanceNewAndImplicitlyImplementFromInterface", 123, IncludeTypes = new[] { typeof(InstanceNewAndImplicitlyImplementType), typeof(InstanceImplicitlyImplementType), typeof(InstanceBaseType), typeof(IInterfaceType1) })]
public static string InstanceNewAndImplicitlyImplementFromInterface(int value)
{
IInterfaceType1 inst = new InstanceNewAndImplicitlyImplementType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("423", "InstanceNewAndNewImplement", 123, IncludeTypes = new[] { typeof(InstanceNewAndNewImplementType), typeof(InstanceNewAndImplementType), typeof(InstanceBaseType), typeof(IInterfaceType1) })]
public static string InstanceNewAndNewImplement(int value)
{
var inst = new InstanceNewAndNewImplementType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("423", "InstanceNewAndNewImplementFromInterface", 123, IncludeTypes = new[] { typeof(InstanceNewAndNewImplementType), typeof(InstanceNewAndImplementType), typeof(InstanceBaseType), typeof(IInterfaceType1) })]
public static string InstanceNewAndNewImplementFromInterface(int value)
{
IInterfaceType1 inst = new InstanceNewAndNewImplementType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("323", "InstanceNewAndImplicitlyAndNewImplement", 123, IncludeTypes = new[] { typeof(InstanceNewAndImplicitlyAndNewImplementType), typeof(InstanceImplicitlyImplementType), typeof(InstanceBaseType), typeof(IInterfaceType1) })]
public static string InstanceNewAndImplicitlyAndNewImplement(int value)
{
var inst = new InstanceNewAndImplicitlyAndNewImplementType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("323", "InstanceNewAndImplicitlyAndNewImplementFromInterface", 123, IncludeTypes = new[] { typeof(InstanceNewAndImplicitlyAndNewImplementType), typeof(InstanceImplicitlyImplementType), typeof(InstanceBaseType), typeof(IInterfaceType1) })]
public static string InstanceNewAndImplicitlyAndNewImplementFromInterface(int value)
{
IInterfaceType1 inst = new InstanceNewAndImplicitlyAndNewImplementType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("223", "VirtualImplicitlyImplement", 123, IncludeTypes = new[] { typeof(VirtualImplicitlyImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
public static string VirtualImplicitlyImplement(int value)
{
var inst = new VirtualImplicitlyImplementType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("223", "VirtualImplicitlyImplementFromInterface", 123, IncludeTypes = new[] { typeof(VirtualImplicitlyImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
public static string VirtualImplicitlyImplementFromInterface(int value)
{
IInterfaceType1 inst = new VirtualImplicitlyImplementType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("323", "VirtualNewAndImplement", 123, IncludeTypes = new[] { typeof(VirtualNewAndImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
public static string VirtualNewAndImplement(int value)
{
var inst = new VirtualNewAndImplementType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("323", "VirtualNewAndImplementFromInterface", 123, IncludeTypes = new[] { typeof(VirtualNewAndImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
public static string VirtualNewAndImplementFromInterface(int value)
{
IInterfaceType1 inst = new VirtualNewAndImplementType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("323", "VirtualNewAndImplicitlyImplement", 123, IncludeTypes = new[] { typeof(VirtualNewAndImplicitlyImplementType), typeof(VirtualImplicitlyImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
public static string VirtualNewAndImplicitlyImplement(int value)
{
var inst = new VirtualNewAndImplicitlyImplementType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("223", "VirtualNewAndImplicitlyImplementFromInterface", 123, IncludeTypes = new[] { typeof(VirtualNewAndImplicitlyImplementType), typeof(VirtualImplicitlyImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
public static string VirtualNewAndImplicitlyImplementFromInterface(int value)
{
IInterfaceType1 inst = new VirtualNewAndImplicitlyImplementType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("423", "VirtualNewAndNewImplement", 123, IncludeTypes = new[] { typeof(VirtualNewAndNewImplementType), typeof(VirtualNewAndImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
public static string VirtualNewAndNewImplement(int value)
{
var inst = new VirtualNewAndNewImplementType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("423", "VirtualNewAndNewImplementFromInterface", 123, IncludeTypes = new[] { typeof(VirtualNewAndNewImplementType), typeof(VirtualNewAndImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
public static string VirtualNewAndNewImplementFromInterface(int value)
{
IInterfaceType1 inst = new VirtualNewAndNewImplementType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("323", "VirtualOverrideAndImplement", 123, IncludeTypes = new[] { typeof(VirtualOverrideAndImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
public static string VirtualOverrideAndImplement(int value)
{
var inst = new VirtualOverrideAndImplementType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("323", "VirtualOverrideAndImplementFromInterface", 123, IncludeTypes = new[] { typeof(VirtualOverrideAndImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
public static string VirtualOverrideAndImplementFromInterface(int value)
{
IInterfaceType1 inst = new VirtualOverrideAndImplementType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("323", "VirtualOverrideAndImplicitlyImplement", 123, IncludeTypes = new[] { typeof(VirtualOverrideAndImplicitlyImplementType), typeof(VirtualImplicitlyImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
public static string VirtualOverrideAndImplicitlyImplement(int value)
{
var inst = new VirtualOverrideAndImplicitlyImplementType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("323", "VirtualOverrideAndImplicitlyImplementFromInterface", 123, IncludeTypes = new[] { typeof(VirtualOverrideAndImplicitlyImplementType), typeof(VirtualImplicitlyImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
public static string VirtualOverrideAndImplicitlyImplementFromInterface(int value)
{
IInterfaceType1 inst = new VirtualOverrideAndImplicitlyImplementType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("423", "VirtualOverrideAndNewImplement", 123, IncludeTypes = new[] { typeof(VirtualOverrideAndNewImplementType), typeof(VirtualOverrideAndImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
public static string VirtualOverrideAndNewImplement(int value)
{
var inst = new VirtualOverrideAndNewImplementType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("323", "VirtualOverrideAndNewImplementFromInterface", 123, IncludeTypes = new[] { typeof(VirtualOverrideAndNewImplementType), typeof(VirtualOverrideAndImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
public static string VirtualOverrideAndNewImplementFromInterface(int value)
{
IInterfaceType1 inst = new VirtualOverrideAndNewImplementType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("423", "VirtualOverrideAndImplicitlyAndNewImplement", 123, IncludeTypes = new[] { typeof(VirtualOverrideAndImplicitlyAndNewImplementType), typeof(VirtualOverrideAndImplicitlyImplementType), typeof(VirtualImplicitlyImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
public static string VirtualOverrideAndImplicitlyAndNewImplement(int value)
{
var inst = new VirtualOverrideAndImplicitlyAndNewImplementType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("323", "VirtualOverrideAndImplicitlyAndNewImplementFromInterface", 123, IncludeTypes = new[] { typeof(VirtualOverrideAndImplicitlyAndNewImplementType), typeof(VirtualOverrideAndImplicitlyImplementType), typeof(VirtualImplicitlyImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
public static string VirtualOverrideAndImplicitlyAndNewImplementFromInterface(int value)
{
IInterfaceType1 inst = new VirtualOverrideAndImplicitlyAndNewImplementType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("423", "VirtualOverrideAndNewVirtualImplement", 123, IncludeTypes = new[] { typeof(VirtualOverrideAndNewVirtualImplementType), typeof(VirtualOverrideAndImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
public static string VirtualOverrideAndNewVirtualImplement(int value)
{
var inst = new VirtualOverrideAndNewVirtualImplementType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("323", "VirtualOverrideAndNewVirtualImplementFromInterface", 123, IncludeTypes = new[] { typeof(VirtualOverrideAndNewVirtualImplementType), typeof(VirtualOverrideAndImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
public static string VirtualOverrideAndNewVirtualImplementFromInterface(int value)
{
IInterfaceType1 inst = new VirtualOverrideAndNewVirtualImplementType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("523", "VirtualOverrideAndNewVirtualAndOverrideImplement", 123, IncludeTypes = new[] { typeof(VirtualOverrideAndNewVirtualAndOverrideImplementType), typeof(VirtualOverrideAndNewVirtualImplementType), typeof(VirtualOverrideAndImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
public static string VirtualOverrideAndNewVirtualAndOverrideImplement(int value)
{
var inst = new VirtualOverrideAndNewVirtualAndOverrideImplementType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("323", "VirtualOverrideAndNewVirtualAndOverrideImplementFromInterface", 123, IncludeTypes = new[] { typeof(VirtualOverrideAndNewVirtualAndOverrideImplementType), typeof(VirtualOverrideAndNewVirtualImplementType), typeof(VirtualOverrideAndImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
public static string VirtualOverrideAndNewVirtualAndOverrideImplementFromInterface(int value)
{
IInterfaceType1 inst = new VirtualOverrideAndNewVirtualAndOverrideImplementType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("523", "VirtualOverrideAndNewVirtualAndOverrideReImplement", 123, IncludeTypes = new[] { typeof(VirtualOverrideAndNewVirtualAndOverrideReImplementType), typeof(VirtualOverrideAndNewVirtualImplementType), typeof(VirtualOverrideAndImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
public static string VirtualOverrideAndNewVirtualAndOverrideReImplement(int value)
{
var inst = new VirtualOverrideAndNewVirtualAndOverrideReImplementType();
return inst.GetStringFromInt32(value);
}
+ // TODO: Unknown failure on mono linux x64
+ // Expected: "523" But was: "323"
+ [TestCase("523", "VirtualOverrideAndNewVirtualAndOverrideReImplementFromInterface", 123, IncludeTypes = new[] { typeof(VirtualOverrideAndNewVirtualAndOverrideReImplementType), typeof(VirtualOverrideAndNewVirtualImplementType), typeof(VirtualOverrideAndImplementType), typeof(VirtualBaseType), typeof(IInterfaceType1) },
+ RunOnPlatforms = RunOnPlatforms.DotNet)]
public static string VirtualOverrideAndNewVirtualAndOverrideReImplementFromInterface(int value)
{
IInterfaceType1 inst = new VirtualOverrideAndNewVirtualAndOverrideReImplementType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("223AAABBBCCCDDD", "VirtualNewVirtualStacked", 123, IncludeTypes = new[] { typeof(VirtualNewVirtualStacked4Type), typeof(VirtualNewVirtualStacked3Type), typeof(VirtualNewVirtualStacked2Type), typeof(VirtualNewVirtualStacked1Type), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
public static string VirtualNewVirtualStacked(int value)
{
var inst = new VirtualNewVirtualStacked4Type();
return inst.GetStringFromInt32(value);
}
+ [TestCase("223AAABBBCCC", "VirtualNewVirtualStackedFromInterface", 123, IncludeTypes = new[] { typeof(VirtualNewVirtualStacked4Type), typeof(VirtualNewVirtualStacked3Type), typeof(VirtualNewVirtualStacked2Type), typeof(VirtualNewVirtualStacked1Type), typeof(VirtualBaseType), typeof(IInterfaceType1) })]
public static string VirtualNewVirtualStackedFromInterface(int value)
{
IInterfaceType1 inst = new VirtualNewVirtualStacked4Type();
return inst.GetStringFromInt32(value);
}
+ [TestCase("523", "VirtualOverrideMultipleImplementDepth", 123, IncludeTypes = new[] { typeof(VirtualOverrideMultipleImplement3DepthType), typeof(VirtualOverrideMultipleImplement2DepthType), typeof(VirtualOverrideMultipleImplement1DepthType), typeof(VirtualMultipleImplementDepthBaseType), typeof(IInterfaceType1), typeof(IInterfaceType3) })]
public static string VirtualOverrideMultipleImplementDepth(int value)
{
var inst = new VirtualOverrideMultipleImplement3DepthType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("523", "VirtualOverrideMultipleImplementDepthFromInterface1", 123, IncludeTypes = new[] { typeof(VirtualOverrideMultipleImplement3DepthType), typeof(VirtualOverrideMultipleImplement2DepthType), typeof(VirtualOverrideMultipleImplement1DepthType), typeof(VirtualMultipleImplementDepthBaseType), typeof(IInterfaceType1), typeof(IInterfaceType3) })]
public static string VirtualOverrideMultipleImplementDepthFromInterface1(int value)
{
IInterfaceType1 inst = new VirtualOverrideMultipleImplement3DepthType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("523", "VirtualOverrideMultipleImplementDepthFromInterface3", 123, IncludeTypes = new[] { typeof(VirtualOverrideMultipleImplement3DepthType), typeof(VirtualOverrideMultipleImplement2DepthType), typeof(VirtualOverrideMultipleImplement1DepthType), typeof(VirtualMultipleImplementDepthBaseType), typeof(IInterfaceType1), typeof(IInterfaceType3) })]
public static string VirtualOverrideMultipleImplementDepthFromInterface3(int value)
{
IInterfaceType3 inst = new VirtualOverrideMultipleImplement3DepthType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("523", "VirtualNewVirtualMultipleImplementDepth", 123, IncludeTypes = new[] { typeof(VirtualNewVirtualMultipleImplement3DepthType), typeof(VirtualNewVirtualMultipleImplement2DepthType), typeof(VirtualNewVirtualMultipleImplement1DepthType), typeof(VirtualMultipleImplementDepthBaseType), typeof(IInterfaceType1), typeof(IInterfaceType3) })]
public static string VirtualNewVirtualMultipleImplementDepth(int value)
{
var inst = new VirtualNewVirtualMultipleImplement3DepthType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("323", "VirtualNewVirtualMultipleImplementDepthFromInterface1", 123, IncludeTypes = new[] { typeof(VirtualNewVirtualMultipleImplement3DepthType), typeof(VirtualNewVirtualMultipleImplement2DepthType), typeof(VirtualNewVirtualMultipleImplement1DepthType), typeof(VirtualMultipleImplementDepthBaseType), typeof(IInterfaceType1), typeof(IInterfaceType3) })]
public static string VirtualNewVirtualMultipleImplementDepthFromInterface1(int value)
{
IInterfaceType1 inst = new VirtualNewVirtualMultipleImplement3DepthType();
return inst.GetStringFromInt32(value);
}
+ [TestCase("423", "VirtualNewVirtualMultipleImplementDepthFromInterface3", 123, IncludeTypes = new[] { typeof(VirtualNewVirtualMultipleImplement3DepthType), typeof(VirtualNewVirtualMultipleImplement2DepthType), typeof(VirtualNewVirtualMultipleImplement1DepthType), typeof(VirtualMultipleImplementDepthBaseType), typeof(IInterfaceType1), typeof(IInterfaceType3) })]
public static string VirtualNewVirtualMultipleImplementDepthFromInterface3(int value)
{
IInterfaceType3 inst = new VirtualNewVirtualMultipleImplement3DepthType();
diff --git a/tests/IL2C.Core.Test.RuntimeSystems/ValueTypes/ValueTypes.cs b/tests/IL2C.Core.Test.RuntimeSystems/ValueTypes/ValueTypes.cs
index 2280fa74..dbd86188 100644
--- a/tests/IL2C.Core.Test.RuntimeSystems/ValueTypes/ValueTypes.cs
+++ b/tests/IL2C.Core.Test.RuntimeSystems/ValueTypes/ValueTypes.cs
@@ -155,38 +155,23 @@ public override string ToString()
}
[Description("Value types are specialized types at the .NET type system. Because the type inherited from the System.ValueType (objref type), all method has the managed pointer at the arg0 and these instances will box and apply the pseudo vptrs. These tests are verified the IL2C can handle value types.")]
- [TestCase("123", "CallInstanceMethod", 123, IncludeTypes = new[] { typeof(ValueType1) })]
- [TestCase("123", "CallInstanceMethodDirectly", 123, IncludeTypes = new[] { typeof(ValueType2), typeof(IValueTypeAccessor1) })]
- [TestCase("123", "CallInstanceMethodBoxedInterface", 123, IncludeTypes = new[] { typeof(ValueType2), typeof(IValueTypeAccessor1) })]
- [TestCase("123", "CallCombinedInstanceMethodDirectly", 123, IncludeTypes = new[] { typeof(ValueTypeCombinedInterfaces), typeof(IValueTypeAccessor1), typeof(IValueTypeAccessor2) })]
- [TestCase("123", "CallCombinedInstanceMethodBoxedInterface1", 123, IncludeTypes = new[] { typeof(ValueTypeCombinedInterfaces), typeof(IValueTypeAccessor1), typeof(IValueTypeAccessor2) })]
- [TestCase("123", "CallCombinedInstanceMethodBoxedInterface2", 123, IncludeTypes = new[] { typeof(ValueTypeCombinedInterfaces), typeof(IValueTypeAccessor1), typeof(IValueTypeAccessor2) })]
- [TestCase("123", "CallCombinedInstanceMethodExplicitlyDirectly", 123, IncludeTypes = new[] { typeof(ValueTypeCombinedExplicitlyInterfaces), typeof(IValueTypeAccessor1), typeof(IValueTypeAccessor2) })]
- [TestCase("223", "CallCombinedInstanceMethodExplicitlyBoxedInterface1", 123, IncludeTypes = new[] { typeof(ValueTypeCombinedExplicitlyInterfaces), typeof(IValueTypeAccessor1), typeof(IValueTypeAccessor2) })]
- [TestCase("323", "CallCombinedInstanceMethodExplicitlyBoxedInterface2", 123, IncludeTypes = new[] { typeof(ValueTypeCombinedExplicitlyInterfaces), typeof(IValueTypeAccessor1), typeof(IValueTypeAccessor2) })]
- [TestCase("123", "CallOverrideMethod", 123, IncludeTypes = new[] { typeof(ValueTypeWithOverridedVirtual1) })]
- [TestCase("123", "CallOverrideMethodDirectly", 123, IncludeTypes = new[] { typeof(ValueTypeWithOverridedVirtual2), typeof(IValueTypeOverrideAccessor) })]
- [TestCase("123", "CallOverrideMethodBoxed", 123, IncludeTypes = new[] { typeof(ValueTypeWithOverridedVirtual2), typeof(IValueTypeOverrideAccessor) })]
- [TestCase("123", "CallOverrideMethodBoxedInterface", 123, IncludeTypes = new[] { typeof(ValueTypeWithOverridedVirtual2), typeof(IValueTypeOverrideAccessor) })]
- [TestCase("IL2C.RuntimeSystems.ValueTypeInheritedMethod", "CallInheritedMethod", IncludeTypes = new[] { typeof(ValueTypeInheritedMethod) })]
- [TestCase(456, "ValueTypeUpdate1", 123, 456, IncludeTypes = new[] { typeof(ValueTypeUpdateType1) })]
- [TestCase(123, "ValueTypeUpdate2", 123, 456, IncludeTypes = new[] { typeof(ValueTypeUpdateType2), typeof(IValueTypeUpdateType2) })]
- [TestCase(123, "ValueTypeUpdate2ExplicitlyBoxed", 123, 456, IncludeTypes = new[] { typeof(ValueTypeUpdateType2), typeof(IValueTypeUpdateType2) })]
- [TestCase(456, "ValueTypeUpdate3", 123, IncludeTypes = new[] { typeof(ValueTypeUpdateType3) })]
public sealed class ValueTypes
{
+ [TestCase("123", "CallInstanceMethod", 123, IncludeTypes = new[] { typeof(ValueType1) })]
public static string CallInstanceMethod(int value)
{
var v = new ValueType1(value);
return v.GetStringValue();
}
+ [TestCase("123", "CallInstanceMethodDirectly", 123, IncludeTypes = new[] { typeof(ValueType2), typeof(IValueTypeAccessor1) })]
public static string CallInstanceMethodDirectly(int value)
{
var v = new ValueType2(value);
return v.GetStringValue();
}
+ [TestCase("123", "CallInstanceMethodBoxedInterface", 123, IncludeTypes = new[] { typeof(ValueType2), typeof(IValueTypeAccessor1) })]
public static string CallInstanceMethodBoxedInterface(int value)
{
// implicitly boxed
@@ -194,12 +179,14 @@ public static string CallInstanceMethodBoxedInterface(int value)
return v.GetStringValue();
}
+ [TestCase("123", "CallCombinedInstanceMethodDirectly", 123, IncludeTypes = new[] { typeof(ValueTypeCombinedInterfaces), typeof(IValueTypeAccessor1), typeof(IValueTypeAccessor2) })]
public static string CallCombinedInstanceMethodDirectly(int value)
{
var v = new ValueTypeCombinedInterfaces(value);
return v.GetStringValue();
}
+ [TestCase("123", "CallCombinedInstanceMethodBoxedInterface1", 123, IncludeTypes = new[] { typeof(ValueTypeCombinedInterfaces), typeof(IValueTypeAccessor1), typeof(IValueTypeAccessor2) })]
public static string CallCombinedInstanceMethodBoxedInterface1(int value)
{
// implicitly boxed
@@ -207,6 +194,7 @@ public static string CallCombinedInstanceMethodBoxedInterface1(int value)
return v.GetStringValue();
}
+ [TestCase("123", "CallCombinedInstanceMethodBoxedInterface2", 123, IncludeTypes = new[] { typeof(ValueTypeCombinedInterfaces), typeof(IValueTypeAccessor1), typeof(IValueTypeAccessor2) })]
public static string CallCombinedInstanceMethodBoxedInterface2(int value)
{
// implicitly boxed
@@ -214,12 +202,14 @@ public static string CallCombinedInstanceMethodBoxedInterface2(int value)
return v.GetStringValue();
}
+ [TestCase("123", "CallCombinedInstanceMethodExplicitlyDirectly", 123, IncludeTypes = new[] { typeof(ValueTypeCombinedExplicitlyInterfaces), typeof(IValueTypeAccessor1), typeof(IValueTypeAccessor2) })]
public static string CallCombinedInstanceMethodExplicitlyDirectly(int value)
{
var v = new ValueTypeCombinedExplicitlyInterfaces(value);
return v.GetStringValue();
}
+ [TestCase("223", "CallCombinedInstanceMethodExplicitlyBoxedInterface1", 123, IncludeTypes = new[] { typeof(ValueTypeCombinedExplicitlyInterfaces), typeof(IValueTypeAccessor1), typeof(IValueTypeAccessor2) })]
public static string CallCombinedInstanceMethodExplicitlyBoxedInterface1(int value)
{
// implicitly boxed
@@ -227,6 +217,7 @@ public static string CallCombinedInstanceMethodExplicitlyBoxedInterface1(int val
return v.GetStringValue();
}
+ [TestCase("323", "CallCombinedInstanceMethodExplicitlyBoxedInterface2", 123, IncludeTypes = new[] { typeof(ValueTypeCombinedExplicitlyInterfaces), typeof(IValueTypeAccessor1), typeof(IValueTypeAccessor2) })]
public static string CallCombinedInstanceMethodExplicitlyBoxedInterface2(int value)
{
// implicitly boxed
@@ -234,25 +225,29 @@ public static string CallCombinedInstanceMethodExplicitlyBoxedInterface2(int val
return v.GetStringValue();
}
+ [TestCase("123", "CallOverrideMethod", 123, IncludeTypes = new[] { typeof(ValueTypeWithOverridedVirtual1) })]
public static string CallOverrideMethod(int value)
{
var v = new ValueTypeWithOverridedVirtual1(value);
return v.ToString();
}
+ [TestCase("123", "CallOverrideMethodDirectly", 123, IncludeTypes = new[] { typeof(ValueTypeWithOverridedVirtual2), typeof(IValueTypeOverrideAccessor) })]
public static string CallOverrideMethodDirectly(int value)
{
var v = new ValueTypeWithOverridedVirtual2(value);
return v.ToString();
}
+ [TestCase("123", "CallOverrideMethodBoxed", 123, IncludeTypes = new[] { typeof(ValueTypeWithOverridedVirtual2), typeof(IValueTypeOverrideAccessor) })]
public static string CallOverrideMethodBoxed(int value)
{
// implicitly boxed
object v = new ValueTypeWithOverridedVirtual2(value);
- return v.ToString();
+ return v.ToString()!;
}
+ [TestCase("123", "CallOverrideMethodBoxedInterface", 123, IncludeTypes = new[] { typeof(ValueTypeWithOverridedVirtual2), typeof(IValueTypeOverrideAccessor) })]
public static string CallOverrideMethodBoxedInterface(int value)
{
// implicitly boxed
@@ -260,12 +255,14 @@ public static string CallOverrideMethodBoxedInterface(int value)
return v.ToString();
}
+ [TestCase("IL2C.RuntimeSystems.ValueTypeInheritedMethod", "CallInheritedMethod", IncludeTypes = new[] { typeof(ValueTypeInheritedMethod) })]
public static string CallInheritedMethod()
{
var v = new ValueTypeInheritedMethod();
- return v.ToString();
+ return v.ToString()!;
}
+ [TestCase(456, "ValueTypeUpdate1", 123, 456, IncludeTypes = new[] { typeof(ValueTypeUpdateType1) })]
public static int ValueTypeUpdate1(int before, int update)
{
var v = new ValueTypeUpdateType1(before);
@@ -273,6 +270,7 @@ public static int ValueTypeUpdate1(int before, int update)
return v.Value;
}
+ [TestCase(123, "ValueTypeUpdate2", 123, 456, IncludeTypes = new[] { typeof(ValueTypeUpdateType2), typeof(IValueTypeUpdateType2) })]
public static int ValueTypeUpdate2(int before, int update)
{
var v = new ValueTypeUpdateType2(before);
@@ -280,6 +278,7 @@ public static int ValueTypeUpdate2(int before, int update)
return v.Value;
}
+ [TestCase(123, "ValueTypeUpdate2ExplicitlyBoxed", 123, 456, IncludeTypes = new[] { typeof(ValueTypeUpdateType2), typeof(IValueTypeUpdateType2) })]
public static int ValueTypeUpdate2ExplicitlyBoxed(int before, int update)
{
var v = new ValueTypeUpdateType2(before);
@@ -288,6 +287,7 @@ public static int ValueTypeUpdate2ExplicitlyBoxed(int before, int update)
return v.Value;
}
+ [TestCase(456, "ValueTypeUpdate3", 123, IncludeTypes = new[] { typeof(ValueTypeUpdateType3) })]
public static int ValueTypeUpdate3(int before)
{
var v = new ValueTypeUpdateType3(before);