diff --git a/.gitignore b/.gitignore
index 39f459f0940a..9b5c852e2a30 100644
--- a/.gitignore
+++ b/.gitignore
@@ -190,3 +190,15 @@ Session.vim
# VS debug support files
launchSettings.json
+
+# Swift output files
+*.swiftinterface*
+*.swiftdoc*
+*.swiftmodule*
+*.abi*
+*.swiftsourceinfo*
+*.dylib
+
+# Testing artifacts
+testing/
+src/samples/**/*Bindings.cs
diff --git a/SwiftBindings.sln b/SwiftBindings.sln
index b9fbbaacd06f..3ee2ed084abc 100644
--- a/SwiftBindings.sln
+++ b/SwiftBindings.sln
@@ -3,9 +3,13 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26124.0
MinimumVisualStudioVersion = 15.0.26124.0
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SwiftBindings", "src\SwiftBindings\src\SwiftBindings.csproj", "{B7977360-6671-4707-9A1C-1C29D5BE2674}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SwiftBindings", "src\Swift.Bindings\src\Swift.Bindings.csproj", "{B7977360-6671-4707-9A1C-1C29D5BE2674}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SwiftBindings.Tests", "src\SwiftBindings\tests\SwiftBindings.Tests.csproj", "{CE81B6BD-CCCC-4223-9069-B28435A4A5C1}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SwiftBindings.Tests", "src\Swift.Bindings\tests\Swift.Bindings.Tests.csproj", "{CE81B6BD-CCCC-4223-9069-B28435A4A5C1}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SwiftRuntime", "src\Swift.Runtime\src\Swift.Runtime.csproj", "{8E9013BE-01BD-4F4C-8BF7-E8C71FA6608E}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SwiftRuntime.Tests", "src\Swift.Runtime\tests\Swift.Runtime.Tests.csproj", "{61F74BC6-1CCA-49FA-B5B8-6C9EABC1D0AB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -44,5 +48,29 @@ Global
{CE81B6BD-CCCC-4223-9069-B28435A4A5C1}.Release|x64.Build.0 = Release|Any CPU
{CE81B6BD-CCCC-4223-9069-B28435A4A5C1}.Release|x86.ActiveCfg = Release|Any CPU
{CE81B6BD-CCCC-4223-9069-B28435A4A5C1}.Release|x86.Build.0 = Release|Any CPU
+ {8E9013BE-01BD-4F4C-8BF7-E8C71FA6608E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8E9013BE-01BD-4F4C-8BF7-E8C71FA6608E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8E9013BE-01BD-4F4C-8BF7-E8C71FA6608E}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {8E9013BE-01BD-4F4C-8BF7-E8C71FA6608E}.Debug|x64.Build.0 = Debug|Any CPU
+ {8E9013BE-01BD-4F4C-8BF7-E8C71FA6608E}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {8E9013BE-01BD-4F4C-8BF7-E8C71FA6608E}.Debug|x86.Build.0 = Debug|Any CPU
+ {8E9013BE-01BD-4F4C-8BF7-E8C71FA6608E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8E9013BE-01BD-4F4C-8BF7-E8C71FA6608E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {8E9013BE-01BD-4F4C-8BF7-E8C71FA6608E}.Release|x64.ActiveCfg = Release|Any CPU
+ {8E9013BE-01BD-4F4C-8BF7-E8C71FA6608E}.Release|x64.Build.0 = Release|Any CPU
+ {8E9013BE-01BD-4F4C-8BF7-E8C71FA6608E}.Release|x86.ActiveCfg = Release|Any CPU
+ {8E9013BE-01BD-4F4C-8BF7-E8C71FA6608E}.Release|x86.Build.0 = Release|Any CPU
+ {61F74BC6-1CCA-49FA-B5B8-6C9EABC1D0AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {61F74BC6-1CCA-49FA-B5B8-6C9EABC1D0AB}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {61F74BC6-1CCA-49FA-B5B8-6C9EABC1D0AB}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {61F74BC6-1CCA-49FA-B5B8-6C9EABC1D0AB}.Debug|x64.Build.0 = Debug|Any CPU
+ {61F74BC6-1CCA-49FA-B5B8-6C9EABC1D0AB}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {61F74BC6-1CCA-49FA-B5B8-6C9EABC1D0AB}.Debug|x86.Build.0 = Debug|Any CPU
+ {61F74BC6-1CCA-49FA-B5B8-6C9EABC1D0AB}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {61F74BC6-1CCA-49FA-B5B8-6C9EABC1D0AB}.Release|Any CPU.Build.0 = Release|Any CPU
+ {61F74BC6-1CCA-49FA-B5B8-6C9EABC1D0AB}.Release|x64.ActiveCfg = Release|Any CPU
+ {61F74BC6-1CCA-49FA-B5B8-6C9EABC1D0AB}.Release|x64.Build.0 = Release|Any CPU
+ {61F74BC6-1CCA-49FA-B5B8-6C9EABC1D0AB}.Release|x86.ActiveCfg = Release|Any CPU
+ {61F74BC6-1CCA-49FA-B5B8-6C9EABC1D0AB}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
diff --git a/docs/README.md b/docs/README.md
index 3ab8f57377c3..f6377cbdb785 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -4,7 +4,7 @@ This document provides a detailed overview of the .NET Swift interop tooling, fo
## Usage
-The tooling consumes Swift interface files to generate C# bindings. Currently, the tool processes a Swift ABI file, which is generated from a `.swiftinterface` file by the Swift compiler. This ABI file contains a json representation of the abstract syntax tree of the `.swiftinterface` file. The `.swiftinterface` and `.abi.json` files are generated by executing the `swiftc` command with the `-emit-module-interface` option. In upcoming improvements, the ABI aggregator will transition to directly parsing the `.swiftinterface` file and, eventually, a dynamic library to facilitate type-strong parsing.
+The tooling consumes Swift ABI files, which are generated from `.swiftinterface` files by the Swift compiler. This ABI file contains a json representation of the abstract syntax tree of the `.swiftinterface` file. The `.swiftinterface` and `.abi.json` files are generated by executing the `swiftc` command with the `-emit-module-interface` option.
```
Description:
@@ -36,24 +36,57 @@ The table below lists the Swift types and their corresponding C# types.
| Swift Type | C# Type |
| ------------------------------- | -------- |
-| `Swift.Int64` | `long` |
-| `Swift.UInt64` | `ulong` |
-| `Swift.Int32` | `int` |
-| `Swift.UInt32` | `uint` |
-| `Swift.Int16` | `short` |
-| `Swift.UInt16` | `ushort` |
-| `Swift.Int8` | `sbyte` |
-| `Swift.UInt8` | `byte` |
-| `Swift.UnsafeRawPointer` | `void*` |
-| `Swift.UnsafeMutableRawPointer` | `void*` |
-| `Int` | `nint` |
-| `UInt` | `nuint` |
+| `Swift.Int64` | `Int64` |
+| `Swift.UInt64` | `UInt64` |
+| `Swift.Int32` | `Int32` |
+| `Swift.UInt32` | `UInt32` |
+| `Swift.Int16` | `Int16` |
+| `Swift.UInt16` | `UInt16` |
+| `Swift.Int8` | `SByte` |
+| `Swift.UInt8` | `Byte` |
+| `Int` | `IntPtr` |
+| `UInt` | `UIntPtr`|
| `Bool` | `bool` |
-| `Float` | `float` |
-| `Double` | `double` |
+| `Float` | `Single` |
+| `Double` | `Double` |
+All C# types mentioned are blittable except for `bool`. To facilitate `P/Invoke`, a lightweight wrapper might be required to convert `bool` to `byte`. Swift primitive types are implemented as frozen structs that conform to Swift-specific lowering processes handled by the runtime. However, such mapping can fit within the underlying calling convention as these types are below the size limit for being passed by reference.
-All C# types mentioned are blittable except for `bool`. To facilitate `P/Invoke`, a lightweight wrapper is required to convert `bool` to `byte`. Swift primitive types are implemented as frozen structs that conform to Swift-specific lowering processes handled by the runtime. However, such mapping can fit within the underlying calling convention as these types are below the size limit for being passed by reference.
+
+The Swift type database is an XML-based file format used for describing primitive data types with the following structure:
+
+```xml
+
+
+
+
+
+
+```
+#### Elements
+
+##### `entities`
+- **Description:** Container for individual data type entities.
+- **Child Elements:**
+ - `entity`: Represents a specific data type in Swift.
+ - **Attributes:**
+ - `managedNameSpace`: Specifies the managed namespace of the data type.
+ - `managedTypeName`: Specifies the managed type name of the data type.
+ - **Child Elements:**
+ - `typedeclaration`: Represents the declaration of the Swift type.
+ - **Attributes:**
+ - `kind`: Specifies the kind of type declaration.
+ - `name`: Specifies the name of the Swift type.
+ - `module`: Specifies the module of the Swift type.
+
+
+### Pointers
+
+Swift provides unsafe pointer types as non-owning views into memory: `UnsafePointer`, `UnsafeMutablePointer`, `UnsafeRawPointer`, and `UnsafeMutableRawPointer`. They are implemented as frozen structs in Swift and are projected as structs into C#. The runtime implements Swift structure lowering algorithm, enabling these structs to be passed correctly. They are defined with `_rawValue` property with surfaced `Pointee` property. Mutable pointers are projected as generic types to address method overload issues.
+
+### Buffer pointers
+
+Swift provides buffer pointer types as non-owning views into memory: `UnsafeBufferPointer`, `UnsafeMutableBufferPointer`, `UnsafeRawBufferPointer`, and `UnsafeMutableRawBufferPointer`. They are implemented as frozen structs in Swift and are projected as structs into C#. The runtime implements Swift structure lowering algorithm, enabling these structs to be passed correctly. Typed buffer pointers are defined with `_position` and `_count` properties, while raw buffer pointers are defined with `_position` and `_end`. Surfaced properties on C# side are `BaseAddress` and `Count`. Mutable buffer pointers are projected as generic types to address method overload issues.. Since these buffer pointers do not allocate or own the memory they point to, memory management is not encapsulated within the structs.
### Static and P/Invoke functions
@@ -101,42 +134,33 @@ namespace HelloLibraryBindings
}
```
-In the example, the user's code references the `HelloLibraryBindings` namespace and invokes a static method that has the same name as the Swift function. When the Swift function returns a type, the C# wrapper method also returns type, with additional processing if required.
+In the example, the user's code references the `HelloLibraryBindings` namespace and invokes a static method that has the same name as the Swift function. When the Swift function returns a type, the C# wrapper method also returns type, with additional processing if required. The C# wrapper method is generated only when marshalling is required. If marshalling is not needed, only a P/Invoke declaration is generated.
## Functional outline
-The tooling consists of the following components:
+The tooling comprises the following components:
- **SwiftBindings**: Command-line interface that orchestrates the tooling workflow.
-- **SwiftReflector**: A library provides support for public ABI aggregation. It contains implementation of module declarations and the type system.
-- **SwiftRuntimeLibrary**: Library that provides runtime marshaling support and projections of common Swift types.
-- **SyntaxDynamo**: Library that provides an API for generating C# source code.
+ - **Components:**
+ - `parser`: Parses a Swift library using ABI or Swiftinterface parser.
+ - `marshaller`: Marshals types between C# and Swift.
+ - `emitter`: Emits a C# bindings library using string-based or object model-based emitter.
+- **SwiftRuntime**: Library providing projections of common Swift types. It contains a type database for common Swift types and implements Swift runtime constructs in C#.
The general workflow for generating C# bindings from Swift code is as follows:
-1. Consume the Swift ABI file (`.abi.json`) and aggregate the public ABI using `ISwiftParser`, which generates a `ModuleDeclaration`.
-2. Generate C# source code based on the `ModuleDeclaration`.
+1. Consume the Swift ABI file (`.abi.json`) and aggregate the public ABI using a parser that generates module declarations.
+2. If needed, generate marshalling information for collected ABI.
+3. Generate C# source code using an emitter and generated declarations.
-### Public ABI aggregation
+
-The aggregation of the public ABI is managed through the `ISwiftParser` interface. This interface defines the layout for concrete implementations that are responsible for parsing and aggregating API information. There are two implementations: Swift ABI parser and Swift interface parser. The Swift ABI parser aggregates API information based on an ABI json file and doesn't contain metadata information from types. The Swift interface parser is designed to handle `.swiftinterface` file, which contains more information. The `.swiftinterface` file doesn't contain managled names and the parser consumes the dynamic library (`.dylib`) alongside to generate the `ModuleDeclaration`.
+### Parser
-`ISwiftParser` interface:
-```csharp
-using System;
-using SwiftReflector.SwiftXmlReflection;
-
-namespace SwiftReflector.Parser
-{
- public interface ISwiftParser
- {
- public ModuleDeclaration GetModuleDeclaration(string filePath, ErrorHandling errors);
- }
-}
-```
+The aggregation of the public ABI is done through the `ISwiftParser` interface. This interface defines the layout for concrete implementations responsible for parsing and collecting ABI information. Two implementations exist: Swift ABI parser and Swift interface parser. The Swift ABI parser aggregates ABI information based on an ABI json file. The Swift interface parser is designed to handle `.swiftinterface` files. The `.swiftinterface` file doesn't contain mangled names, and the parser should consume the dynamic library (`.dylib`) to generate declarations. Currently, the tooling only implements the Swift ABI parser.
-### Module declaration
+### Marshaller
-The `ModuleDeclaration` serves as a integration point for public ABI aggregation and code generation phases. It contains ABI information for a module, including classes, structs, enums, protocols, functions, properties, extensions, and operators.
+Ideally, marshalling logic should be done between parsing and emitting if possible. The `ModuleDecl`, `MethodDecl`, and `TypeDecl` represents model definition of collected and marshalled Swift ABI that should be projectable into C#.
-### Code generation
+### Emitter
-Code generation involves a set compilers that convert `ModuleDeclaration` into C# source code. The `BindingsCompiler` and other specific compilers (i.e. `FunctionCompiler`) facilitating the generation of public-facing APIs using `SyntaxDynamo` library.
+Two different strategies are available for emitting: using an object model or a string-based approach. The object model, like Roslyn API, represents a full set of C# language. Currently, the tooling only implements the string-based emitter.
diff --git a/docs/functional-outline.svg b/docs/functional-outline.svg
new file mode 100644
index 000000000000..85709313688f
--- /dev/null
+++ b/docs/functional-outline.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml
index aba6b53f1a50..d9c92c2b8e66 100644
--- a/eng/Version.Details.xml
+++ b/eng/Version.Details.xml
@@ -1,14 +1,6 @@
-
-
-
- https://github.com/dotnet/runtime
- ac82799250fe42c8ba2941aef487aca94ecf04cc
-
-
https://github.com/dotnet/arcade
ace00d8719b8d1fdfd0cc05f71bb9af216338d27
diff --git a/eng/Versions.props b/eng/Versions.props
index 15c2cefdaa8c..427dc3ec049a 100644
--- a/eng/Versions.props
+++ b/eng/Versions.props
@@ -16,6 +16,6 @@
2.4.1
2.4.3
- 9.0.0-preview.2.24128.5
+ 9.0.0-preview.3.24129.2
diff --git a/eng/pipelines/runtimelab.yml b/eng/pipelines/runtimelab.yml
index a2d5f7dda0f4..3d3a7752e8c7 100644
--- a/eng/pipelines/runtimelab.yml
+++ b/eng/pipelines/runtimelab.yml
@@ -49,16 +49,33 @@ stages:
- stage: build
displayName: Build
jobs:
- - template: /eng/pipelines/templates/build-job.yml
- parameters:
- osGroup: OSX
- archType: x64
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
+ - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
+ - template: /eng/pipelines/templates/build-job.yml
+ parameters:
+ osGroup: OSX
+ archType: x64
isOfficialBuild: true
runTests: false
pool:
vmImage: 'macOS-latest'
+ - ${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
+ - template: /eng/pipelines/templates/build-job.yml
+ parameters:
+ osGroup: OSX
+ archType: arm64
+ runTests: true
+ pool:
+ vmImage: 'macOS-latest'
+
+ - template: /eng/pipelines/templates/build-job.yml
+ parameters:
+ osGroup: OSX
+ archType: x64
+ runTests: true
+ pool:
+ vmImage: 'macOS-latest'
+
# Publish and validation steps. Only run in official builds
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- template: \eng\common\templates\post-build\post-build.yml
diff --git a/global.json b/global.json
index 1f45d7eb7eda..92decaa09495 100644
--- a/global.json
+++ b/global.json
@@ -1,11 +1,11 @@
{
"sdk": {
- "version": "9.0.100-preview.1.24101.2",
+ "version": "9.0.100-preview.3.24153.2",
"allowPrerelease": true,
"rollForward": "major"
},
"tools": {
- "dotnet": "9.0.100-preview.1.24101.2",
+ "dotnet": "9.0.100-preview.3.24153.2",
"runtimes": {
"dotnet": [
"$(MicrosoftNETCoreAppVersion)"
diff --git a/src/Swift.Bindings/src/Emitter/BindingsGenerator.ICSharpEmitter.cs b/src/Swift.Bindings/src/Emitter/BindingsGenerator.ICSharpEmitter.cs
new file mode 100644
index 000000000000..e718a8605eba
--- /dev/null
+++ b/src/Swift.Bindings/src/Emitter/BindingsGenerator.ICSharpEmitter.cs
@@ -0,0 +1,17 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+namespace BindingsGeneration
+{
+ ///
+ /// Represents an interface for emitting C# source code.
+ ///
+ public interface ICSharpEmitter
+ {
+ ///
+ /// Emits a C# module based on the module declaration.
+ ///
+ /// The module declaration.
+ public void EmitModule(ModuleDecl decl);
+ }
+}
\ No newline at end of file
diff --git a/src/Swift.Bindings/src/Emitter/BindingsGenerator.StringCSharpEmitter.cs b/src/Swift.Bindings/src/Emitter/BindingsGenerator.StringCSharpEmitter.cs
new file mode 100644
index 000000000000..8770af9bf40a
--- /dev/null
+++ b/src/Swift.Bindings/src/Emitter/BindingsGenerator.StringCSharpEmitter.cs
@@ -0,0 +1,142 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+using System.CodeDom.Compiler;
+using Swift.Runtime;
+
+namespace BindingsGeneration
+{
+ ///
+ /// Represents an string-based C# emitter.
+ ///
+ public class StringCSharpEmitter : ICSharpEmitter
+ {
+ // Literals in generated source
+ private const string PInvokePrefix = "PIfunc_";
+
+ // Private properties
+ private readonly string _outputDirectory;
+ private readonly TypeDatabase _typeDatabase;
+ private readonly int _verbose;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public StringCSharpEmitter(string outputDirectory, TypeDatabase typeDatabase, int verbose = 0)
+ {
+ _outputDirectory = outputDirectory;
+ _typeDatabase = typeDatabase;
+ _verbose = verbose;
+ }
+
+ ///
+ /// Emits a C# module based on the module declaration.
+ ///
+ /// The module declaration.
+ public void EmitModule(ModuleDecl moduleDecl)
+ {
+ var sw = new StringWriter();
+ IndentedTextWriter writer = new(sw);
+
+ var generatedNamespace = $"{moduleDecl.Name}Bindings";
+ foreach (var dependency in moduleDecl.Dependencies)
+ {
+ writer.WriteLine($"using {dependency};");
+ }
+ writer.WriteLine();
+ writer.WriteLine($"namespace {generatedNamespace}");
+ writer.WriteLine($"{{");
+
+ writer.Indent++;
+ writer.WriteLine($"public unsafe class {moduleDecl.Name} {{");
+
+ writer.Indent++;
+ foreach (MethodDecl methodDecl in moduleDecl.Methods)
+ {
+ if (_verbose > 0)
+ Console.WriteLine($"Emitting method: {methodDecl.Name}");
+ EmitPInvoke(writer, moduleDecl, methodDecl);
+ if (methodDecl.RequireMarshalling)
+ EmitMethod(writer, methodDecl);
+ }
+ writer.Indent--;
+ writer.WriteLine($"}}");
+ writer.Indent--;
+ writer.WriteLine($"}}");
+
+ string csOutputPath = Path.Combine(_outputDirectory, $"{generatedNamespace}.cs");
+ using StreamWriter outputFile = new StreamWriter(csOutputPath);
+ outputFile.Write(sw.ToString());
+ }
+
+ ///
+ /// Emits the P/Invoke declaration for a method.
+ ///
+ /// The IndentedTextWriter instance.
+ /// The module declaration.
+ /// The method declaration.
+ public void EmitPInvoke(IndentedTextWriter writer, ModuleDecl moduleDecl, MethodDecl methodDecl)
+ {
+ writer.WriteLine("[UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })]");
+ writer.WriteLine($"[DllImport(\"lib{moduleDecl.Name}.dylib\", EntryPoint = \"{methodDecl.MangledName}\")]");
+ writer.Write($"internal static extern {methodDecl.Signature.First().FullyQualifiedName} {(methodDecl.RequireMarshalling ? PInvokePrefix : String.Empty)}{methodDecl.Name}(");
+ EmitMethodParams(writer, methodDecl.Signature);
+ writer.WriteLine($");");
+ }
+
+ ///
+ /// Emits the method declaration.
+ ///
+ /// The IndentedTextWriter instance.
+ /// The method declaration.
+ public void EmitMethod(IndentedTextWriter writer, MethodDecl decl)
+ {
+ writer.Write($"public static {decl.Signature.First().FullyQualifiedName} {decl.Name}(");
+ EmitMethodParams(writer, decl.Signature);
+ writer.WriteLine($")");
+ writer.WriteLine($"{{");
+
+ writer.Indent++;
+ if (decl.Signature.First().FullyQualifiedName != "void")
+ writer.Write("return ");
+ writer.Write($"{PInvokePrefix}_{decl.Name}(");
+ EmitMethodArgs(writer, decl.Signature);
+ writer.WriteLine($");");
+
+ writer.Indent--;
+ writer.WriteLine($"}}");
+ }
+
+ ///
+ /// Emits the parameters of a method.
+ ///
+ /// The IndentedTextWriter instance.
+ /// The signature of the method.
+ public void EmitMethodParams(IndentedTextWriter writer, IEnumerable signature) {
+ var signatureList = signature.ToList();
+ for (int i = 1; i < signatureList.Count; i++)
+ {
+ var param = signatureList[i];
+ writer.Write($"{param.FullyQualifiedName} {param.Name}");
+ if (i < signatureList.Count - 1)
+ writer.Write(", ");
+ }
+ }
+
+ ///
+ /// Emits invocation arguments of a method.
+ ///
+ /// The IndentedTextWriter instance.
+ /// The signature of the method.
+ public void EmitMethodArgs(IndentedTextWriter writer, IEnumerable signature) {
+ var signatureList = signature.ToList();
+ for (int i = 1; i < signatureList.Count; i++)
+ {
+ var param = signatureList[i];
+ writer.Write($"{param.Name}");
+ if (i < signatureList.Count - 1)
+ writer.Write(", ");
+ }
+ }
+ }
+}
diff --git a/src/Swift.Bindings/src/Model/MethodDecl.cs b/src/Swift.Bindings/src/Model/MethodDecl.cs
new file mode 100644
index 000000000000..bc840dd4b28d
--- /dev/null
+++ b/src/Swift.Bindings/src/Model/MethodDecl.cs
@@ -0,0 +1,32 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+namespace BindingsGeneration
+{
+ ///
+ /// Represents a method declaration.
+ ///
+ public sealed record MethodDecl
+ {
+ ///
+ /// Name of the method.
+ ///
+ public required string Name { get; init; }
+
+ ///
+ /// Mangled name of the method.
+ ///
+ public required string MangledName { get; init; }
+
+ ///
+ /// Indicates if the method requires marshalling.
+ ///
+ public required bool RequireMarshalling { get; init; }
+
+ ///
+ /// Signature of the method.
+ ///
+ public required List Signature { get; set; }
+
+ }
+}
diff --git a/src/Swift.Bindings/src/Model/ModuleDecl.cs b/src/Swift.Bindings/src/Model/ModuleDecl.cs
new file mode 100644
index 000000000000..f66d17dbef2b
--- /dev/null
+++ b/src/Swift.Bindings/src/Model/ModuleDecl.cs
@@ -0,0 +1,28 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+using Newtonsoft.Json.Linq;
+
+namespace BindingsGeneration
+{
+ ///
+ /// Represents a module declaration.
+ ///
+ public sealed record ModuleDecl
+ {
+ ///
+ /// Name of the module.
+ ///
+ public required string Name { get; init; }
+
+ //
+ // The module's dependencies.
+ //
+ public required List Dependencies {get; set;}
+
+ ///
+ /// Methods declared within the module.
+ ///
+ public required List Methods { get; set; }
+ }
+}
diff --git a/src/Swift.Bindings/src/Model/TypeDecl.cs b/src/Swift.Bindings/src/Model/TypeDecl.cs
new file mode 100644
index 000000000000..1936b097e3d7
--- /dev/null
+++ b/src/Swift.Bindings/src/Model/TypeDecl.cs
@@ -0,0 +1,52 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+namespace BindingsGeneration
+{
+ ///
+ /// Represents a type declaration.
+ ///
+ public sealed record TypeDecl
+ {
+ ///
+ /// Name of the type.
+ ///
+ public required string Name { get; set; }
+
+ ///
+ /// Fully qualified name of the type.
+ ///
+ public required string FullyQualifiedName { get; set; }
+
+ ///
+ /// Kind of the type.
+ ///
+ public required TypeKind TypeKind { get; init; }
+
+ ///
+ /// Generics of the type.
+ ///
+ public required List Generics { get; set; }
+
+ ///
+ /// Determines whether the specified object is equal to the current object.
+ ///
+ /// The object to compare with the current object.
+ public bool Equals(TypeDecl? other) => other != null && FullyQualifiedName == other.FullyQualifiedName;
+
+ ///
+ /// Default hash function.
+ ///
+ public override int GetHashCode() => FullyQualifiedName.GetHashCode();
+ }
+
+ ///
+ /// Represents the kind of a type.
+ ///
+ public enum TypeKind
+ {
+ Named = 0,
+ Tuple,
+ Closure,
+ }
+}
diff --git a/src/Swift.Bindings/src/Parser/BindingsGenerator.ISwiftParser.cs b/src/Swift.Bindings/src/Parser/BindingsGenerator.ISwiftParser.cs
new file mode 100644
index 000000000000..12592a277e3e
--- /dev/null
+++ b/src/Swift.Bindings/src/Parser/BindingsGenerator.ISwiftParser.cs
@@ -0,0 +1,16 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+namespace BindingsGeneration
+{
+ ///
+ /// Represents a Swift parser interface.
+ ///
+ public interface ISwiftParser
+ {
+ ///
+ /// Gets the module declaration.
+ ///
+ public ModuleDecl GetModuleDecl();
+ }
+}
diff --git a/src/Swift.Bindings/src/Parser/BindingsGenerator.SwiftABIParser.cs b/src/Swift.Bindings/src/Parser/BindingsGenerator.SwiftABIParser.cs
new file mode 100644
index 000000000000..808f1df69130
--- /dev/null
+++ b/src/Swift.Bindings/src/Parser/BindingsGenerator.SwiftABIParser.cs
@@ -0,0 +1,199 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+using Newtonsoft.Json;
+using Swift.Runtime;
+
+namespace BindingsGeneration
+{
+ ///
+ /// Represents the root node of the ABI.
+ ///
+ public sealed class ABIRootNode
+ {
+ [JsonProperty("ABIRoot")]
+ public required RootNode ABIRoot { get; set; }
+ }
+
+ ///
+ /// Represents the root node of a module.
+ ///
+ public sealed class RootNode
+ {
+ public required string Kind { get; set; }
+ public required string Name { get; set; }
+ public required string PrintedName { get; set; }
+ public required IEnumerable Children { get; set; }
+ }
+
+ ///
+ /// Represents a node.
+ ///
+ public sealed class Node
+ {
+ public required string Kind { get; set; }
+ public required string Name { get; set; }
+ public required string MangledName { get; set; }
+ public required string ModuleName { get; set; }
+ public required string PrintedName { get; set; }
+ public required IEnumerable Children { get; set; }
+ }
+
+ ///
+ /// Represents a parser for Swift ABI.
+ ///
+ public sealed class SwiftABIParser : ISwiftParser
+ {
+ private readonly string _filePath;
+ private readonly int _verbose;
+ private readonly TypeDatabase _typeDatabase;
+
+ public SwiftABIParser(string filePath, TypeDatabase typeDatabase, int verbose = 0)
+ {
+ _filePath = filePath;
+ _verbose = verbose;
+ _typeDatabase = typeDatabase;
+ }
+
+ ///
+ /// Gets the module declaration from the ABI file.
+ ///
+ /// The module declaration.
+ public ModuleDecl GetModuleDecl()
+ {
+ string jsonContent = File.ReadAllText(_filePath);
+ var abiRoot = JsonConvert.DeserializeObject(jsonContent);
+
+ var moduleDecl = new ModuleDecl
+ {
+ Name = Path.GetFileNameWithoutExtension(_filePath).Replace(".abi", ""),
+ Methods = new List(),
+ Dependencies = new List() { "System", "System.Runtime.InteropServices", "System.Runtime.CompilerServices" }
+ };
+
+ if (abiRoot?.ABIRoot?.Children == null) return moduleDecl;
+
+ var stack = new Stack(abiRoot.ABIRoot.Children);
+ while (stack.Count > 0)
+ {
+ var node = stack.Pop();
+
+ switch (node.Kind)
+ {
+ case "Function":
+ try
+ {
+ moduleDecl.Methods.Add(CreateMethodDecl(node, moduleDecl.Dependencies));
+ }
+ catch (Exception e)
+ {
+ if (_verbose > 1)
+ Console.WriteLine($"Warning: Unsupported Swift type: {e.Message}");
+ }
+ break;
+ case "TypeNominal":
+ break;
+ default:
+ if (_verbose > 1)
+ Console.WriteLine($"Warning: Unsupported node type '{node.Kind}' encountered during parsing.");
+ break;
+ }
+
+ if (node.Children != null)
+ {
+ foreach (var child in node.Children)
+ {
+ stack.Push(child);
+ }
+ }
+ }
+
+ return moduleDecl;
+ }
+
+ ///
+ /// Creates a method declaration from a node.
+ ///
+ /// The node representing the method declaration.
+ /// A list of dependencies for the method declaration.
+ /// The method declaration.
+ public MethodDecl CreateMethodDecl(Node node, List dependencies)
+ {
+ // Read the parameter names from the signature
+ // Return type is the first element in the signature
+ var paramNames = new string[] { string.Empty }.Concat(node.PrintedName.Split("(")[1].Split(")")[0].Split(":", StringSplitOptions.RemoveEmptyEntries)).ToList();
+
+ var methodDecl = new MethodDecl
+ {
+ Name = node.Name,
+ MangledName = node.MangledName,
+ Signature = new List(),
+ RequireMarshalling = false
+ };
+
+ if (node.Children != null)
+ {
+ for (int i = 0; i < node.Children.Count(); i++)
+ {
+ var child = node.Children.ElementAt(i);
+ var type = CreateTypeDecl(child, dependencies);
+ type.Name = paramNames[i];
+ methodDecl.Signature.Add(type);
+ }
+ }
+
+ return methodDecl;
+ }
+
+ ///
+ /// Creates a type declaration from a given node.
+ ///
+ /// The node representing the type declaration.
+ /// A list of dependencies for the type declaration.
+ /// The type declaration.
+ public TypeDecl CreateTypeDecl(Node node, List dependencies)
+ {
+ var type = new TypeDecl
+ {
+ Name = string.Empty,
+ FullyQualifiedName = string.Empty,
+ TypeKind = TypeKind.Named,
+ Generics = new List()
+ };
+
+ string[] csharpTypeName;
+ node.Children ??= new List();
+
+ if (!node.Children.Any())
+ {
+ // Non-generic type
+ csharpTypeName = _typeDatabase.GetCSharpTypeName(node.Name);
+ }
+ else
+ {
+ // Generic type
+ csharpTypeName = _typeDatabase.GetCSharpTypeName($"{node.Name}`{node.Children.Count()}");
+ csharpTypeName[1] = csharpTypeName[1].Replace($"`{node.Children.Count()}", "");
+ }
+
+ type.FullyQualifiedName = csharpTypeName[1];
+ if (!dependencies.Contains(csharpTypeName[0]))
+ dependencies.Add(csharpTypeName[0]);
+
+ for (int i = 0; i < node.Children.Count(); i++)
+ {
+ var child = CreateTypeDecl(node.Children.ElementAt(i), dependencies);
+ if (i == 0)
+ type.FullyQualifiedName += $"<{child.FullyQualifiedName}";
+ else
+ type.FullyQualifiedName += $", {child.FullyQualifiedName}";
+ type.Generics.Add(child);
+ }
+
+ if (type.Generics.Any())
+ type.FullyQualifiedName += ">";
+
+ return type;
+ }
+ }
+}
diff --git a/src/Swift.Bindings/src/Program.cs b/src/Swift.Bindings/src/Program.cs
new file mode 100644
index 000000000000..9d77687b031e
--- /dev/null
+++ b/src/Swift.Bindings/src/Program.cs
@@ -0,0 +1,110 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+using System.CommandLine;
+using Swift.Runtime;
+using System.IO;
+
+namespace BindingsGeneration
+{
+ ///
+ /// Command-line tool for generating C# bindings from Swift ABI files.
+ ///
+ public class BindingsGenerator
+ {
+ ///
+ /// Main entry point of the bindings generator tool.
+ ///
+ public static void Main(string[] args)
+ {
+ Option> swiftAbiOption = new(aliases: new[] { "-a", "--swiftabi" }, "Path to the Swift ABI file.") { AllowMultipleArgumentsPerToken = true, IsRequired = true };
+ Option outputDirectoryOption = new(aliases: new[] { "-o", "--output" }, "Output directory for generated bindings.") { IsRequired = true };
+ Option verboseOption = new(aliases: new[] { "-v", "--verbose" }, "Prints information about work in process.");
+ Option helpOption = new(aliases: new[] { "-h", "--help" }, "Display a help message.");
+
+ RootCommand rootCommand = new(description: "Swift bindings generator.")
+ {
+ swiftAbiOption,
+ outputDirectoryOption,
+ verboseOption,
+ helpOption,
+ };
+ rootCommand.SetHandler((IEnumerable swiftAbiPaths, string outputDirectory, int verbose, bool help) =>
+ {
+ if (help)
+ {
+ Console.WriteLine("Usage:");
+ Console.WriteLine(" -a, --swiftabi Required. Path to the Swift ABI file.");
+ Console.WriteLine(" -o, --output Required. Output directory for generated bindings.");
+ Console.WriteLine(" -v, --verbose Information about work in process.");
+ return;
+ }
+
+ if (outputDirectory == string.Empty)
+ {
+ Console.Error.WriteLine("Error: Missing required argument(s).");
+ return;
+ }
+
+ for (int i = 0; i < swiftAbiPaths.Count(); i++)
+ {
+ string swiftAbiPath = swiftAbiPaths.ElementAt(i);
+
+ if (!File.Exists(swiftAbiPath))
+ {
+ Console.Error.WriteLine($"Error: Swift ABI file not found at path '{swiftAbiPath}'.");
+ return;
+ }
+
+ if (verbose > 0)
+ Console.WriteLine($"Processing Swift ABI file: {swiftAbiPath}");
+
+ GenerateBindings(swiftAbiPath, outputDirectory, verbose);
+ }
+ },
+ swiftAbiOption,
+ outputDirectoryOption,
+ verboseOption,
+ helpOption
+ );
+
+ rootCommand.Invoke(args);
+ }
+
+ ///
+ /// Generates C# bindings from a Swift ABI file.
+ ///
+ /// Path to the Swift ABI file.
+ /// Output directory for generated bindings.
+ /// Verbosity level for logging information.
+ public static void GenerateBindings(string swiftAbiPath, string outputDirectory, int verbose = 0)
+ {
+ TypeDatabase typeDatabase = new TypeDatabase(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TypeDatabase.xml"));
+ if (verbose > 0)
+ Console.WriteLine("Starting bindings generation...");
+
+ ISwiftParser swiftParser = new SwiftABIParser(swiftAbiPath, typeDatabase, verbose);
+ var decl = swiftParser.GetModuleDecl();
+
+ if (verbose > 1)
+ Console.WriteLine("Parsed Swift ABI file successfully.");
+
+
+
+ ICSharpEmitter csharpEmitter = new StringCSharpEmitter(outputDirectory, typeDatabase, verbose);
+ csharpEmitter.EmitModule(decl);
+
+ // Copy the Swift.Runtime types to the output directory
+ string[] fileEntries = Directory.GetFiles(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Library"));
+ foreach (string filePath in fileEntries)
+ {
+ string fileName = Path.GetFileName(filePath);
+ string destFilePath = Path.Combine(outputDirectory, fileName);
+ File.Copy(filePath, destFilePath, true);
+ }
+
+ if (verbose > 0)
+ Console.WriteLine("Bindings generation completed.");
+ }
+ }
+}
diff --git a/src/Swift.Bindings/src/Swift.Bindings.csproj b/src/Swift.Bindings/src/Swift.Bindings.csproj
new file mode 100644
index 000000000000..559fb3fa3fa9
--- /dev/null
+++ b/src/Swift.Bindings/src/Swift.Bindings.csproj
@@ -0,0 +1,14 @@
+
+
+
+ Exe
+ net9.0
+ enable
+ enable
+
+
+
+
+
+
+
diff --git a/src/Swift.Bindings/tests/CMakeLists.txt b/src/Swift.Bindings/tests/CMakeLists.txt
new file mode 100644
index 000000000000..cfc4ec567e51
--- /dev/null
+++ b/src/Swift.Bindings/tests/CMakeLists.txt
@@ -0,0 +1,39 @@
+cmake_minimum_required(VERSION 3.24)
+
+project(SwiftTests)
+
+# Find all Swift source files in the directory
+file(GLOB SOURCES "**/*.swift")
+
+if (NOT SWIFT_COMPILER_TARGET)
+ set(SWIFT_PLATFORM "macosx")
+ if (NOT DEFINED CMAKE_OSX_ARCHITECTURES OR CMAKE_OSX_ARCHITECTURES STREQUAL "")
+ set(CMAKE_OSX_ARCHITECTURES "${CMAKE_SYSTEM_PROCESSOR}")
+ endif()
+ set(SWIFT_DEPLOYMENT_TARGET ${CMAKE_OSX_DEPLOYMENT_TARGET})
+ if (NOT DEFINED SWIFT_DEPLOYMENT_TARGET OR SWIFT_DEPLOYMENT_TARGET STREQUAL "")
+ set(SWIFT_DEPLOYMENT_TARGET "11")
+ endif()
+ set(SWIFT_COMPILER_TARGET "${CMAKE_OSX_ARCHITECTURES}-apple-${SWIFT_PLATFORM}${SWIFT_DEPLOYMENT_TARGET}")
+endif()
+
+foreach(SOURCE_FILE ${SOURCES})
+ get_filename_component(SOURCE_DIR ${SOURCE_FILE} DIRECTORY)
+ get_filename_component(PARENT_DIR_NAME ${SOURCE_DIR} NAME)
+ get_filename_component(SOURCE_BASE_NAME ${SOURCE_FILE} NAME_WE)
+ set(OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${PARENT_DIR_NAME}")
+ message(STATUS "Generating ${OUTPUT_DIR} library")
+ file(MAKE_DIRECTORY ${OUTPUT_DIR})
+ add_custom_target(${SOURCE_BASE_NAME} ALL
+ COMMAND xcrun swiftc -target ${SWIFT_COMPILER_TARGET} -emit-module -emit-library -enable-library-evolution -emit-module-interface ${SOURCE_FILE} -o ${OUTPUT_DIR}/lib${SOURCE_BASE_NAME}.dylib
+ DEPENDS ${SOURCE_FILE}
+ COMMENT "Generating ${SOURCE_BASE_NAME} library"
+ )
+ install(FILES ${OUTPUT_DIR}/lib${SOURCE_BASE_NAME}.dylib
+ DESTINATION bin
+ )
+ add_custom_command(TARGET ${SOURCE_BASE_NAME} POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy ${OUTPUT_DIR}/lib${SOURCE_BASE_NAME}.dylib ${CMAKE_CURRENT_BINARY_DIR}
+ COMMENT "Copying ${SOURCE_BASE_NAME} library to binary directory"
+ )
+endforeach()
diff --git a/src/Swift.Bindings/tests/PInvoke/PInvokeTests.cs b/src/Swift.Bindings/tests/PInvoke/PInvokeTests.cs
new file mode 100644
index 000000000000..d6ab30846ab3
--- /dev/null
+++ b/src/Swift.Bindings/tests/PInvoke/PInvokeTests.cs
@@ -0,0 +1,3680 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+using Xunit;
+
+namespace BindingsGeneration.Tests
+{
+ public class PInvokeTests
+ {
+ [Fact]
+ public static void TestSwiftSmoke()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static int getResult()
+ {
+ Console.Write("Running HelloWorld: ");
+ PInvokeTests.helloWorld();
+ return 42;
+ }
+ }
+ }
+ """;
+
+ int result = (int)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(42, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftBool()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static bool getResult()
+ {
+ return PInvokeTests.swiftFuncBool(true);
+ }
+ }
+ }
+ """;
+
+ bool result = (bool)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.True(result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc0()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc0: ");
+ long result = PInvokeTests.swiftFunc0(233837, -19649, 949339914140650, 515944430, 3611910812477598, 1366498001922882872, 253, 36322, 9433, 4255310654111403863);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-7706330218351441791, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc1()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc1: ");
+ long result = PInvokeTests.swiftFunc1(86085159640584, 8266931072168309631, 1110349398, 923925690, 37808, unchecked((nint)1505729412738639024), unchecked((nint)5378706168286662479), unchecked((nuint)3649715618139795268), 7849893551470522942, 56451, 91, unchecked((nuint)8878053038747921600), 50562, 51, 1727716, -7397, 1565437348, 5586083, 51673832327441982, 1640275483742190655, 242);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-3202601456867082324, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc2()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc2: ");
+ long result = PInvokeTests.swiftFunc2(21, 103, 71, 1424520637, 3182953, 59237, 5358256, 185, unchecked((nuint)5971751687364786332), 3252957756581813, 60, 156, 37, 691169209662368818, 619972957, -24591, 1750310134967048045, 3556371, 7350716211230827055, 752486, 13160, 4120692058630618283, 339525547);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(911474180935535301, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc3()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc3: ");
+ long result = PInvokeTests.swiftFunc3(11017, unchecked((nuint)3300243067329724866), unchecked((nint)2197054130026496019), 7, unchecked((nuint)4243803136497835975));
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-6350065034291914241, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc4()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc4: ");
+ long result = PInvokeTests.swiftFunc4(123, 109509832281030, 771052005, unchecked((nint)949115070174941197), 409146992556708, 142, 8802835909468694407, 117, 1991550650, 355009119770696130, -1465, 77, 4978285795473493480, 29393, 35783, unchecked((nuint)465708604896456642), unchecked((nint)6140690449828087415), unchecked((nuint)54183433686440276));
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-9091922861563963282, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc5()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc5: ");
+ long result = PInvokeTests.swiftFunc5(unchecked((nint)6739098280890594874), unchecked((nuint)3195600522343554291), 6597877, unchecked((nint)4743060745349392976), 47478, 51136, 685135916, 1498506, unchecked((nint)2513390154774344247), unchecked((nint)6264911547639833584), 97, 172, -1012, 2975748462028333845);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-3357359150345247842, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc6()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc6: ");
+ long result = PInvokeTests.swiftFunc6(352858064, 39960, unchecked((nuint)8213487426461212263), unchecked((nuint)8748652475782254131), 4373843, -89, 7725301, 36, 137871115990745445, 114855981505908);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-581969692498632062, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc7()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc7: ");
+ long result = PInvokeTests.swiftFunc7(unchecked((nint)2299287859300346739), 1631989942, 1588438125, 46916, -25, unchecked((nint)2434879470176610838), 1297396924186241, 1780608786176839, unchecked((nint)3111883344385004599), 10818, 1339461357, 8225377, 313504081, 795664767, 40);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(4054341816496194551, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc8()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc8: ");
+ long result = PInvokeTests.swiftFunc8(1204549800782266009, -77, 7140941, 5572502, 2067454162041872, 676469398821009314, unchecked((nint)1357719795588198527), -32374, unchecked((nint)3415487707327485172), 3903084861204809, 845624, 90, 1986654521, 114, 214);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-2147505143518021575, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc9()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc9: ");
+ long result = PInvokeTests.swiftFunc9(unchecked((nint)3705651731235919791), unchecked((nint)8105306104169745115), 6731, 1253260485, unchecked((nuint)8727468328369013450), 5633339905753787255, 651456, 5746290834850613062, 21104, 1670307274);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(3533238385513656508, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc10()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc10: ");
+ long result = PInvokeTests.swiftFunc10(1467110824167985295, 1887615810, 2112733722, 8271177801101005406, 2568471098105086703, 17984, 230, 1774094245, 2124643938);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(8515181823957334780, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc11()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc11: ");
+ long result = PInvokeTests.swiftFunc11(unchecked((nuint)4085636179246671464), 3081, -79, -13000, 6737190552584399571, 204, -103, 69, 1527509527, 174, 2113159904681342052, unchecked((nint)4901826652984790117), 22029, 7006945911615348711, 1812624423);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-5125817077505710853, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc12()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc12: ");
+ long result = PInvokeTests.swiftFunc12(6965382, 8312380862312650549, unchecked((nint)9165262159588878385), 17928, 1334453663, -18258, 50575, 1175690859854043654, -1563, 1325, -13033, 109, unchecked((nuint)46750205502198598), 22094, 8206581082498717875, 414098, 43, 1413226877351846990, 3077183154579648);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(4774074602111830179, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc13()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc13: ");
+ long result = PInvokeTests.swiftFunc13(435831281, unchecked((nint)9152379611666687932), 2121329568, 6151812, 272083164, -25750, 8363795, 2452785801682149491, 70, 1402553126);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(8686515529117439727, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc14()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc14: ");
+ long result = PInvokeTests.swiftFunc14(2302358859056615, 1148917190, 3948163471413493, 9149629931189885207, unchecked((nuint)8741258279203724116), 1005305, unchecked((nint)4318208587188430868), -120, 3440736986307467027);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(1430703777921650146, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc15()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc15: ");
+ long result = PInvokeTests.swiftFunc15(257588134824930427, unchecked((nint)8797066708053001900));
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(7324810059718518437, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc16()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc16: ");
+ long result = PInvokeTests.swiftFunc16(18083, 526, unchecked((nint)9092800655449909603), unchecked((nuint)1805357597792116718), 77133128, 4273714158070562, 3356842482838205306, 222, 9005246081447186762, 18718, 4779021523298290196, 265082826573210908, 1651590145, unchecked((nuint)2901617451727386196), 31673, unchecked((nuint)4505812232449759257), 2268590068495235382, 3672721177958656411, 4626146, 206, -70);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-2322427926688559587, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc17()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc17: ");
+ long result = PInvokeTests.swiftFunc17(776236297300099374, unchecked((nuint)83894503467164568), 719637193271577866, 723625097, 8592004555011333063, -3, 160, -45);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-5704419938581148490, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc18()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc18: ");
+ long result = PInvokeTests.swiftFunc18(245, unchecked((nint)4458327158518645661), 6050907, 76, unchecked((nint)5568159142839627860), 52, 1144555738, unchecked((nint)8239694963746799753), 148);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-7333181440701096551, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc19()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc19: ");
+ long result = PInvokeTests.swiftFunc19(1964143, unchecked((nuint)7587937485891193274), 8151333634567615027, 17, 170165831807253, 870321007, 98, 1362436055, unchecked((nint)3145994526327645870), 1332381167, 27209, 1960414431895653, 3646108149104658576, 29716, 4480774200926903, 3993989, 831696419130641, 16961, unchecked((nint)2895643089791458731), 9040165725126613424, 4805, 2986899981433626);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-7514368921355633465, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc20()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc20: ");
+ long result = PInvokeTests.swiftFunc20(2304932402575035, 6462973, 1769831413330094805, 38814, 62195, 52028, 643381139480, 240813148, 917778415, -11908, 43571, 735513651, -110, 1706933298, 141);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(4347999520285809529, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc21()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc21: ");
+ long result = PInvokeTests.swiftFunc21(8204, -18311, 1428916154170345344, 7071281865190759971, 7843802, unchecked((nint)5442642178249643511), 43131, 210, 0, 61711, 104, 6457, 984084882, unchecked((nint)4275598409331185780), unchecked((nuint)8085691827548356926), 387, 1692895, 61, 6740747923378741876, 1508742654);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(9056719667499044372, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc22()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc22: ");
+ long result = PInvokeTests.swiftFunc22(538154736774388864, 44188, 7266230885340174627, unchecked((nuint)2194770502849252955), 915, 50317);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(2450837469650376012, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc23()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc23: ");
+ long result = PInvokeTests.swiftFunc23(3154474308016267173, -54, 6973009299557427565, 4709618332502314628, 623782756, 41, 758947939616460266, 38, 2132563794773469419, 696661960811599136, 1159078994, 4596149, 17273, 83, 36422, 3498443323232355);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-6077835106866375633, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc24()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc24: ");
+ long result = PInvokeTests.swiftFunc24(50216, -31158, 965480864, 31, 1049293008, 8407966859260157806, 20505, 1331992, 4691512, 64675, 7560932795418332291);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-7246961535839287248, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc25()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc25: ");
+ long result = PInvokeTests.swiftFunc25(unchecked((nint)9173857460962505190), 15022, -93, 62197911982761328, 767946476832147, 1436697338, 453782736594733, 8607484193451689185, 1800209635, 6244274, 2230568, 54, 1734973, 4474435427886752355, 668020350438063396, 9113309237687218066);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(4681650148273269479, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc26()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc26: ");
+ long result = PInvokeTests.swiftFunc26(7995355894864936963, 1657769591981037, 5636685, 49073, 1465261410, 4, 118925102, 1262537, 3410729040016453081, 3116369662775677322, 2298252452836462988, unchecked((nuint)1703297916748788633), 41787, 23);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-7896710633380101536, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc27()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc27: ");
+ long result = PInvokeTests.swiftFunc27(1288789349037378, 246, 2006429802, unchecked((nuint)1682808387624676808), 171, 1097881357975166039, -15744, 74, 561093280, unchecked((nuint)2288145815937670417), 1410177917, 3832322133938261341, 247663832, 6775031520610184090, 343414669, 2137107, unchecked((nint)1607566964681057532), 4327003494555178103, -29278, 6636805788201424308, 5472, 610898910012130);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-2413801917489038945, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc28()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc28: ");
+ long result = PInvokeTests.swiftFunc28(708394762);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-5115695744450024635, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc29()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc29: ");
+ long result = PInvokeTests.swiftFunc29(2548726, 185, 23, -27650, 28, 51928, unchecked((nuint)2820244979335896113), 1835, 4050255123891795, 9, 28133, 1603010545626232827, 26825, -3699, unchecked((nuint)9016733266665724964), unchecked((nuint)2189002664079576114), 3158963993105122993, unchecked((nuint)644656289758397492), 7484719451100568914, 41399);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(7218188220935660367, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc30()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc30: ");
+ long result = PInvokeTests.swiftFunc30(2476657055966019, 4347333333421575149, unchecked((nint)7035626728730643182), 246, 330548879, 1030645303, 2185, unchecked((nuint)5053178496758927023), -27715, unchecked((nint)3801555871909422480), 191, unchecked((nint)3437128653478702713), 3235, 1144262746, 3278312, 303215206, 23, 7505126148864499061);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(3303407505715961682, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc31()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc31: ");
+ long result = PInvokeTests.swiftFunc31(186, 5011206654908794290, 1339751659, -14, unchecked((nint)213472320278997211), unchecked((nuint)7645863228691077485), 179117817, 195, -105, 11576, -57, 6980306680077378405, 56);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(6926745355509484660, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc32()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc32: ");
+ long result = PInvokeTests.swiftFunc32(unchecked((nuint)4591110937711003471), 3095346);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-8134759728697468421, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc33()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc33: ");
+ long result = PInvokeTests.swiftFunc33(427594908988451897, 172944849, 2318725425520920129);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-8926062754575499112, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc34()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc34: ");
+ long result = PInvokeTests.swiftFunc34(7575837, -41, 1617235683, -68, 8522361601751102184, 1353310291, 1751998216661839, 236);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(3916199453627741495, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc35()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc35: ");
+ long result = PInvokeTests.swiftFunc35(657240877, -11, 621151963, 3216313916345125, unchecked((nint)4783457933847136272), -12992, 151);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(4225631615746848021, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc36()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc36: ");
+ long result = PInvokeTests.swiftFunc36(unchecked((nint)6825261648432495366), 4924311888837579788, unchecked((nint)2728441732713295124), 8539517680162989134, unchecked((nuint)7911109395014469691), 4271690110707692577);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(9029057458451328084, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc37()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc37: ");
+ long result = PInvokeTests.swiftFunc37(-36, unchecked((nint)95080027562818316), 4100547834833879);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(9091326884382848930, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc38()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc38: ");
+ long result = PInvokeTests.swiftFunc38(5598802284356856503, 3277053653997566283, 59, 153, 3703517767397116, 48);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(2966780901945169708, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc39()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc39: ");
+ long result = PInvokeTests.swiftFunc39(-86, 1025206765, unchecked((nint)8854120933376595148), -26660, 1421450910, 1171078919, unchecked((nint)7160130076335475540), 4878908, 3905851, 702664134620078, unchecked((nuint)2925732235852901624), 29717, unchecked((nint)5151891595858119552), 5037163689792046960, -4663, 7608014, 9191594607153046781, 5532);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-7464446680392812994, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc40()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc40: ");
+ long result = PInvokeTests.swiftFunc40(9, 1203576001, 2456300054912747306, 60251, 1342361607567757, 1388115385, 3232188961689180037, 54573633, 1934356798, 5319583380828737022, unchecked((nuint)999425289681850697), 792187764);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-3563617050423332895, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc41()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc41: ");
+ long result = PInvokeTests.swiftFunc41(8474709311929743705, 12394, unchecked((nint)6127564349538668363), 6333136, 4, 446948525, unchecked((nint)5038104703753360766), 26552, 8206136925734873352, -12, 7199240, unchecked((nuint)8318440149659471267), unchecked((nuint)523184722071542187), 398499589, 1325785459276436, 4573239138788995136, 121, 5590899, 617132760792659437);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-2569382956498289470, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc42()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc42: ");
+ long result = PInvokeTests.swiftFunc42(8982298576385374275, 16564, unchecked((nint)1565617731878871304), 4419651110224616435, unchecked((nint)7891202001623571444));
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-1108582741386924293, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc43()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc43: ");
+ long result = PInvokeTests.swiftFunc43(175);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-5808479907339934850, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc44()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc44: ");
+ long result = PInvokeTests.swiftFunc44(3189698876625689, -18777, 6476950464046275862, 1358084128, 7417, 17593, 610320965697918775, 241147333, 115248210, 4468818817792272374, 17930, 1481953553, -12287, -43, 5647436063971232926);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-234686925954875908, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc45()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc45: ");
+ long result = PInvokeTests.swiftFunc45(197, 183, 6515265205839958632, 9815, 5707972, -4010, 67, 82, 1832502602, 1685291427109048803, 23310, unchecked((nuint)4680356630874532717), -19307);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-9083497234002976264, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc46()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc46: ");
+ long result = PInvokeTests.swiftFunc46(579663255922949977, -114, 61, 950773313, 6516, 1526258723168738010, 6992730720599538682);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-7467754277704703568, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc47()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc47: ");
+ long result = PInvokeTests.swiftFunc47(4289393662241141492, 6772140852363500214, 59427, -98);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(7149358155385248658, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc48()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc48: ");
+ long result = PInvokeTests.swiftFunc48(unchecked((nuint)2785520541460599046), 19124, unchecked((nint)3936154413078833457), 2531598, -22, 7611587982378297798, 4886415070100568562, 53, 168, 47, -12, 1408044606511344677, 586995963, unchecked((nint)877805028374247435), 1735610, 1829192187, 798426250350098200);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-8590814201057560160, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc49()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc49: ");
+ long result = PInvokeTests.swiftFunc49(13797);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(739011484971652047, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc50()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc50: ");
+ long result = PInvokeTests.swiftFunc50(5240299569070422159, 3980, 4966478767025838285, 126, 1448511, 3783312608878806, -32326, 1325886438, 170091605, 1038937165);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(3055246540243887734, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc51()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc51: ");
+ long result = PInvokeTests.swiftFunc51(153365390);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(7917142179400080853, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc52()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc52: ");
+ long result = PInvokeTests.swiftFunc52(49481, unchecked((nuint)2571534213240358460), 19650, 2104528670, 22899, unchecked((nint)8430209965909078811), -25876, 5387620829724391204, unchecked((nint)1450099608276146285), -18049, unchecked((nint)4326178111882457989), 661345047621579, 62960, 239, 3996267746533686661);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-8118257769004209257, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc53()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc53: ");
+ long result = PInvokeTests.swiftFunc53(147266479862857914, unchecked((nint)8878677607688119219), 8593690468919623905, 985107042289460, 3243214921586572926, -18, 5766204873311264178, 2076283, 153, unchecked((nint)4491578823480651614), 31118, 154, 4113143241935276428, 2668467, 2828111477600924337, -48, 822748310022451525, unchecked((nuint)5732324054981972848), unchecked((nint)2079781176213395340), 3554919, 124, unchecked((nint)928745656441981312), -118);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(9075957082830800153, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc54()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc54: ");
+ long result = PInvokeTests.swiftFunc54(13995, 13570, 7335161404114781494, 21761, 4879059693239079259, 191, -83, 336670981, 5585960, 8626184290788542400, 3677, 1958748094, 127, 3173715667118077320, 33889614420216385, 642796371, 1838551347, 13607283572602918, 6503940653653026899, 52, 4879061834664472526, 4455735786978402948, unchecked((nint)5167060653638148074), -59);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(715458900514912094, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc55()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc55: ");
+ long result = PInvokeTests.swiftFunc55(2603647622333053765, 4505865605315186666, 109, 96, 10457, 3407618254032143196, 2771970263176123930, 8387065688735342300, 587214218036297943, 47995, -13);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-7812796314477300904, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc56()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc56: ");
+ long result = PInvokeTests.swiftFunc56(unchecked((nuint)4635596573752865036), 872443880, 2315186662326589, 7230035846427727261, 3908289, 400472551, unchecked((nint)1465473227822284563), -31971, unchecked((nuint)2826972572414861403), 3888061765805348, 779414124, 1373494226, 65241, -14, unchecked((nint)800185043394788883), 99, 70223058, -76, 226);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-3660123537755587162, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc57()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc57: ");
+ long result = PInvokeTests.swiftFunc57(-31909, 6905301, 25023, unchecked((nint)1103857621324234540), 2098823486, 5414734, -11, 926572209, 3200449698799467781, 3679569258896139, 8812281510378648951, unchecked((nuint)4871025154453945009), 152, 62421);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-8830493546874923270, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc58()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc58: ");
+ long result = PInvokeTests.swiftFunc58(unchecked((nint)7967575041279499718), 3232788, 14816036, 3383016995295473, unchecked((nuint)4850027613376762027), unchecked((nint)8327795864754336795), 3340754, -3120, 2761192, 3983147687671529407, 71, 5318708, 1392678309);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(6514055640091085387, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc59()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc59: ");
+ long result = PInvokeTests.swiftFunc59(44844, unchecked((nuint)1748801304810040008), 30766, unchecked((nuint)4039697629876222207), 1041509849, 58, -4630, 2359663412992532838, 4965740);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(5046324847209516867, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc60()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc60: ");
+ long result = PInvokeTests.swiftFunc60(1832792349913741, 412903961769194327, 15449);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-8176066941526010601, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc61()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc61: ");
+ long result = PInvokeTests.swiftFunc61(-56, 10, 254, 3947646992575930886, unchecked((nint)1512031355372423197), 376047834, unchecked((nint)1656240652039967673), 22865, 2499705526110532, 44, 1741513168, 221);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-8047185703659702100, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc62()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc62: ");
+ long result = PInvokeTests.swiftFunc62(10, 2075487406, -9981, 168, unchecked((nint)6799443207845790064), 16835, 4246786459783416, 99, 2318900356573254122, 4147579480654007864);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(6758416630263865563, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc63()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc63: ");
+ long result = PInvokeTests.swiftFunc63(4817099);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-24765264996518815, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc64()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc64: ");
+ long result = PInvokeTests.swiftFunc64(-31400, 33, 1144995603961263);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(4496411701938139124, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc65()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc65: ");
+ long result = PInvokeTests.swiftFunc65(343468144996369, 1595701486, 691136339, 377795381, unchecked((nuint)8621456802956657380), 387673204, -79, 684151295, 2702822453080893204, 658117164, 1483498070, 19901, 82, 298593782, 498504311);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(7620356050748244213, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc66()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc66: ");
+ long result = PInvokeTests.swiftFunc66(unchecked((nuint)6742646500239271530), 1283101175, unchecked((nuint)971826232915481756), 6531);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-6837183037573462724, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc67()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc67: ");
+ long result = PInvokeTests.swiftFunc67(2788572937592617, 59180, 200708656, 9131, 1755490561, 258348099, 254, 779012863187640, 1906037567212321, 544676897, 7911267266539149763, 336384219, 575060377, -11136, 1779482464);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(3965211134150981679, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc68()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc68: ");
+ long result = PInvokeTests.swiftFunc68(99561312221799, 1453132808, 1612303761, unchecked((nint)6043673650667392022), unchecked((nuint)560907030475989979));
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(8645187640386338150, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc69()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc69: ");
+ long result = PInvokeTests.swiftFunc69(unchecked((nuint)5309972206871421224), 27234, 5023167, 45761, 6425609162827184107);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-2766546132850174765, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc70()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc70: ");
+ long result = PInvokeTests.swiftFunc70(265213086, 2024995329946372, 99, unchecked((nuint)6130388454564398915), 13675, unchecked((nint)7672787511778724532), 83667695082967, unchecked((nint)8879102379708862673));
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-6730251310408327023, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc71()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc71: ");
+ long result = PInvokeTests.swiftFunc71(unchecked((nuint)7826726408346018358), 3933082761574796313, 1549799158, 1737163241, 4770998022264795192, 3012307, -22318, 174, 3175654294509651, 7095989, unchecked((nint)2671492835533826745), unchecked((nint)4435595869554769711), 3593089457929161, -70, 12103, 1171000858, 142);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-4761426221194945322, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc72()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc72: ");
+ long result = PInvokeTests.swiftFunc72(6784686274248571763, 104, unchecked((nint)909285983876097936), 6714220880263670485, 7373872626119376832, -23109, -39, 85, 3722567341893906, 5856612, 11316);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(8722701469163367659, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc73()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc73: ");
+ long result = PInvokeTests.swiftFunc73(-31440, 1071353143);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(9091436234605144348, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc74()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc74: ");
+ long result = PInvokeTests.swiftFunc74(8367961236466665848, 3084215, 5133, 881467901, 1349905959, 1058177434, 266815227, 740895977807658292, unchecked((nuint)2510276735562063056), 2731666997695150, 7789234325148051159, 1528039387, 16705, 146766703, 4585584465621462072, 1977);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-4564195959279673945, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc75()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc75: ");
+ long result = PInvokeTests.swiftFunc75(1027938307, 56236, 88, 98, 27306, 61342909, 2269015579127872, 1031703529, 8402886576148882920, -68, 3807162);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-3369734987080453648, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc76()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc76: ");
+ long result = PInvokeTests.swiftFunc76(301994950391123, 4344776, 104, 2137807671, 171179011, 3134127914468069876, 6656, 42885, unchecked((nint)7737600182044247158), -120, 1033649432, 129875179286116790);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-8920640767423704440, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc77()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc77: ");
+ long result = PInvokeTests.swiftFunc77(3316166077206800, 3332468478057987249, 1373131825374120, 4918231, 2744065375713515, 3594016966337642259, -60, 20, -106, 2272, 856759296, unchecked((nuint)411883701353980843), unchecked((nint)932327579092391229), 515885, 42, 29247, 2550, 995856082225857);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(6960169366615671879, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc78()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc78: ");
+ long result = PInvokeTests.swiftFunc78(8691571239579681212, -6331, unchecked((nuint)747809074035744802), unchecked((nint)4660686733629536050), -25591, 6155, 378094, 52, 7080577359538810005, 26362, 1774417260, 144, 5160013);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(4812301631028745377, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc79()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc79: ");
+ long result = PInvokeTests.swiftFunc79(3768859, 701589732, 49, unchecked((nint)2400132102872573811), 7919338068121439001, 12, 1161810112, 1492596679, 3256298, 150297458, 44, 3359191536348582004, 2501, -3042, 31848, unchecked((nuint)8625178339509965677), 1789284789053154, 6259002624415501110, -23813);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(693619259694162127, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc80()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc80: ");
+ long result = PInvokeTests.swiftFunc80(2729190792419187, 1585764063, 5117419591579829234, 614117500, 1693556822);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-4631030647197364647, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc81()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc81: ");
+ long result = PInvokeTests.swiftFunc81(unchecked((nint)8095725324232772887), -11, 1220850298, 2854360776836504, 8343542849265358484, 1016078821622888399, 1083388, 791962662);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-8908581242517107527, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc82()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc82: ");
+ long result = PInvokeTests.swiftFunc82(unchecked((nuint)1174997556571304622), 2990610909261926, 18753, 6253511180087050924, 3058091764587841331, 2842978159455375886);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-1543576629977717704, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc83()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc83: ");
+ long result = PInvokeTests.swiftFunc83(168003999, 689879558669204554, 3381664931253746938, 82, 2210365248447152, 14007, 50724, 211726992, 4908, 9089, -1517, 793801401, 3942422035006427459, 5203020310498374994, 2464433756321920, 8067802492059811569, 649047218);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-4161389211393419243, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc84()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc84: ");
+ long result = PInvokeTests.swiftFunc84(5500564689809982598, 8160193010477217516, unchecked((nint)2621562636476726595), 1925518901041551, 833959);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(8984640578940854556, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc85()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc85: ");
+ long result = PInvokeTests.swiftFunc85(1828548277567665, 79, unchecked((nuint)2816133458526686380), 246, unchecked((nuint)8123936957398843594), 1915634045, 4277399425149259, 4236491, 526249560, -1564, 2077376027144570, 96496756, 3426459, unchecked((nuint)4946835975333850900), -16125, 5180091340514231581, 6830, 8017, 16950, 83);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-5603269280984392717, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc86()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc86: ");
+ long result = PInvokeTests.swiftFunc86(unchecked((nuint)2690514211977331186), 48174, 5251669033533125188, -41, -118, -26036, 46895, 1006135665982533, -25915, 43319, 4016647159010115823, 161);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-756030944410084256, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc87()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc87: ");
+ long result = PInvokeTests.swiftFunc87(41821, 2106599750261545766, 493830841784699955, unchecked((nint)7791163656720105501), 25, -15830, 286454392, 8274918093536357376, -18788, 6681672249680875943, 49954076158807243, 78, 3875942, -110, 2697976, 2443700317924383, 4382626);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(3151224756940080953, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc88()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc88: ");
+ long result = PInvokeTests.swiftFunc88(12483, 401268929, -24340, 3584682894830208318, 4149, -28723, -18310, 2621165654927965, unchecked((nuint)4216156540440558538), 2006613843, 6015933, unchecked((nuint)4129107791356788363), 34682, 185, 4770291906992587002, -97, 91, 196);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(3274371447309987255, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc89()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc89: ");
+ long result = PInvokeTests.swiftFunc89(154, unchecked((nint)5210339515636897856), unchecked((nint)3761599239105734389), 18, unchecked((nint)72966313290508081), 4265746, unchecked((nuint)8929551288352689384), -24066, 35491, 2551, unchecked((nint)45491645438357652), 715787386644356803, 4473157306905713, 6702547903250883900, 137061596142255, 4385401769623650480, 3378729933484470887, 1873740829, 8574214966744389441, unchecked((nuint)6446163511298821165), unchecked((nuint)6980694483795543674), 1241824808, 23615, 122);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-737269134554333880, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc90()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc90: ");
+ long result = PInvokeTests.swiftFunc90(79, 14, 1297542167439891848, 7930448, 975812823, 259332537, 21563, 28989);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(3441802633846719073, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc91()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc91: ");
+ long result = PInvokeTests.swiftFunc91(6278);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(711186144202003795, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc92()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc92: ");
+ long result = PInvokeTests.swiftFunc92(18225, 35, 24134, 4453695771230697, 3872995088603792387, unchecked((nint)6499933966838367751), 1330188682, 444420882, unchecked((nint)3796465283221572512), 52249, 7652735, 46441, 1927427838, 1860451970, unchecked((nint)4367540142032169587), 4492446);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(9206890599465525240, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc93()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc93: ");
+ long result = PInvokeTests.swiftFunc93(5748645559017654978, 5012895573340412455, 6009269000723558276, 2036630461492010444, 2436544965066504769, -125, 112, 52799, -8246, 1830045846, 1191186, 16965, 394617474747610321, 2155653386650409489, 4259466864793291, -118, -32470, -47);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(7367909694938381646, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc94()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc94: ");
+ long result = PInvokeTests.swiftFunc94(unchecked((nuint)8677945289555827317), 6313732, 1990822772, unchecked((nuint)7652693732374651003), unchecked((nint)514619182324762120), 48, unchecked((nuint)4099443960025139442), 1897073213, 27911, 227, unchecked((nuint)3629774823693910128), unchecked((nuint)7475134394365608458), 1341041583, 8490306759261258130);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(7957085466204676840, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc95()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc95: ");
+ long result = PInvokeTests.swiftFunc95(767020, -67, 1994628757624347102, 1066179, 675787169564137362, unchecked((nint)9035231335376355925), 647886678, -12302, unchecked((nuint)6982264019182060207), 55835, 7279581463482143007, unchecked((nuint)541979943210980226), 38516, unchecked((nuint)2405396521289532217), 577291409326865, 5810393543186852048, 5570902738989457385, 5, 6674072748987199349, 6807910446229279331, 70704, 749368364527200140);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-8941275780625427292, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc96()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc96: ");
+ long result = PInvokeTests.swiftFunc96(492870375181451098, 17857, 2042744158, 2550762577962530718, 2130047, unchecked((nint)7683558322808060031), -76, 85, -42, 8057727507941436393, 182, 44022, 8416140399167561318, 1582924161, 8051228828487128057, 968670026, 1);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(2083246537822351760, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc97()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc97: ");
+ long result = PInvokeTests.swiftFunc97(16235, 12, 29, -112, 8233611281498306459, 19, 23310, 115438575, unchecked((nuint)4258580046730992269));
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(8647824177212049859, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc98()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc98: ");
+ long result = PInvokeTests.swiftFunc98(4045, 86, 101013943533129, unchecked((nint)7999096616438753438), unchecked((nuint)7026548990347163237), 165, 1089253429, 164, unchecked((nuint)8255391170515879868), 13496, 5513927, 46, 3217265538715926, 717333105, 50429, -9149);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(7040925530630314472, result);
+ Console.WriteLine("OK");
+ }
+
+ [Fact]
+ public static void TestSwiftFunc99()
+ {
+ BindingsGenerator.GenerateBindings("PInvoke/PInvokeTests.abi.json", "PInvoke/");
+ var sourceCode = """
+ // Copyright (c) Microsoft Corporation.
+ // Licensed under the MIT License.
+
+ using System;
+ using PInvokeTestsBindings;
+
+ namespace Test {
+ public class MainClass {
+ public static int Main(string[] args)
+ {
+ return 0;
+ }
+ public static long getResult()
+ {
+ Console.Write("Running SwiftFunc99: ");
+ long result = PInvokeTests.swiftFunc99(155, unchecked((nuint)1880700265511668237), 1595962890494032981);
+ return result;
+ }
+ }
+ }
+ """;
+
+ long result = (long)TestsHelper.CompileAndExecute(
+ new string [] { "PInvoke/*.cs" },
+ new string [] { sourceCode },
+ new string [] { },
+ "Test.MainClass", "getResult", new object[] { });
+ Assert.Equal(-7883825139759684683, result);
+ Console.WriteLine("OK");
+ }
+ }
+}
diff --git a/src/Swift.Bindings/tests/PInvoke/PInvokeTests.swift b/src/Swift.Bindings/tests/PInvoke/PInvokeTests.swift
new file mode 100644
index 000000000000..86a0fb96a441
--- /dev/null
+++ b/src/Swift.Bindings/tests/PInvoke/PInvokeTests.swift
@@ -0,0 +1,1708 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+import Foundation
+
+public func helloWorld() {
+ print("Hello, World!")
+}
+
+public func swiftFuncBool(dummy : Bool) -> Bool {
+ return dummy
+}
+
+struct HasherFNV1a {
+
+ private var hash: UInt = 14_695_981_039_346_656_037
+ private let prime: UInt = 1_099_511_628_211
+
+ mutating func combine(_ val: T) {
+ for byte in withUnsafeBytes(of: val, Array.init) {
+ hash ^= UInt(byte)
+ hash = hash &* prime
+ }
+ }
+
+ func finalize() -> Int {
+ Int(truncatingIfNeeded: hash)
+ }
+}
+
+public func swiftFunc0(a0: Float, a1: Int16, a2: Double, a3: Int32, a4: Double, a5: UInt64, a6: UInt8, a7: UInt16, a8: Int16, a9: Int64) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ return hasher.finalize()
+}
+
+public func swiftFunc1(a0: Double, a1: Int64, a2: UInt32, a3: UInt32, a4: UInt16, a5: Int, a6: Int, a7: UInt, a8: UInt64, a9: UInt16, a10: UInt8, a11: UInt, a12: UInt16, a13: Int8, a14: Float, a15: Int16, a16: Int32, a17: Float, a18: UInt64, a19: Int64, a20: UInt8) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ hasher.combine(a14);
+ hasher.combine(a15);
+ hasher.combine(a16);
+ hasher.combine(a17);
+ hasher.combine(a18);
+ hasher.combine(a19);
+ hasher.combine(a20);
+ return hasher.finalize()
+}
+
+public func swiftFunc2(a0: UInt8, a1: Int8, a2: Int8, a3: Int32, a4: UInt32, a5: UInt16, a6: Float, a7: UInt8, a8: UInt, a9: Double, a10: UInt8, a11: UInt8, a12: Int8, a13: UInt64, a14: UInt32, a15: Int16, a16: UInt64, a17: Float, a18: Int64, a19: Float, a20: Int16, a21: UInt64, a22: Int32) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ hasher.combine(a14);
+ hasher.combine(a15);
+ hasher.combine(a16);
+ hasher.combine(a17);
+ hasher.combine(a18);
+ hasher.combine(a19);
+ hasher.combine(a20);
+ hasher.combine(a21);
+ hasher.combine(a22);
+ return hasher.finalize()
+}
+
+public func swiftFunc3(a0: Int16, a1: UInt, a2: Int, a3: UInt8, a4: UInt) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ return hasher.finalize()
+}
+
+public func swiftFunc4(a0: UInt8, a1: Double, a2: Int32, a3: Int, a4: Double, a5: UInt8, a6: Int64, a7: Int8, a8: Int32, a9: Int64, a10: Int16, a11: Int8, a12: Int64, a13: UInt16, a14: UInt16, a15: UInt, a16: Int, a17: UInt) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ hasher.combine(a14);
+ hasher.combine(a15);
+ hasher.combine(a16);
+ hasher.combine(a17);
+ return hasher.finalize()
+}
+
+public func swiftFunc5(a0: Int, a1: UInt, a2: Float, a3: Int, a4: UInt16, a5: UInt16, a6: UInt32, a7: Float, a8: Int, a9: Int, a10: UInt8, a11: UInt8, a12: Int16, a13: Int64) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ return hasher.finalize()
+}
+
+public func swiftFunc6(a0: Int32, a1: UInt16, a2: UInt, a3: UInt, a4: Float, a5: Int8, a6: Float, a7: UInt8, a8: Int64, a9: Double) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ return hasher.finalize()
+}
+
+public func swiftFunc7(a0: Int, a1: Int32, a2: UInt32, a3: UInt16, a4: Int8, a5: Int, a6: Double, a7: Double, a8: Int, a9: UInt16, a10: UInt32, a11: Float, a12: UInt32, a13: Int32, a14: Int8) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ hasher.combine(a14);
+ return hasher.finalize()
+}
+
+public func swiftFunc8(a0: Int64, a1: Int8, a2: Float, a3: Float, a4: Double, a5: UInt64, a6: Int, a7: Int16, a8: Int, a9: Double, a10: Float, a11: Int8, a12: Int32, a13: Int8, a14: UInt8) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ hasher.combine(a14);
+ return hasher.finalize()
+}
+
+public func swiftFunc9(a0: Int, a1: Int, a2: UInt16, a3: Int32, a4: UInt, a5: Int64, a6: Float, a7: Int64, a8: UInt16, a9: Int32) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ return hasher.finalize()
+}
+
+public func swiftFunc10(a0: UInt64, a1: UInt32, a2: UInt32, a3: Int64, a4: UInt64, a5: UInt16, a6: UInt8, a7: Int32, a8: Int32) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ return hasher.finalize()
+}
+
+public func swiftFunc11(a0: UInt, a1: UInt16, a2: Int8, a3: Int16, a4: Int64, a5: UInt8, a6: Int8, a7: Int8, a8: UInt32, a9: UInt8, a10: UInt64, a11: Int, a12: Int16, a13: UInt64, a14: UInt32) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ hasher.combine(a14);
+ return hasher.finalize()
+}
+
+public func swiftFunc12(a0: Float, a1: Int64, a2: Int, a3: Int16, a4: Int32, a5: Int16, a6: UInt16, a7: Int64, a8: Int16, a9: UInt16, a10: Int16, a11: UInt8, a12: UInt, a13: UInt16, a14: UInt64, a15: Float, a16: Int8, a17: UInt64, a18: Double) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ hasher.combine(a14);
+ hasher.combine(a15);
+ hasher.combine(a16);
+ hasher.combine(a17);
+ hasher.combine(a18);
+ return hasher.finalize()
+}
+
+public func swiftFunc13(a0: Int32, a1: Int, a2: UInt32, a3: Float, a4: UInt32, a5: Int16, a6: Float, a7: UInt64, a8: UInt8, a9: UInt32) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ return hasher.finalize()
+}
+
+public func swiftFunc14(a0: Double, a1: UInt32, a2: Double, a3: UInt64, a4: UInt, a5: Int32, a6: Int, a7: Int8, a8: UInt64) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ return hasher.finalize()
+}
+
+public func swiftFunc15(a0: UInt64, a1: Int) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ return hasher.finalize()
+}
+
+public func swiftFunc16(a0: Int16, a1: UInt16, a2: Int, a3: UInt, a4: UInt32, a5: Double, a6: UInt64, a7: UInt8, a8: UInt64, a9: Int16, a10: Int64, a11: UInt64, a12: UInt32, a13: UInt, a14: UInt16, a15: UInt, a16: Int64, a17: UInt64, a18: Float, a19: UInt8, a20: Int8) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ hasher.combine(a14);
+ hasher.combine(a15);
+ hasher.combine(a16);
+ hasher.combine(a17);
+ hasher.combine(a18);
+ hasher.combine(a19);
+ hasher.combine(a20);
+ return hasher.finalize()
+}
+
+public func swiftFunc17(a0: UInt64, a1: UInt, a2: UInt64, a3: UInt32, a4: Int64, a5: Int8, a6: UInt8, a7: Int8) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ return hasher.finalize()
+}
+
+public func swiftFunc18(a0: UInt8, a1: Int, a2: Float, a3: UInt8, a4: Int, a5: Int8, a6: UInt32, a7: Int, a8: UInt8) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ return hasher.finalize()
+}
+
+public func swiftFunc19(a0: Float, a1: UInt, a2: Int64, a3: UInt8, a4: Double, a5: Int32, a6: Int8, a7: Int32, a8: Int, a9: Int32, a10: Int16, a11: Double, a12: Int64, a13: UInt16, a14: Double, a15: Float, a16: Double, a17: Int16, a18: Int, a19: Int64, a20: UInt16, a21: Double) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ hasher.combine(a14);
+ hasher.combine(a15);
+ hasher.combine(a16);
+ hasher.combine(a17);
+ hasher.combine(a18);
+ hasher.combine(a19);
+ hasher.combine(a20);
+ hasher.combine(a21);
+ return hasher.finalize()
+}
+
+public func swiftFunc20(a0: Double, a1: Float, a2: UInt64, a3: Float, a4: UInt16, a5: UInt16, a6: Double, a7: UInt32, a8: UInt32, a9: Int16, a10: UInt16, a11: Int32, a12: Int8, a13: Int32, a14: UInt8) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ hasher.combine(a14);
+ return hasher.finalize()
+}
+
+public func swiftFunc21(a0: Int16, a1: Int16, a2: UInt64, a3: Int64, a4: Float, a5: Int, a6: UInt16, a7: UInt8, a8: Int8, a9: UInt16, a10: Int8, a11: Int16, a12: Int32, a13: Int, a14: UInt, a15: Int16, a16: Float, a17: UInt8, a18: Int64, a19: UInt32) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ hasher.combine(a14);
+ hasher.combine(a15);
+ hasher.combine(a16);
+ hasher.combine(a17);
+ hasher.combine(a18);
+ hasher.combine(a19);
+ return hasher.finalize()
+}
+
+public func swiftFunc22(a0: Int64, a1: UInt16, a2: UInt64, a3: UInt, a4: UInt16, a5: UInt16) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ return hasher.finalize()
+}
+
+public func swiftFunc23(a0: UInt64, a1: Int8, a2: UInt64, a3: Int64, a4: Int32, a5: UInt8, a6: UInt64, a7: Int8, a8: UInt64, a9: Int64, a10: UInt32, a11: Float, a12: Int16, a13: Int8, a14: UInt16, a15: Double) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ hasher.combine(a14);
+ hasher.combine(a15);
+ return hasher.finalize()
+}
+
+public func swiftFunc24(a0: UInt16, a1: Int16, a2: UInt32, a3: Int8, a4: Int32, a5: Int64, a6: UInt16, a7: Float, a8: Float, a9: UInt16, a10: UInt64) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ return hasher.finalize()
+}
+
+public func swiftFunc25(a0: Int, a1: Int16, a2: Int8, a3: Int64, a4: Double, a5: UInt32, a6: Double, a7: UInt64, a8: UInt32, a9: Float, a10: Float, a11: Int8, a12: Float, a13: Int64, a14: Int64, a15: UInt64) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ hasher.combine(a14);
+ hasher.combine(a15);
+ return hasher.finalize()
+}
+
+public func swiftFunc26(a0: Int64, a1: Double, a2: Float, a3: UInt16, a4: Int32, a5: UInt8, a6: Int32, a7: Float, a8: Int64, a9: Int64, a10: UInt64, a11: UInt, a12: UInt16, a13: UInt8) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ return hasher.finalize()
+}
+
+public func swiftFunc27(a0: Double, a1: UInt8, a2: UInt32, a3: UInt, a4: UInt8, a5: Int64, a6: Int16, a7: UInt8, a8: UInt32, a9: UInt, a10: UInt32, a11: UInt64, a12: Int32, a13: Int64, a14: Int32, a15: Float, a16: Int, a17: UInt64, a18: Int16, a19: Int64, a20: UInt16, a21: Double) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ hasher.combine(a14);
+ hasher.combine(a15);
+ hasher.combine(a16);
+ hasher.combine(a17);
+ hasher.combine(a18);
+ hasher.combine(a19);
+ hasher.combine(a20);
+ hasher.combine(a21);
+ return hasher.finalize()
+}
+
+public func swiftFunc28(a0: UInt32) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ return hasher.finalize()
+}
+
+public func swiftFunc29(a0: Float, a1: UInt8, a2: UInt8, a3: Int16, a4: Int8, a5: UInt16, a6: UInt, a7: Int16, a8: Double, a9: Int8, a10: Int16, a11: UInt64, a12: Int16, a13: Int16, a14: UInt, a15: UInt, a16: Int64, a17: UInt, a18: Int64, a19: UInt16) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ hasher.combine(a14);
+ hasher.combine(a15);
+ hasher.combine(a16);
+ hasher.combine(a17);
+ hasher.combine(a18);
+ hasher.combine(a19);
+ return hasher.finalize()
+}
+
+public func swiftFunc30(a0: Double, a1: Int64, a2: Int, a3: UInt8, a4: UInt32, a5: Int32, a6: Int16, a7: UInt, a8: Int16, a9: Int, a10: UInt8, a11: Int, a12: Int16, a13: UInt32, a14: Float, a15: UInt32, a16: Int8, a17: Int64) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ hasher.combine(a14);
+ hasher.combine(a15);
+ hasher.combine(a16);
+ hasher.combine(a17);
+ return hasher.finalize()
+}
+
+public func swiftFunc31(a0: UInt8, a1: Int64, a2: Int32, a3: Int8, a4: Int, a5: UInt, a6: UInt32, a7: UInt8, a8: Int8, a9: Int16, a10: Int8, a11: UInt64, a12: UInt8) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ return hasher.finalize()
+}
+
+public func swiftFunc32(a0: UInt, a1: Float) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ return hasher.finalize()
+}
+
+public func swiftFunc33(a0: Int64, a1: UInt32, a2: Int64) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ return hasher.finalize()
+}
+
+public func swiftFunc34(a0: Float, a1: Int8, a2: UInt32, a3: Int8, a4: UInt64, a5: UInt32, a6: Double, a7: UInt8) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ return hasher.finalize()
+}
+
+public func swiftFunc35(a0: Int32, a1: Int8, a2: UInt32, a3: Double, a4: Int, a5: Int16, a6: UInt8) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ return hasher.finalize()
+}
+
+public func swiftFunc36(a0: Int, a1: Int64, a2: Int, a3: UInt64, a4: UInt, a5: UInt64) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ return hasher.finalize()
+}
+
+public func swiftFunc37(a0: Int8, a1: Int, a2: Double) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ return hasher.finalize()
+}
+
+public func swiftFunc38(a0: UInt64, a1: UInt64, a2: Int8, a3: UInt8, a4: Double, a5: Int8) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ return hasher.finalize()
+}
+
+public func swiftFunc39(a0: Int8, a1: UInt32, a2: Int, a3: Int16, a4: Int32, a5: UInt32, a6: Int, a7: Float, a8: Float, a9: Double, a10: UInt, a11: UInt16, a12: Int, a13: UInt64, a14: Int16, a15: Float, a16: Int64, a17: Int16) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ hasher.combine(a14);
+ hasher.combine(a15);
+ hasher.combine(a16);
+ hasher.combine(a17);
+ return hasher.finalize()
+}
+
+public func swiftFunc40(a0: UInt8, a1: UInt32, a2: Int64, a3: UInt16, a4: Double, a5: UInt32, a6: UInt64, a7: UInt32, a8: UInt32, a9: Int64, a10: UInt, a11: UInt32) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ return hasher.finalize()
+}
+
+public func swiftFunc41(a0: UInt64, a1: Int16, a2: Int, a3: Float, a4: Int8, a5: UInt32, a6: Int, a7: Int16, a8: UInt64, a9: Int8, a10: Float, a11: UInt, a12: UInt, a13: Int32, a14: Double, a15: Int64, a16: UInt8, a17: Float, a18: UInt64) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ hasher.combine(a14);
+ hasher.combine(a15);
+ hasher.combine(a16);
+ hasher.combine(a17);
+ hasher.combine(a18);
+ return hasher.finalize()
+}
+
+public func swiftFunc42(a0: Int64, a1: UInt16, a2: Int, a3: UInt64, a4: Int) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ return hasher.finalize()
+}
+
+public func swiftFunc43(a0: UInt8) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ return hasher.finalize()
+}
+
+public func swiftFunc44(a0: Double, a1: Int16, a2: Int64, a3: UInt32, a4: Int16, a5: Int16, a6: UInt64, a7: UInt32, a8: UInt32, a9: Int64, a10: UInt16, a11: UInt32, a12: Int16, a13: Int8, a14: UInt64) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ hasher.combine(a14);
+ return hasher.finalize()
+}
+
+public func swiftFunc45(a0: UInt8, a1: UInt8, a2: UInt64, a3: Int16, a4: Float, a5: Int16, a6: Int8, a7: UInt8, a8: Int32, a9: Int64, a10: Int16, a11: UInt, a12: Int16) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ return hasher.finalize()
+}
+
+public func swiftFunc46(a0: UInt64, a1: Int8, a2: Int8, a3: Int32, a4: Int16, a5: Int64, a6: UInt64) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ return hasher.finalize()
+}
+
+public func swiftFunc47(a0: UInt64, a1: UInt64, a2: UInt16, a3: Int8) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ return hasher.finalize()
+}
+
+public func swiftFunc48(a0: UInt, a1: Int16, a2: Int, a3: Float, a4: Int8, a5: UInt64, a6: Int64, a7: Int8, a8: UInt8, a9: Int8, a10: Int8, a11: UInt64, a12: UInt32, a13: Int, a14: Float, a15: Int32, a16: UInt64) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ hasher.combine(a14);
+ hasher.combine(a15);
+ hasher.combine(a16);
+ return hasher.finalize()
+}
+
+public func swiftFunc49(a0: UInt16) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ return hasher.finalize()
+}
+
+public func swiftFunc50(a0: Int64, a1: UInt16, a2: Int64, a3: UInt8, a4: Float, a5: Double, a6: Int16, a7: UInt32, a8: Int32, a9: UInt32) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ return hasher.finalize()
+}
+
+public func swiftFunc51(a0: UInt32) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ return hasher.finalize()
+}
+
+public func swiftFunc52(a0: UInt16, a1: UInt, a2: Int16, a3: Int32, a4: UInt16, a5: Int, a6: Int16, a7: UInt64, a8: Int, a9: Int16, a10: Int, a11: Double, a12: UInt16, a13: UInt8, a14: Int64) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ hasher.combine(a14);
+ return hasher.finalize()
+}
+
+public func swiftFunc53(a0: UInt64, a1: Int, a2: UInt64, a3: Double, a4: UInt64, a5: Int8, a6: Int64, a7: Float, a8: UInt8, a9: Int, a10: Int16, a11: UInt8, a12: UInt64, a13: Float, a14: UInt64, a15: Int8, a16: Int64, a17: UInt, a18: Int, a19: Float, a20: UInt8, a21: Int, a22: Int8) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ hasher.combine(a14);
+ hasher.combine(a15);
+ hasher.combine(a16);
+ hasher.combine(a17);
+ hasher.combine(a18);
+ hasher.combine(a19);
+ hasher.combine(a20);
+ hasher.combine(a21);
+ hasher.combine(a22);
+ return hasher.finalize()
+}
+
+public func swiftFunc54(a0: Int16, a1: UInt16, a2: Int64, a3: Int16, a4: Int64, a5: UInt8, a6: Int8, a7: Int32, a8: Float, a9: UInt64, a10: UInt16, a11: UInt32, a12: Int8, a13: UInt64, a14: UInt64, a15: Int32, a16: UInt32, a17: Int64, a18: UInt64, a19: UInt8, a20: UInt64, a21: UInt64, a22: Int, a23: Int8) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ hasher.combine(a14);
+ hasher.combine(a15);
+ hasher.combine(a16);
+ hasher.combine(a17);
+ hasher.combine(a18);
+ hasher.combine(a19);
+ hasher.combine(a20);
+ hasher.combine(a21);
+ hasher.combine(a22);
+ hasher.combine(a23);
+ return hasher.finalize()
+}
+
+public func swiftFunc55(a0: UInt64, a1: Int64, a2: UInt8, a3: UInt8, a4: UInt16, a5: Int64, a6: UInt64, a7: UInt64, a8: UInt64, a9: UInt16, a10: Int8) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ return hasher.finalize()
+}
+
+public func swiftFunc56(a0: UInt, a1: Int32, a2: Double, a3: UInt64, a4: Float, a5: UInt32, a6: Int, a7: Int16, a8: UInt, a9: Double, a10: UInt32, a11: Int32, a12: UInt16, a13: Int8, a14: Int, a15: Int8, a16: UInt32, a17: Int8, a18: UInt8) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ hasher.combine(a14);
+ hasher.combine(a15);
+ hasher.combine(a16);
+ hasher.combine(a17);
+ hasher.combine(a18);
+ return hasher.finalize()
+}
+
+public func swiftFunc57(a0: Int16, a1: Float, a2: UInt16, a3: Int, a4: UInt32, a5: Float, a6: Int8, a7: Int32, a8: UInt64, a9: Double, a10: Int64, a11: UInt, a12: UInt8, a13: UInt16) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ return hasher.finalize()
+}
+
+public func swiftFunc58(a0: Int, a1: Float, a2: UInt32, a3: Double, a4: UInt, a5: Int, a6: Float, a7: Int16, a8: Float, a9: UInt64, a10: Int8, a11: Float, a12: Int32) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ return hasher.finalize()
+}
+
+public func swiftFunc59(a0: UInt16, a1: UInt, a2: UInt16, a3: UInt, a4: UInt32, a5: UInt8, a6: Int16, a7: UInt64, a8: Float) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ return hasher.finalize()
+}
+
+public func swiftFunc60(a0: Double, a1: Int64, a2: UInt16) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ return hasher.finalize()
+}
+
+public func swiftFunc61(a0: Int8, a1: UInt8, a2: UInt8, a3: UInt64, a4: Int, a5: UInt32, a6: Int, a7: Int16, a8: Double, a9: Int8, a10: Int32, a11: UInt8) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ return hasher.finalize()
+}
+
+public func swiftFunc62(a0: UInt8, a1: UInt32, a2: Int16, a3: UInt8, a4: Int, a5: Float, a6: Double, a7: Int8, a8: UInt64, a9: UInt64) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ return hasher.finalize()
+}
+
+public func swiftFunc63(a0: Float) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ return hasher.finalize()
+}
+
+public func swiftFunc64(a0: Int16, a1: Int8, a2: Double) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ return hasher.finalize()
+}
+
+public func swiftFunc65(a0: Double, a1: UInt32, a2: Int32, a3: Int32, a4: UInt, a5: Int32, a6: Int8, a7: Int32, a8: UInt64, a9: UInt32, a10: Int32, a11: Int16, a12: Int8, a13: Int32, a14: UInt32) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ hasher.combine(a14);
+ return hasher.finalize()
+}
+
+public func swiftFunc66(a0: UInt, a1: UInt32, a2: UInt, a3: UInt16) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ return hasher.finalize()
+}
+
+public func swiftFunc67(a0: Double, a1: UInt16, a2: UInt32, a3: Int16, a4: Int32, a5: UInt32, a6: UInt8, a7: Double, a8: Double, a9: Int32, a10: UInt64, a11: Int32, a12: Int32, a13: Int16, a14: UInt32) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ hasher.combine(a14);
+ return hasher.finalize()
+}
+
+public func swiftFunc68(a0: Double, a1: Int32, a2: Int32, a3: Int, a4: UInt) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ return hasher.finalize()
+}
+
+public func swiftFunc69(a0: UInt, a1: UInt16, a2: Float, a3: UInt16, a4: Int64) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ return hasher.finalize()
+}
+
+public func swiftFunc70(a0: UInt32, a1: Double, a2: UInt8, a3: UInt, a4: Int16, a5: Int, a6: Double, a7: Int) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ return hasher.finalize()
+}
+
+public func swiftFunc71(a0: UInt, a1: UInt64, a2: UInt32, a3: UInt32, a4: Int64, a5: Float, a6: Int16, a7: UInt8, a8: Double, a9: Float, a10: Int, a11: Int, a12: Double, a13: Int8, a14: Int16, a15: UInt32, a16: UInt8) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ hasher.combine(a14);
+ hasher.combine(a15);
+ hasher.combine(a16);
+ return hasher.finalize()
+}
+
+public func swiftFunc72(a0: UInt64, a1: UInt8, a2: Int, a3: Int64, a4: UInt64, a5: Int16, a6: Int8, a7: Int8, a8: Double, a9: Float, a10: UInt16) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ return hasher.finalize()
+}
+
+public func swiftFunc73(a0: Int16, a1: Int32) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ return hasher.finalize()
+}
+
+public func swiftFunc74(a0: Int64, a1: Float, a2: UInt16, a3: UInt32, a4: Int32, a5: UInt32, a6: Int32, a7: UInt64, a8: UInt, a9: Double, a10: UInt64, a11: Int32, a12: Int16, a13: UInt32, a14: UInt64, a15: Int16) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ hasher.combine(a14);
+ hasher.combine(a15);
+ return hasher.finalize()
+}
+
+public func swiftFunc75(a0: UInt32, a1: UInt16, a2: Int8, a3: UInt8, a4: UInt16, a5: UInt32, a6: Double, a7: Int32, a8: Int64, a9: Int8, a10: Float) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ return hasher.finalize()
+}
+
+public func swiftFunc76(a0: Double, a1: Float, a2: UInt8, a3: UInt32, a4: Int32, a5: Int64, a6: Int16, a7: UInt16, a8: Int, a9: Int8, a10: UInt32, a11: Int64) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ return hasher.finalize()
+}
+
+public func swiftFunc77(a0: Double, a1: Int64, a2: Double, a3: Float, a4: Double, a5: Int64, a6: Int8, a7: UInt8, a8: Int8, a9: Int16, a10: UInt32, a11: UInt, a12: Int, a13: Float, a14: Int8, a15: UInt16, a16: Int16, a17: Double) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ hasher.combine(a14);
+ hasher.combine(a15);
+ hasher.combine(a16);
+ hasher.combine(a17);
+ return hasher.finalize()
+}
+
+public func swiftFunc78(a0: Int64, a1: Int16, a2: UInt, a3: Int, a4: Int16, a5: UInt16, a6: Float, a7: Int8, a8: Int64, a9: UInt16, a10: Int32, a11: UInt8, a12: Float) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ return hasher.finalize()
+}
+
+public func swiftFunc79(a0: Float, a1: UInt32, a2: Int8, a3: Int, a4: Int64, a5: UInt8, a6: UInt32, a7: UInt32, a8: Float, a9: UInt32, a10: UInt8, a11: UInt64, a12: UInt16, a13: Int16, a14: UInt16, a15: UInt, a16: Double, a17: UInt64, a18: Int16) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ hasher.combine(a14);
+ hasher.combine(a15);
+ hasher.combine(a16);
+ hasher.combine(a17);
+ hasher.combine(a18);
+ return hasher.finalize()
+}
+
+public func swiftFunc80(a0: Double, a1: Int32, a2: UInt64, a3: Int32, a4: UInt32) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ return hasher.finalize()
+}
+
+public func swiftFunc81(a0: Int, a1: Int8, a2: UInt32, a3: Double, a4: UInt64, a5: UInt64, a6: Float, a7: Int32) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ return hasher.finalize()
+}
+
+public func swiftFunc82(a0: UInt, a1: Double, a2: UInt16, a3: UInt64, a4: Int64, a5: UInt64) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ return hasher.finalize()
+}
+
+public func swiftFunc83(a0: Int32, a1: Int64, a2: Int64, a3: UInt8, a4: Double, a5: UInt16, a6: UInt16, a7: Int32, a8: UInt16, a9: UInt16, a10: Int16, a11: UInt32, a12: UInt64, a13: Int64, a14: Double, a15: UInt64, a16: Int32) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ hasher.combine(a14);
+ hasher.combine(a15);
+ hasher.combine(a16);
+ return hasher.finalize()
+}
+
+public func swiftFunc84(a0: Int64, a1: Int64, a2: Int, a3: Double, a4: Float) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ return hasher.finalize()
+}
+
+public func swiftFunc85(a0: Double, a1: Int8, a2: UInt, a3: UInt8, a4: UInt, a5: Int32, a6: Double, a7: Float, a8: Int32, a9: Int16, a10: Double, a11: Int32, a12: Float, a13: UInt, a14: Int16, a15: Int64, a16: UInt16, a17: Int16, a18: Int16, a19: Int8) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ hasher.combine(a14);
+ hasher.combine(a15);
+ hasher.combine(a16);
+ hasher.combine(a17);
+ hasher.combine(a18);
+ hasher.combine(a19);
+ return hasher.finalize()
+}
+
+public func swiftFunc86(a0: UInt, a1: UInt16, a2: UInt64, a3: Int8, a4: Int8, a5: Int16, a6: UInt16, a7: Double, a8: Int16, a9: UInt16, a10: Int64, a11: UInt8) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ return hasher.finalize()
+}
+
+public func swiftFunc87(a0: UInt16, a1: UInt64, a2: Int64, a3: Int, a4: Int8, a5: Int16, a6: UInt32, a7: Int64, a8: Int16, a9: Int64, a10: Int64, a11: UInt8, a12: Float, a13: Int8, a14: Float, a15: Double, a16: Float) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ hasher.combine(a14);
+ hasher.combine(a15);
+ hasher.combine(a16);
+ return hasher.finalize()
+}
+
+public func swiftFunc88(a0: UInt16, a1: UInt32, a2: Int16, a3: UInt64, a4: UInt16, a5: Int16, a6: Int16, a7: Double, a8: UInt, a9: Int32, a10: Float, a11: UInt, a12: UInt16, a13: UInt8, a14: UInt64, a15: Int8, a16: UInt8, a17: UInt8) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ hasher.combine(a14);
+ hasher.combine(a15);
+ hasher.combine(a16);
+ hasher.combine(a17);
+ return hasher.finalize()
+}
+
+public func swiftFunc89(a0: UInt8, a1: Int, a2: Int, a3: UInt8, a4: Int, a5: Float, a6: UInt, a7: Int16, a8: UInt16, a9: Int16, a10: Int, a11: UInt64, a12: Double, a13: Int64, a14: Double, a15: UInt64, a16: UInt64, a17: Int32, a18: UInt64, a19: UInt, a20: UInt, a21: UInt32, a22: Int16, a23: Int8) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ hasher.combine(a14);
+ hasher.combine(a15);
+ hasher.combine(a16);
+ hasher.combine(a17);
+ hasher.combine(a18);
+ hasher.combine(a19);
+ hasher.combine(a20);
+ hasher.combine(a21);
+ hasher.combine(a22);
+ hasher.combine(a23);
+ return hasher.finalize()
+}
+
+public func swiftFunc90(a0: UInt8, a1: Int8, a2: UInt64, a3: Float, a4: UInt32, a5: UInt32, a6: UInt16, a7: Int16) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ return hasher.finalize()
+}
+
+public func swiftFunc91(a0: Int16) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ return hasher.finalize()
+}
+
+public func swiftFunc92(a0: UInt16, a1: Int8, a2: Int16, a3: Double, a4: Int64, a5: Int, a6: UInt32, a7: UInt32, a8: Int, a9: UInt16, a10: Float, a11: UInt16, a12: UInt32, a13: UInt32, a14: Int, a15: Float) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ hasher.combine(a14);
+ hasher.combine(a15);
+ return hasher.finalize()
+}
+
+public func swiftFunc93(a0: Int64, a1: UInt64, a2: UInt64, a3: UInt64, a4: UInt64, a5: Int8, a6: UInt8, a7: UInt16, a8: Int16, a9: Int32, a10: Float, a11: UInt16, a12: Int64, a13: Int64, a14: Double, a15: Int8, a16: Int16, a17: Int8) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ hasher.combine(a14);
+ hasher.combine(a15);
+ hasher.combine(a16);
+ hasher.combine(a17);
+ return hasher.finalize()
+}
+
+public func swiftFunc94(a0: UInt, a1: Float, a2: UInt32, a3: UInt, a4: Int, a5: UInt8, a6: UInt, a7: UInt32, a8: UInt16, a9: UInt8, a10: UInt, a11: UInt, a12: UInt32, a13: UInt64) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ return hasher.finalize()
+}
+
+public func swiftFunc95(a0: Float, a1: Int8, a2: Int64, a3: Float, a4: UInt64, a5: Int, a6: UInt32, a7: Int16, a8: UInt, a9: UInt16, a10: UInt64, a11: UInt, a12: UInt16, a13: UInt, a14: Double, a15: Int64, a16: Int64, a17: UInt8, a18: Int64, a19: UInt64, a20: Float, a21: UInt64) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ hasher.combine(a14);
+ hasher.combine(a15);
+ hasher.combine(a16);
+ hasher.combine(a17);
+ hasher.combine(a18);
+ hasher.combine(a19);
+ hasher.combine(a20);
+ hasher.combine(a21);
+ return hasher.finalize()
+}
+
+public func swiftFunc96(a0: UInt64, a1: Int16, a2: UInt32, a3: Int64, a4: Float, a5: Int, a6: Int8, a7: Int8, a8: Int8, a9: UInt64, a10: UInt8, a11: UInt16, a12: UInt64, a13: UInt32, a14: Int64, a15: Int32, a16: UInt8) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ hasher.combine(a14);
+ hasher.combine(a15);
+ hasher.combine(a16);
+ return hasher.finalize()
+}
+
+public func swiftFunc97(a0: UInt16, a1: UInt8, a2: UInt8, a3: Int8, a4: Int64, a5: UInt8, a6: UInt16, a7: UInt32, a8: UInt) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ return hasher.finalize()
+}
+
+public func swiftFunc98(a0: UInt16, a1: Int8, a2: Double, a3: Int, a4: UInt, a5: UInt8, a6: UInt32, a7: UInt8, a8: UInt, a9: UInt16, a10: Float, a11: Int8, a12: Double, a13: Int32, a14: UInt16, a15: Int16) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ hasher.combine(a3);
+ hasher.combine(a4);
+ hasher.combine(a5);
+ hasher.combine(a6);
+ hasher.combine(a7);
+ hasher.combine(a8);
+ hasher.combine(a9);
+ hasher.combine(a10);
+ hasher.combine(a11);
+ hasher.combine(a12);
+ hasher.combine(a13);
+ hasher.combine(a14);
+ hasher.combine(a15);
+ return hasher.finalize()
+}
+
+public func swiftFunc99(a0: UInt8, a1: UInt, a2: UInt64) -> Int {
+ var hasher = HasherFNV1a()
+ hasher.combine(a0);
+ hasher.combine(a1);
+ hasher.combine(a2);
+ return hasher.finalize()
+}
diff --git a/src/Swift.Bindings/tests/Swift.Bindings.Tests.csproj b/src/Swift.Bindings/tests/Swift.Bindings.Tests.csproj
new file mode 100644
index 000000000000..f1af9159118c
--- /dev/null
+++ b/src/Swift.Bindings/tests/Swift.Bindings.Tests.csproj
@@ -0,0 +1,27 @@
+
+
+ net9.0
+ enable
+ disable
+ false
+ true
+ cd $(OutputPath)$(TargetFramework) && cmake $(MSBuildThisFileDirectory) && make
+
+
+
+
+
+
+
+
+
+
+ PreserveNewest
+
+
+
+
+
+
+
+
diff --git a/src/Swift.Bindings/tests/TestsHelper.cs b/src/Swift.Bindings/tests/TestsHelper.cs
new file mode 100644
index 000000000000..d2e33a7aff20
--- /dev/null
+++ b/src/Swift.Bindings/tests/TestsHelper.cs
@@ -0,0 +1,86 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+using System.Reflection;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp;
+using Microsoft.CodeAnalysis.Emit;
+
+namespace BindingsGeneration.Tests
+{
+ public static class TestsHelper
+ {
+ private static int uniqueId = 0;
+
+
+ public static object CompileAndExecute(string[] filePaths, string[] sourceCodes, string[] dependencies, string typeName, string methodName, object[] args)
+ {
+ var expandedFilePaths = ExpandFilePaths(filePaths);
+ Console.WriteLine($"Expanded file paths: {string.Join(", ", expandedFilePaths)}");
+ var fileSourceCodes = expandedFilePaths.Select(File.ReadAllText).ToArray();
+ var allSourceCodes = fileSourceCodes.Concat(sourceCodes).ToArray();
+
+ var options = new CSharpCompilationOptions(OutputKind.ConsoleApplication, allowUnsafe: true);
+ var syntaxTrees = allSourceCodes.Select(code => CSharpSyntaxTree.ParseText(code)).ToArray();
+
+ var references = new List
+ {
+ MetadataReference.CreateFromFile(typeof(object).Assembly.Location),
+ MetadataReference.CreateFromFile(typeof(Console).Assembly.Location),
+ MetadataReference.CreateFromFile(Assembly.Load("System.Runtime").Location),
+ MetadataReference.CreateFromFile(Assembly.Load("System.Runtime.InteropServices").Location),
+ };
+
+ foreach (string dependency in dependencies)
+ {
+ references.Add(MetadataReference.CreateFromFile(Assembly.Load(dependency).Location));
+ }
+
+ var compilation = CSharpCompilation.Create($"CompiledAssembly{uniqueId}",
+ syntaxTrees: syntaxTrees,
+ references: references,
+ options: options);
+
+ string assemblyPath = Path.Combine(Path.GetTempPath(), $"CompiledAssembly{uniqueId++}.dll");
+ using (var stream = new FileStream(assemblyPath, FileMode.Create))
+ {
+ EmitResult emitResult = compilation.Emit(stream);
+
+ if (!emitResult.Success)
+ {
+ string errorMessage = "Compilation failed:";
+ foreach (var diagnostic in emitResult.Diagnostics)
+ {
+ errorMessage += $"\n{diagnostic}";
+ }
+ throw new InvalidOperationException(errorMessage);
+ }
+ }
+
+ Assembly compiledAssembly = Assembly.LoadFile(assemblyPath);
+ Type targetType = compiledAssembly.GetType(typeName);
+ MethodInfo customMethod = targetType.GetMethod(methodName);
+ return customMethod.Invoke(null, args);
+ }
+
+ private static IEnumerable ExpandFilePaths(IEnumerable filePaths)
+ {
+ foreach (var path in filePaths)
+ {
+ if (path.Contains("*"))
+ {
+ var dirPath = Path.GetDirectoryName(path);
+ var searchPattern = Path.GetFileName(path);
+ foreach (var expandedPath in Directory.GetFiles(dirPath, searchPattern))
+ {
+ yield return expandedPath;
+ }
+ }
+ else
+ {
+ yield return path;
+ }
+ }
+ }
+ }
+}
diff --git a/src/Swift.Bindings/tests/UnsafeBufferPointer/UnsafeBufferPointerTests.Source.cs b/src/Swift.Bindings/tests/UnsafeBufferPointer/UnsafeBufferPointerTests.Source.cs
new file mode 100644
index 000000000000..79dbe13f6f7f
--- /dev/null
+++ b/src/Swift.Bindings/tests/UnsafeBufferPointer/UnsafeBufferPointerTests.Source.cs
@@ -0,0 +1,142 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+using System;
+using UnsafeBufferPointerTestsBindings;
+using System.Diagnostics;
+using System.Security.Cryptography;
+using Swift.Runtime;
+
+namespace Test
+{
+ public class MainClass
+ {
+ public static int Main(string[] args)
+ {
+ byte[] key = RandomNumberGenerator.GetBytes(32); // Generate a 256-bit key
+ byte[] nonce = RandomNumberGenerator.GetBytes(12); // Generate a 96-bit nonce
+ byte[] plaintext = System.Text.Encoding.UTF8.GetBytes("Hello, World!");
+ byte[] aad = System.Text.Encoding.UTF8.GetBytes("Additional Authenticated Data");
+
+ byte[] ciphertext = new byte[plaintext.Length];
+ byte[] tag = new byte[16]; // ChaCha20Poly1305 tag size
+ Console.WriteLine($"Plaintext: {BitConverter.ToString(plaintext)}");
+
+ ChaCha20Poly1305Encrypt(
+ key,
+ nonce,
+ plaintext,
+ ciphertext,
+ tag,
+ aad);
+
+ Console.WriteLine($"Ciphertext: {BitConverter.ToString(ciphertext)}");
+ Console.WriteLine($"Tag: {BitConverter.ToString(tag)}");
+
+ Array.Clear(plaintext, 0, plaintext.Length);
+
+ ChaCha20Poly1305Decrypt(
+ key,
+ nonce,
+ ciphertext,
+ tag,
+ plaintext,
+ aad
+ );
+
+ string decryptedMessage = System.Text.Encoding.UTF8.GetString(plaintext);
+ Console.WriteLine($"Decrypted: {decryptedMessage}");
+ return "Hello, World!" == decryptedMessage ? 1 : 0;
+ }
+
+ internal static unsafe void ChaCha20Poly1305Encrypt(
+ ReadOnlySpan key,
+ ReadOnlySpan nonce,
+ ReadOnlySpan plaintext,
+ Span ciphertext,
+ Span tag,
+ ReadOnlySpan aad)
+ {
+ fixed (void* keyPtr = key)
+ fixed (void* noncePtr = nonce)
+ fixed (void* plaintextPtr = plaintext)
+ fixed (byte* ciphertextPtr = ciphertext)
+ fixed (byte* tagPtr = tag)
+ fixed (void* aadPtr = aad)
+ {
+ const int Success = 1;
+
+ UnsafeRawBufferPointer keyBuffer = new UnsafeRawBufferPointer(keyPtr, key.Length);
+ UnsafeRawBufferPointer nonceBuffer = new UnsafeRawBufferPointer(noncePtr, nonce.Length);
+ UnsafeRawBufferPointer plaintextBuffer = new UnsafeRawBufferPointer(plaintextPtr, plaintext.Length);
+ UnsafeMutableBufferPointer ciphertextBuffer = new UnsafeMutableBufferPointer(ciphertextPtr, ciphertext.Length);
+ UnsafeMutableBufferPointer tagBuffer = new UnsafeMutableBufferPointer(tagPtr, tag.Length);
+ UnsafeRawBufferPointer aadBuffer = new UnsafeRawBufferPointer(aadPtr, aad.Length);
+
+ int result = UnsafeBufferPointerTests.AppleCryptoNative_ChaCha20Poly1305Encrypt(
+ keyBuffer,
+ nonceBuffer,
+ plaintextBuffer,
+ ciphertextBuffer,
+ tagBuffer,
+ aadBuffer);
+
+ if (result != Success)
+ {
+ Debug.Assert(result == 0);
+ Console.WriteLine("Encryption failed");
+ }
+ }
+ }
+
+ internal static unsafe void ChaCha20Poly1305Decrypt(
+ ReadOnlySpan key,
+ ReadOnlySpan nonce,
+ ReadOnlySpan ciphertext,
+ ReadOnlySpan tag,
+ Span plaintext,
+ ReadOnlySpan aad)
+ {
+ fixed (void* keyPtr = key)
+ fixed (void* noncePtr = nonce)
+ fixed (void* ciphertextPtr = ciphertext)
+ fixed (void* tagPtr = tag)
+ fixed (byte* plaintextPtr = plaintext)
+ fixed (void* aadPtr = aad)
+ {
+ const int Success = 1;
+ const int AuthTagMismatch = -1;
+
+ UnsafeRawBufferPointer keyBuffer = new UnsafeRawBufferPointer(keyPtr, key.Length);
+ UnsafeRawBufferPointer nonceBuffer = new UnsafeRawBufferPointer(noncePtr, nonce.Length);
+ UnsafeRawBufferPointer ciphertextBuffer = new UnsafeRawBufferPointer(ciphertextPtr, ciphertext.Length);
+ UnsafeRawBufferPointer tagBuffer = new UnsafeRawBufferPointer (tagPtr, tag.Length);
+ UnsafeMutableBufferPointer plaintextBuffer = new UnsafeMutableBufferPointer(plaintextPtr, plaintext.Length);
+ UnsafeRawBufferPointer aadBuffer = new UnsafeRawBufferPointer(aadPtr, aad.Length);
+
+ int result = UnsafeBufferPointerTests.AppleCryptoNative_ChaCha20Poly1305Decrypt(
+ keyBuffer,
+ nonceBuffer,
+ ciphertextBuffer,
+ tagBuffer,
+ plaintextBuffer,
+ aadBuffer);
+
+ if (result != Success)
+ {
+ CryptographicOperations.ZeroMemory(plaintext);
+
+ if (result == AuthTagMismatch)
+ {
+ throw new AuthenticationTagMismatchException();
+ }
+ else
+ {
+ Debug.Assert(result == 0);
+ throw new CryptographicException();
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/Swift.Bindings/tests/UnsafeBufferPointer/UnsafeBufferPointerTests.cs b/src/Swift.Bindings/tests/UnsafeBufferPointer/UnsafeBufferPointerTests.cs
new file mode 100644
index 000000000000..c25123a304e0
--- /dev/null
+++ b/src/Swift.Bindings/tests/UnsafeBufferPointer/UnsafeBufferPointerTests.cs
@@ -0,0 +1,23 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+using Xunit;
+
+namespace BindingsGeneration.Tests
+{
+ public class UnsafeBufferPointerTests
+ {
+ [Fact]
+ public static void TestUnsafeBufferPointerCryptoKit()
+ {
+ BindingsGenerator.GenerateBindings("UnsafeBufferPointer/UnsafeBufferPointerTests.abi.json", "UnsafeBufferPointer/");
+
+ int result = (int)TestsHelper.CompileAndExecute(
+ new string [] { "UnsafeBufferPointer/*.cs" },
+ new string [] { },
+ new string [] { "System.Security.Cryptography" },
+ "Test.MainClass", "Main", new object [] { new string[0] });
+ Assert.Equal(1, result);
+ }
+ }
+}
diff --git a/src/Swift.Bindings/tests/UnsafeBufferPointer/UnsafeBufferPointerTests.swift b/src/Swift.Bindings/tests/UnsafeBufferPointer/UnsafeBufferPointerTests.swift
new file mode 100644
index 000000000000..72ec7bcc7609
--- /dev/null
+++ b/src/Swift.Bindings/tests/UnsafeBufferPointer/UnsafeBufferPointerTests.swift
@@ -0,0 +1,58 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+import CryptoKit
+import Foundation
+
+public func AppleCryptoNative_ChaCha20Poly1305Encrypt(
+ keyPtr: UnsafeRawBufferPointer,
+ noncePtr: UnsafeRawBufferPointer,
+ plaintextPtr: UnsafeRawBufferPointer,
+ ciphertextPtr: UnsafeMutableBufferPointer,
+ tagPtr: UnsafeMutableBufferPointer,
+ aadPtr: UnsafeRawBufferPointer
+ ) -> Int32 {
+ let nonce = try! ChaChaPoly.Nonce(data: noncePtr)
+ let symmetricKey = SymmetricKey(data: keyPtr)
+
+ guard let result = try? ChaChaPoly.seal(plaintextPtr, using: symmetricKey, nonce: nonce, authenticating: aadPtr) else {
+ return 0
+ }
+
+ assert(ciphertextPtr.count >= result.ciphertext.count)
+ assert(tagPtr.count >= result.tag.count)
+
+ result.ciphertext.copyBytes(to: ciphertextPtr, count: result.ciphertext.count)
+ result.tag.copyBytes(to: tagPtr, count: result.tag.count)
+ return 1
+ }
+
+public func AppleCryptoNative_ChaCha20Poly1305Decrypt(
+ keyPtr: UnsafeRawBufferPointer,
+ noncePtr: UnsafeRawBufferPointer,
+ ciphertextPtr: UnsafeRawBufferPointer,
+ tagPtr: UnsafeRawBufferPointer,
+ plaintextPtr: UnsafeMutableBufferPointer,
+ aadPtr: UnsafeRawBufferPointer
+) -> Int32 {
+ let nonce = try! ChaChaPoly.Nonce(data: noncePtr)
+ let symmetricKey = SymmetricKey(data: keyPtr)
+
+ guard let sealedBox = try? ChaChaPoly.SealedBox(nonce: nonce, ciphertext: ciphertextPtr, tag: tagPtr) else {
+ return 0
+ }
+
+ do {
+ let result = try ChaChaPoly.open(sealedBox, using: symmetricKey, authenticating: aadPtr)
+
+ assert(plaintextPtr.count >= result.count)
+ result.copyBytes(to: plaintextPtr, count: result.count)
+ return 1
+ }
+ catch CryptoKitError.authenticationFailure {
+ return -1
+ }
+ catch {
+ return 0
+ }
+}
diff --git a/src/Swift.Bindings/tests/UnsafePointer/UnsafePointerTests.Source.cs b/src/Swift.Bindings/tests/UnsafePointer/UnsafePointerTests.Source.cs
new file mode 100644
index 000000000000..30cabc441d8b
--- /dev/null
+++ b/src/Swift.Bindings/tests/UnsafePointer/UnsafePointerTests.Source.cs
@@ -0,0 +1,142 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+using System;
+using UnsafePointerTestsBindings;
+using System.Diagnostics;
+using System.Security.Cryptography;
+using Swift.Runtime;
+
+namespace Test
+{
+ public class MainClass
+ {
+ public static int Main(string[] args)
+ {
+ byte[] key = RandomNumberGenerator.GetBytes(32); // Generate a 256-bit key
+ byte[] nonce = RandomNumberGenerator.GetBytes(12); // Generate a 96-bit nonce
+ byte[] plaintext = System.Text.Encoding.UTF8.GetBytes("Hello, World!");
+ byte[] aad = System.Text.Encoding.UTF8.GetBytes("Additional Authenticated Data");
+
+ byte[] ciphertext = new byte[plaintext.Length];
+ byte[] tag = new byte[16]; // ChaCha20Poly1305 tag size
+ Console.WriteLine($"Plaintext: {BitConverter.ToString(plaintext)}");
+
+ ChaCha20Poly1305Encrypt(
+ key,
+ nonce,
+ plaintext,
+ ciphertext,
+ tag,
+ aad);
+
+ Console.WriteLine($"Ciphertext: {BitConverter.ToString(ciphertext)}");
+ Console.WriteLine($"Tag: {BitConverter.ToString(tag)}");
+
+ Array.Clear(plaintext, 0, plaintext.Length);
+
+ ChaCha20Poly1305Decrypt(
+ key,
+ nonce,
+ ciphertext,
+ tag,
+ plaintext,
+ aad
+ );
+
+ string decryptedMessage = System.Text.Encoding.UTF8.GetString(plaintext);
+ Console.WriteLine($"Decrypted: {decryptedMessage}");
+ return "Hello, World!" == decryptedMessage ? 1 : 0;
+ }
+
+ internal static unsafe void ChaCha20Poly1305Encrypt(
+ ReadOnlySpan key,
+ ReadOnlySpan nonce,
+ ReadOnlySpan plaintext,
+ Span ciphertext,
+ Span tag,
+ ReadOnlySpan aad)
+ {
+ fixed (void* keyPtr = key)
+ fixed (void* noncePtr = nonce)
+ fixed (void* plaintextPtr = plaintext)
+ fixed (byte* ciphertextPtr = ciphertext)
+ fixed (byte* tagPtr = tag)
+ fixed (void* aadPtr = aad)
+ {
+ const int Success = 1;
+
+ UnsafeMutableRawPointer _keyPtr = new UnsafeMutableRawPointer(keyPtr);
+ UnsafeMutableRawPointer _noncePtr = new UnsafeMutableRawPointer(noncePtr);
+ UnsafeMutableRawPointer _plaintextPtr = new UnsafeMutableRawPointer(plaintextPtr);
+ UnsafeMutablePointer _ciphertextPtr = new UnsafeMutablePointer(ciphertextPtr);
+ UnsafeMutablePointer _tagPtr = new UnsafeMutablePointer(tagPtr);
+ UnsafeMutableRawPointer _aadPtr = new UnsafeMutableRawPointer(aadPtr);
+
+ int result = UnsafePointerTests.AppleCryptoNative_ChaCha20Poly1305Encrypt(
+ _keyPtr, key.Length,
+ _noncePtr, nonce.Length,
+ _plaintextPtr, plaintext.Length,
+ _ciphertextPtr, ciphertext.Length,
+ _tagPtr, tag.Length,
+ _aadPtr, aad.Length);
+
+ if (result != Success)
+ {
+ Debug.Assert(result == 0);
+ Console.WriteLine("Encryption failed");
+ }
+ }
+ }
+
+ internal static unsafe void ChaCha20Poly1305Decrypt(
+ ReadOnlySpan key,
+ ReadOnlySpan nonce,
+ ReadOnlySpan ciphertext,
+ ReadOnlySpan tag,
+ Span plaintext,
+ ReadOnlySpan aad)
+ {
+ fixed (void* keyPtr = key)
+ fixed (void* noncePtr = nonce)
+ fixed (void* ciphertextPtr = ciphertext)
+ fixed (void* tagPtr = tag)
+ fixed (byte* plaintextPtr = plaintext)
+ fixed (void* aadPtr = aad)
+ {
+ const int Success = 1;
+ const int AuthTagMismatch = -1;
+
+ UnsafeMutableRawPointer _keyPtr = new UnsafeMutableRawPointer(keyPtr);
+ UnsafeMutableRawPointer _noncePtr = new UnsafeMutableRawPointer(noncePtr);
+ UnsafeMutableRawPointer _ciphertextPtr = new UnsafeMutableRawPointer(ciphertextPtr);
+ UnsafeMutableRawPointer _tagPtr = new UnsafeMutableRawPointer (tagPtr);
+ UnsafeMutablePointer _plaintextPtr = new UnsafeMutablePointer(plaintextPtr);
+ UnsafeMutableRawPointer _aadPtr = new UnsafeMutableRawPointer(aadPtr);
+
+ int result = UnsafePointerTests.AppleCryptoNative_ChaCha20Poly1305Decrypt(
+ _keyPtr, key.Length,
+ _noncePtr, nonce.Length,
+ _ciphertextPtr, ciphertext.Length,
+ _tagPtr, tag.Length,
+ _plaintextPtr, plaintext.Length,
+ _aadPtr, aad.Length);
+
+ if (result != Success)
+ {
+ CryptographicOperations.ZeroMemory(plaintext);
+
+ if (result == AuthTagMismatch)
+ {
+ throw new AuthenticationTagMismatchException();
+ }
+ else
+ {
+ Debug.Assert(result == 0);
+ throw new CryptographicException();
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/Swift.Bindings/tests/UnsafePointer/UnsafePointerTests.cs b/src/Swift.Bindings/tests/UnsafePointer/UnsafePointerTests.cs
new file mode 100644
index 000000000000..ab912cd5fd21
--- /dev/null
+++ b/src/Swift.Bindings/tests/UnsafePointer/UnsafePointerTests.cs
@@ -0,0 +1,23 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+using Xunit;
+
+namespace BindingsGeneration.Tests
+{
+ public class UnsafePointerTests
+ {
+ [Fact]
+ public static void TestUnsafePointerCryptoKit()
+ {
+ BindingsGenerator.GenerateBindings("UnsafePointer/UnsafePointerTests.abi.json", "UnsafePointer/");
+
+ int result = (int)TestsHelper.CompileAndExecute(
+ new string [] { "UnsafePointer/*.cs" },
+ new string [] { },
+ new string [] { "System.Security.Cryptography" },
+ "Test.MainClass", "Main", new object [] { new string[0] });
+ Assert.Equal(1, result);
+ }
+ }
+}
diff --git a/src/Swift.Bindings/tests/UnsafePointer/UnsafePointerTests.swift b/src/Swift.Bindings/tests/UnsafePointer/UnsafePointerTests.swift
new file mode 100644
index 000000000000..7a063f0f915e
--- /dev/null
+++ b/src/Swift.Bindings/tests/UnsafePointer/UnsafePointerTests.swift
@@ -0,0 +1,85 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+import CryptoKit
+import Foundation
+
+public func AppleCryptoNative_ChaCha20Poly1305Encrypt(
+ keyPtr: UnsafeMutableRawPointer,
+ keyLength: Int32,
+ noncePtr: UnsafeMutableRawPointer,
+ nonceLength: Int32,
+ plaintextPtr: UnsafeMutableRawPointer,
+ plaintextLength: Int32,
+ ciphertextPtr: UnsafeMutablePointer,
+ ciphertextPtrLength: Int32,
+ tagPtr: UnsafeMutablePointer,
+ tagPtrLength: Int32,
+ aadPtr: UnsafeMutableRawPointer,
+ aadLength: Int32
+ ) -> Int32 {
+ let nonceData = Data(bytesNoCopy: noncePtr, count: Int(nonceLength), deallocator: Data.Deallocator.none)
+ let key = Data(bytesNoCopy: keyPtr, count: Int(keyLength), deallocator: Data.Deallocator.none)
+ let plaintext = Data(bytesNoCopy: plaintextPtr, count: Int(plaintextLength), deallocator: Data.Deallocator.none)
+ let aad = Data(bytesNoCopy: aadPtr, count: Int(aadLength), deallocator: Data.Deallocator.none)
+ let symmetricKey = SymmetricKey(data: key)
+
+ guard let nonce = try? ChaChaPoly.Nonce(data: nonceData) else {
+ return 0
+ }
+
+ guard let result = try? ChaChaPoly.seal(plaintext, using: symmetricKey, nonce: nonce, authenticating: aad) else {
+ return 0
+ }
+
+ assert(ciphertextPtrLength >= result.ciphertext.count)
+ assert(tagPtrLength >= result.tag.count)
+
+ result.ciphertext.copyBytes(to: ciphertextPtr, count: result.ciphertext.count)
+ result.tag.copyBytes(to: tagPtr, count: result.tag.count)
+ return 1
+ }
+
+public func AppleCryptoNative_ChaCha20Poly1305Decrypt(
+ keyPtr: UnsafeMutableRawPointer,
+ keyLength: Int32,
+ noncePtr: UnsafeMutableRawPointer,
+ nonceLength: Int32,
+ ciphertextPtr: UnsafeMutableRawPointer,
+ ciphertextLength: Int32,
+ tagPtr: UnsafeMutableRawPointer,
+ tagLength: Int32,
+ plaintextPtr: UnsafeMutablePointer,
+ plaintextPtrLength: Int32,
+ aadPtr: UnsafeMutableRawPointer,
+ aadLength: Int32
+) -> Int32 {
+ let nonceData = Data(bytesNoCopy: noncePtr, count: Int(nonceLength), deallocator: Data.Deallocator.none)
+ let key = Data(bytesNoCopy: keyPtr, count: Int(keyLength), deallocator: Data.Deallocator.none)
+ let ciphertext = Data(bytesNoCopy: ciphertextPtr, count: Int(ciphertextLength), deallocator: Data.Deallocator.none)
+ let aad = Data(bytesNoCopy: aadPtr, count: Int(aadLength), deallocator: Data.Deallocator.none)
+ let tag = Data(bytesNoCopy: tagPtr, count: Int(tagLength), deallocator: Data.Deallocator.none)
+ let symmetricKey = SymmetricKey(data: key)
+
+ guard let nonce = try? ChaChaPoly.Nonce(data: nonceData) else {
+ return 0
+ }
+
+ guard let sealedBox = try? ChaChaPoly.SealedBox(nonce: nonce, ciphertext: ciphertext, tag: tag) else {
+ return 0
+ }
+
+ do {
+ let result = try ChaChaPoly.open(sealedBox, using: symmetricKey, authenticating: aad)
+
+ assert(plaintextPtrLength >= result.count)
+ result.copyBytes(to: plaintextPtr, count: result.count)
+ return 1
+ }
+ catch CryptoKitError.authenticationFailure {
+ return -1
+ }
+ catch {
+ return 0
+ }
+}
diff --git a/src/Swift.Runtime/src/Library/UnsafeBufferPointer.cs b/src/Swift.Runtime/src/Library/UnsafeBufferPointer.cs
new file mode 100644
index 000000000000..72af675f8026
--- /dev/null
+++ b/src/Swift.Runtime/src/Library/UnsafeBufferPointer.cs
@@ -0,0 +1,73 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+namespace Swift.Runtime
+{
+ //
+ // Represents Swift UnsafeBufferPointer in C#.
+ //
+ public unsafe readonly struct UnsafeBufferPointer where T : unmanaged
+ {
+ private readonly T* _baseAddress;
+ private readonly nint _count;
+ public UnsafeBufferPointer(T* baseAddress, nint count)
+ {
+ _baseAddress = baseAddress;
+ _count = count;
+ }
+
+ public T* BaseAddress => _baseAddress;
+ public nint Count => _count;
+ }
+
+ //
+ // Represents Swift UnsafeMutableBufferPointer in C#.
+ //
+ public unsafe readonly struct UnsafeMutableBufferPointer where T : unmanaged
+ {
+ private readonly T* _baseAddress;
+ private readonly nint _count;
+ public UnsafeMutableBufferPointer(T* baseAddress, nint count)
+ {
+ _baseAddress = baseAddress;
+ _count = count;
+ }
+
+ public T* BaseAddress => _baseAddress;
+ public nint Count => _count;
+ }
+
+ //
+ // Represents Swift UnsafeRawBufferPointer in C#.
+ //
+ public unsafe readonly struct UnsafeRawBufferPointer
+ {
+ private readonly void* _baseAddress;
+ private readonly void* _end;
+ public UnsafeRawBufferPointer(void* baseAddress, nint count)
+ {
+ _baseAddress = baseAddress;
+ _end = (byte*)baseAddress + count;
+ }
+
+ public void* BaseAddress => _baseAddress;
+ public nint Count => (nint)((byte*)_end - (byte*)_baseAddress);
+ }
+
+ //
+ // Represents Swift UnsafeMutableRawBufferPointer in C#.
+ //
+ public unsafe readonly struct UnsafeMutableRawBufferPointer
+ {
+ private readonly void* _baseAddress;
+ private readonly void* _end;
+ public UnsafeMutableRawBufferPointer(void* baseAddress, nint count)
+ {
+ _baseAddress = baseAddress;
+ _end = (byte*)baseAddress + count;
+ }
+
+ public void* BaseAddress => _baseAddress;
+ public nint Count => (nint)((byte*)_end - (byte*)_baseAddress);
+ }
+}
diff --git a/src/Swift.Runtime/src/Library/UnsafePointer.cs b/src/Swift.Runtime/src/Library/UnsafePointer.cs
new file mode 100644
index 000000000000..a2a67956aaad
--- /dev/null
+++ b/src/Swift.Runtime/src/Library/UnsafePointer.cs
@@ -0,0 +1,77 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+namespace Swift.Runtime
+{
+ //
+ // Represents Swift UnsafePointer in C#.
+ //
+ public unsafe readonly struct UnsafePointer where T : unmanaged
+ {
+ private readonly T* _pointee;
+ public UnsafePointer(T* pointee)
+ {
+ this._pointee = pointee;
+ }
+
+ public T* Pointee => _pointee;
+
+ public static implicit operator T*(UnsafePointer pointer) => pointer.Pointee;
+
+ public static implicit operator UnsafePointer(T* pointee) => new UnsafePointer(pointee);
+ }
+
+ //
+ // Represents Swift UnsafeMutablePointer in C#.
+ //
+ public unsafe readonly struct UnsafeMutablePointer where T : unmanaged
+ {
+ private readonly T* _pointee;
+ public UnsafeMutablePointer(T* pointee)
+ {
+ _pointee = pointee;
+ }
+
+ public T* Pointee => _pointee;
+
+ public static implicit operator T*(UnsafeMutablePointer pointer) => pointer.Pointee;
+
+ public static implicit operator UnsafeMutablePointer(T* pointee) => new UnsafeMutablePointer(pointee);
+ }
+
+ //
+ // Represents Swift UnsafeRawPointer in C#.
+ //
+ public unsafe readonly struct UnsafeRawPointer
+ {
+ private readonly void* _pointee;
+ public UnsafeRawPointer(void* pointee)
+ {
+ _pointee = pointee;
+ }
+
+ public void* Pointee => _pointee;
+
+ public static implicit operator void*(UnsafeRawPointer pointer) => pointer.Pointee;
+
+ public static implicit operator UnsafeRawPointer(void* pointee) => new UnsafeRawPointer(pointee);
+ }
+
+ //
+ // Represents Swift UnsafeMutableRawPointer in C#.
+ //
+ public unsafe readonly struct UnsafeMutableRawPointer
+ {
+ private readonly void* _pointee;
+ public UnsafeMutableRawPointer(void* pointee)
+ {
+ _pointee = pointee;
+ }
+
+ public void* Pointee => _pointee;
+
+ public static implicit operator void*(UnsafeMutableRawPointer pointer) => pointer.Pointee;
+
+ public static implicit operator UnsafeMutableRawPointer(void* pointee) => new UnsafeMutableRawPointer(pointee);
+ }
+}
diff --git a/src/Swift.Runtime/src/Swift.Runtime.csproj b/src/Swift.Runtime/src/Swift.Runtime.csproj
new file mode 100644
index 000000000000..894158d1a558
--- /dev/null
+++ b/src/Swift.Runtime/src/Swift.Runtime.csproj
@@ -0,0 +1,22 @@
+
+
+
+ Library
+ net9.0
+ enable
+ enable
+ true
+
+ true
+ true
+
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+
+
diff --git a/src/Swift.Runtime/src/TypeDatabase.cs b/src/Swift.Runtime/src/TypeDatabase.cs
new file mode 100644
index 000000000000..52d23497ace9
--- /dev/null
+++ b/src/Swift.Runtime/src/TypeDatabase.cs
@@ -0,0 +1,121 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+using System.Xml;
+
+namespace Swift.Runtime
+{
+ ///
+ /// Represents a database for mapping Swift type names to C# type names.
+ ///
+ public class TypeDatabase
+ {
+ private readonly Dictionary _swiftToCSharpMapping = new Dictionary();
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The path to the XML file containing the type mappings.
+ public TypeDatabase(string file)
+ {
+ XmlDocument xmlDoc = new XmlDocument();
+ xmlDoc.Load(file);
+ if (!ValidateXmlSchema(xmlDoc))
+ throw new Exception(string.Format($"Invalid XML schema in {0}.", file));
+
+ var version = xmlDoc.DocumentElement?.Attributes?["version"]?.Value;
+ switch (version)
+ {
+ case "1.0":
+ ReadVersion1_0(xmlDoc);
+ break;
+ default:
+ throw new Exception(string.Format($"Unsupported database version {0} in {1}.", version, file));
+ }
+ }
+
+ ///
+ /// Validates the XML schema of the provided document.
+ ///
+ /// The XML document to validate.
+ /// True if the XML schema is valid; otherwise, false.
+ public static bool ValidateXmlSchema(XmlDocument xmlDoc)
+ {
+ if (xmlDoc == null)
+ return false;
+
+ if (xmlDoc?.DocumentElement?.Name != "swifttypedatabase")
+ return false;
+
+ if (xmlDoc.DocumentElement.Attributes["version"]?.Value != "1.0")
+ return false;
+
+ XmlNode? entitiesNode = xmlDoc?.SelectSingleNode("//swifttypedatabase/entities");
+ if (entitiesNode == null)
+ return false;
+
+ if (entitiesNode.ChildNodes.Count == 0)
+ return false;
+
+ foreach (XmlNode entityNode in entitiesNode.ChildNodes)
+ {
+ if (entityNode.Name != "entity")
+ return false;
+
+ XmlNode? typeDeclarationNode = entityNode?.SelectSingleNode("typedeclaration");
+ if (typeDeclarationNode == null)
+ return false;
+ }
+
+ return true;
+ }
+
+ ///
+ /// Reads and parses the XML document containing type mappings based on the version 1.0.
+ ///
+ /// The XML document to read.
+ private void ReadVersion1_0(XmlDocument xmlDoc)
+ {
+ XmlNode? entitiesNode = xmlDoc.SelectSingleNode("//swifttypedatabase/entities");
+
+ if (entitiesNode == null)
+ throw new Exception("Invalid XML structure: 'entities' node not found.");
+
+ foreach (XmlNode? entityNode in entitiesNode.ChildNodes)
+ {
+ XmlNode? typeDeclarationNode = entityNode?.SelectSingleNode("typedeclaration");
+ if (typeDeclarationNode == null)
+ throw new Exception("Invalid XML structure: 'typedeclaration' node not found.");
+
+ string? swiftName = typeDeclarationNode?.Attributes?["name"]?.Value;
+ string? csharpName = entityNode?.Attributes?["managedTypeName"]?.Value;
+ if (swiftName == null || csharpName == null)
+ throw new Exception("Invalid XML structure: Missing attributes.");
+
+ _swiftToCSharpMapping.Add(swiftName, csharpName);
+ }
+ }
+
+ ///
+ /// Gets the C# type name corresponding to the specified Swift type name.
+ /// The method first tries to find a known mapping, and if that fails, it looks for a type in Swift.Runtime.
+ ///
+ /// The Swift type name.
+ /// The corresponding C# type name.
+ public string[] GetCSharpTypeName(string swiftTypeName)
+ {
+ // Try to find a known mapping
+ if (_swiftToCSharpMapping.TryGetValue(swiftTypeName, out string? csharpTypeName))
+ {
+ return new string [] { "System", csharpTypeName };
+ }
+
+ // Try to find a type in Swift.Runtime
+ Type? swiftRuntimeType = Type.GetType($"Swift.Runtime.{swiftTypeName}");
+ if (swiftRuntimeType != null)
+ return new string [] { "Swift.Runtime", swiftRuntimeType.Name };
+
+ throw new Exception($"No mapping for {swiftTypeName} type found.");
+ }
+ }
+}
diff --git a/src/Swift.Runtime/src/TypeDatabase.xml b/src/Swift.Runtime/src/TypeDatabase.xml
new file mode 100644
index 000000000000..cd70484fae19
--- /dev/null
+++ b/src/Swift.Runtime/src/TypeDatabase.xml
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Swift.Runtime/tests/Swift.Runtime.Tests.csproj b/src/Swift.Runtime/tests/Swift.Runtime.Tests.csproj
new file mode 100644
index 000000000000..bb313efd6772
--- /dev/null
+++ b/src/Swift.Runtime/tests/Swift.Runtime.Tests.csproj
@@ -0,0 +1,14 @@
+
+
+
+ net9.0
+ enable
+ enable
+ false
+ true
+
+
+
+
+
+
diff --git a/src/Swift.Runtime/tests/XmlFileTests.cs b/src/Swift.Runtime/tests/XmlFileTests.cs
new file mode 100644
index 000000000000..3e0ab8363755
--- /dev/null
+++ b/src/Swift.Runtime/tests/XmlFileTests.cs
@@ -0,0 +1,19 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+using Xunit;
+using System.Xml;
+
+namespace Swift.Runtime.Tests;
+
+public class XmlFileTests
+{
+ [Fact]
+ public void TestXmlFormat()
+ {
+ XmlDocument xmlDoc = new XmlDocument();
+ xmlDoc.Load("TypeDatabase.xml");
+ bool isValidXml = TypeDatabase.ValidateXmlSchema(xmlDoc);
+ Assert.True(isValidXml);
+ }
+}
diff --git a/src/SwiftBindings/src/MyClass.cs b/src/SwiftBindings/src/MyClass.cs
deleted file mode 100644
index 907d856d3f57..000000000000
--- a/src/SwiftBindings/src/MyClass.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System;
-
-namespace SwiftBindings
-{
- public class MyClass
- {
- public static bool ReturnTrue => true;
- public static void Main(string[] args)
- {
- Console.WriteLine("Hello World!");
- }
- }
-}
diff --git a/src/SwiftBindings/tests/SmokeTests.cs b/src/SwiftBindings/tests/SmokeTests.cs
deleted file mode 100644
index db7c93457129..000000000000
--- a/src/SwiftBindings/tests/SmokeTests.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System;
-using Xunit;
-
-namespace SwiftBindings.Tests
-{
- public class MyClassTests
- {
- [Fact]
- public void Test1()
- {
- Assert.True(MyClass.ReturnTrue);
- }
- }
-}
diff --git a/src/SwiftBindings/tests/SwiftBindings.Tests.csproj b/src/SwiftBindings/tests/SwiftBindings.Tests.csproj
deleted file mode 100644
index 6613abf6d7a0..000000000000
--- a/src/SwiftBindings/tests/SwiftBindings.Tests.csproj
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
- net9.0
-
-
-
-
-
-
diff --git a/src/samples/HelloWorld/HelloLibrary.swift b/src/samples/HelloWorld/HelloLibrary.swift
new file mode 100644
index 000000000000..0867abe897e8
--- /dev/null
+++ b/src/samples/HelloWorld/HelloLibrary.swift
@@ -0,0 +1,6 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+public func sayHello() {
+ print("Hello world")
+}
\ No newline at end of file
diff --git a/src/SwiftBindings/src/SwiftBindings.csproj b/src/samples/HelloWorld/HelloWorld.csproj
similarity index 100%
rename from src/SwiftBindings/src/SwiftBindings.csproj
rename to src/samples/HelloWorld/HelloWorld.csproj
diff --git a/src/samples/HelloWorld/Program.cs b/src/samples/HelloWorld/Program.cs
new file mode 100644
index 000000000000..1d3607cd7854
--- /dev/null
+++ b/src/samples/HelloWorld/Program.cs
@@ -0,0 +1,16 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+using System;
+using HelloLibraryBindings;
+
+namespace HelloWorld
+{
+ public class Program
+ {
+ public static void Main(string[] args)
+ {
+ HelloLibrary.sayHello();
+ }
+ }
+}
diff --git a/src/samples/HelloWorld/build.sh b/src/samples/HelloWorld/build.sh
new file mode 100755
index 000000000000..4f82533d53db
--- /dev/null
+++ b/src/samples/HelloWorld/build.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+xcrun swiftc -emit-module -emit-library -enable-library-evolution -emit-module-interface HelloLibrary.swift -o libHelloLibrary.dylib
+
+dotnet restore ../../Swift.Bindings/src/Swift.Bindings.csproj
+dotnet build ../../Swift.Bindings/src/Swift.Bindings.csproj
+
+if [ $? -eq 0 ]; then
+ echo "Build successful. Running the BindingsTool..."
+ dotnet ../../../artifacts/bin/Swift.Bindings/Debug/net9.0/Swift.Bindings.dll -a "./HelloLibrary.abi.json" -o "./"
+ dotnet run
+else
+ echo "Build failed. Exiting..."
+ exit 1
+fi