diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/Base/CXXMethodDeclarationCSharpTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/Base/CXXMethodDeclarationCSharpTest.cs
new file mode 100644
index 00000000..a187c518
--- /dev/null
+++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/Base/CXXMethodDeclarationCSharpTest.cs
@@ -0,0 +1,579 @@
+// Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
+
+using System.Threading.Tasks;
+
+namespace ClangSharp.UnitTests;
+
+public abstract class CXXMethodDeclarationCSharpTest : CXXMethodDeclarationTest
+{
+ protected override Task ConstructorTestImpl()
+ {
+ var inputContents = @"struct MyStruct
+{
+ int _value;
+
+ MyStruct(int value)
+ {
+ _value = value;
+ }
+};
+";
+
+ var expectedOutputContents = @"namespace ClangSharp.Test
+{
+ public partial struct MyStruct
+ {
+ public int _value;
+
+ public MyStruct(int value)
+ {
+ _value = value;
+ }
+ }
+}
+";
+
+ return ValidateBindingsAsync(inputContents, expectedOutputContents);
+ }
+
+ protected override Task ConstructorWithInitializeTestImpl()
+ {
+ var inputContents = @"struct MyStruct
+{
+ int _x;
+ int _y;
+ int _z;
+
+ MyStruct(int x) : _x(x)
+ {
+ }
+
+ MyStruct(int x, int y) : _x(x), _y(y)
+ {
+ }
+
+ MyStruct(int x, int y, int z) : _x(x), _y(y), _z()
+ {
+ }
+};
+";
+
+ var expectedOutputContents = @"namespace ClangSharp.Test
+{
+ public partial struct MyStruct
+ {
+ public int _x;
+
+ public int _y;
+
+ public int _z;
+
+ public MyStruct(int x)
+ {
+ _x = x;
+ }
+
+ public MyStruct(int x, int y)
+ {
+ _x = x;
+ _y = y;
+ }
+
+ public MyStruct(int x, int y, int z)
+ {
+ _x = x;
+ _y = y;
+ }
+ }
+}
+";
+
+ return ValidateBindingsAsync(inputContents, expectedOutputContents);
+ }
+
+ protected override Task ConversionTestImpl()
+ {
+ var inputContents = @"struct MyStruct
+{
+ int value;
+
+ operator int()
+ {
+ return value;
+ }
+};
+";
+
+ var expectedOutputContents = @"namespace ClangSharp.Test
+{
+ public partial struct MyStruct
+ {
+ public int value;
+
+ public int ToInt32()
+ {
+ return value;
+ }
+ }
+}
+";
+
+ return ValidateBindingsAsync(inputContents, expectedOutputContents);
+ }
+
+ protected override Task DestructorTestImpl()
+ {
+ var inputContents = @"struct MyStruct
+{
+ ~MyStruct()
+ {
+ }
+};
+";
+
+ var expectedOutputContents = @"namespace ClangSharp.Test
+{
+ public partial struct MyStruct
+ {
+ public void Dispose()
+ {
+ }
+ }
+}
+";
+
+ return ValidateBindingsAsync(inputContents, expectedOutputContents);
+ }
+
+ protected override Task MacrosExpansionTestImpl()
+ {
+ var inputContents = @"typedef struct
+{
+ unsigned char *buf;
+ int size;
+} context_t;
+
+int buf_close(void *pContext)
+{
+ ((context_t*)pContext)->buf=0;
+ return 0;
+}
+";
+
+ var expectedOutputContents = @"namespace ClangSharp.Test
+{
+ public unsafe partial struct context_t
+ {
+ [NativeTypeName(""unsigned char *"")]
+ public byte* buf;
+
+ public int size;
+ }
+
+ public static unsafe partial class Methods
+ {
+ public static int buf_close(void* pContext)
+ {
+ ((context_t*)(pContext))->buf = null;
+ return 0;
+ }
+ }
+}
+";
+
+ return ValidateBindingsAsync(inputContents, expectedOutputContents);
+ }
+
+ protected override Task MemberCallTestImpl()
+ {
+ var inputContents = @"struct MyStruct
+{
+ int value;
+
+ int MyFunction1()
+ {
+ return value;
+ }
+
+ int MyFunction2()
+ {
+ return MyFunction1();
+ }
+
+ int MyFunction3()
+ {
+ return this->MyFunction1();
+ }
+};
+
+int MyFunctionA(MyStruct x)
+{
+ return x.MyFunction1();
+}
+
+int MyFunctionB(MyStruct* x)
+{
+ return x->MyFunction2();
+}
+";
+
+ var expectedOutputContents = @"namespace ClangSharp.Test
+{
+ public partial struct MyStruct
+ {
+ public int value;
+
+ public int MyFunction1()
+ {
+ return value;
+ }
+
+ public int MyFunction2()
+ {
+ return MyFunction1();
+ }
+
+ public int MyFunction3()
+ {
+ return this.MyFunction1();
+ }
+ }
+
+ public static unsafe partial class Methods
+ {
+ public static int MyFunctionA(MyStruct x)
+ {
+ return x.MyFunction1();
+ }
+
+ public static int MyFunctionB(MyStruct* x)
+ {
+ return x->MyFunction2();
+ }
+ }
+}
+";
+
+ return ValidateBindingsAsync(inputContents, expectedOutputContents);
+ }
+
+ protected override Task MemberTestImpl()
+ {
+ var inputContents = @"struct MyStruct
+{
+ int value;
+
+ int MyFunction()
+ {
+ return value;
+ }
+};
+";
+
+ var expectedOutputContents = @"namespace ClangSharp.Test
+{
+ public partial struct MyStruct
+ {
+ public int value;
+
+ public int MyFunction()
+ {
+ return value;
+ }
+ }
+}
+";
+
+ return ValidateBindingsAsync(inputContents, expectedOutputContents);
+ }
+
+ protected override Task NewKeywordTestImpl()
+ {
+ var inputContents = @"struct MyStruct
+{
+ int Equals() { return 0; }
+ int Equals(int obj) { return 0; }
+ int Dispose() { return 0; }
+ int Dispose(int obj) { return 0; }
+ int GetHashCode() { return 0; }
+ int GetHashCode(int obj) { return 0; }
+ int GetType() { return 0; }
+ int GetType(int obj) { return 0; }
+ int MemberwiseClone() { return 0; }
+ int MemberwiseClone(int obj) { return 0; }
+ int ReferenceEquals() { return 0; }
+ int ReferenceEquals(int obj) { return 0; }
+ int ToString() { return 0; }
+ int ToString(int obj) { return 0; }
+};";
+
+ var expectedOutputContents = $@"namespace ClangSharp.Test
+{{
+ public partial struct MyStruct
+ {{
+ public int Equals()
+ {{
+ return 0;
+ }}
+
+ public int Equals(int obj)
+ {{
+ return 0;
+ }}
+
+ public int Dispose()
+ {{
+ return 0;
+ }}
+
+ public int Dispose(int obj)
+ {{
+ return 0;
+ }}
+
+ public new int GetHashCode()
+ {{
+ return 0;
+ }}
+
+ public int GetHashCode(int obj)
+ {{
+ return 0;
+ }}
+
+ public new int GetType()
+ {{
+ return 0;
+ }}
+
+ public int GetType(int obj)
+ {{
+ return 0;
+ }}
+
+ public new int MemberwiseClone()
+ {{
+ return 0;
+ }}
+
+ public int MemberwiseClone(int obj)
+ {{
+ return 0;
+ }}
+
+ public int ReferenceEquals()
+ {{
+ return 0;
+ }}
+
+ public int ReferenceEquals(int obj)
+ {{
+ return 0;
+ }}
+
+ public new int ToString()
+ {{
+ return 0;
+ }}
+
+ public int ToString(int obj)
+ {{
+ return 0;
+ }}
+ }}
+}}
+";
+
+ return ValidateBindingsAsync(inputContents, expectedOutputContents);
+ }
+
+ protected override Task OperatorTestImpl()
+ {
+ var inputContents = @"struct MyStruct
+{
+ int value;
+
+ MyStruct(int value) : value(value)
+ {
+ }
+
+ MyStruct operator+(MyStruct rhs)
+ {
+ return MyStruct(value + rhs.value);
+ }
+};
+
+MyStruct operator-(MyStruct lhs, MyStruct rhs)
+{
+ return MyStruct(lhs.value - rhs.value);
+}
+";
+
+ var expectedOutputContents = @"namespace ClangSharp.Test
+{
+ public partial struct MyStruct
+ {
+ public int value;
+
+ public MyStruct(int value)
+ {
+ this.value = value;
+ }
+
+ public MyStruct Add(MyStruct rhs)
+ {
+ return new MyStruct(value + rhs.value);
+ }
+ }
+
+ public static partial class Methods
+ {
+ public static MyStruct Subtract(MyStruct lhs, MyStruct rhs)
+ {
+ return new MyStruct(lhs.value - rhs.value);
+ }
+ }
+}
+";
+
+ return ValidateBindingsAsync(inputContents, expectedOutputContents);
+ }
+
+ protected override Task OperatorCallTestImpl()
+ {
+ var inputContents = @"struct MyStruct
+{
+ int value;
+
+ MyStruct(int value) : value(value)
+ {
+ }
+
+ MyStruct operator+(MyStruct rhs)
+ {
+ return MyStruct(value + rhs.value);
+ }
+};
+
+MyStruct MyFunction1(MyStruct lhs, MyStruct rhs)
+{
+ return lhs + rhs;
+}
+
+MyStruct operator-(MyStruct lhs, MyStruct rhs)
+{
+ return MyStruct(lhs.value - rhs.value);
+}
+
+MyStruct MyFunction2(MyStruct lhs, MyStruct rhs)
+{
+ return lhs - rhs;
+}
+";
+
+ var expectedOutputContents = @"namespace ClangSharp.Test
+{
+ public partial struct MyStruct
+ {
+ public int value;
+
+ public MyStruct(int value)
+ {
+ this.value = value;
+ }
+
+ public MyStruct Add(MyStruct rhs)
+ {
+ return new MyStruct(value + rhs.value);
+ }
+ }
+
+ public static partial class Methods
+ {
+ public static MyStruct MyFunction1(MyStruct lhs, MyStruct rhs)
+ {
+ return lhs.Add(rhs);
+ }
+
+ public static MyStruct Subtract(MyStruct lhs, MyStruct rhs)
+ {
+ return new MyStruct(lhs.value - rhs.value);
+ }
+
+ public static MyStruct MyFunction2(MyStruct lhs, MyStruct rhs)
+ {
+ return Subtract(lhs, rhs);
+ }
+ }
+}
+";
+
+ return ValidateBindingsAsync(inputContents, expectedOutputContents);
+ }
+
+ protected override Task ThisTestImpl()
+ {
+ var inputContents = @"struct MyStruct
+{
+ int value;
+
+ int MyFunction()
+ {
+ return this->value;
+ }
+};
+";
+
+ var expectedOutputContents = @"namespace ClangSharp.Test
+{
+ public partial struct MyStruct
+ {
+ public int value;
+
+ public int MyFunction()
+ {
+ return this.value;
+ }
+ }
+}
+";
+
+ return ValidateBindingsAsync(inputContents, expectedOutputContents);
+ }
+
+ protected override Task UnsafeDoesNotImpactDllImportTestImpl()
+ {
+ var inputContents = @"struct MyStruct
+{
+ void* MyVoidStarMethod()
+ {
+ return nullptr;
+ }
+};
+
+extern ""C"" void MyFunction();";
+
+ var expectedOutputContents = @"using System.Runtime.InteropServices;
+
+namespace ClangSharp.Test
+{
+ public unsafe partial struct MyStruct
+ {
+ public void* MyVoidStarMethod()
+ {
+ return null;
+ }
+ }
+
+ public static partial class Methods
+ {
+ [DllImport(""ClangSharpPInvokeGenerator"", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
+ public static extern void MyFunction();
+ }
+}
+";
+
+ return ValidateBindingsAsync(inputContents, expectedOutputContents);
+ }
+
+}
diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/Base/CXXMethodDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/Base/CXXMethodDeclarationTest.cs
index 05f77d4c..6e81b3a5 100644
--- a/tests/ClangSharp.PInvokeGenerator.UnitTests/Base/CXXMethodDeclarationTest.cs
+++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/Base/CXXMethodDeclarationTest.cs
@@ -25,6 +25,9 @@ public abstract class CXXMethodDeclarationTest : PInvokeGeneratorTest
[Test]
public Task InstanceTest() => InstanceTestImpl();
+ [Test]
+ public Task MacrosExpansionTest() => MacrosExpansionTestImpl();
+
[Test]
public Task MemberCallTest() => MemberCallTestImpl();
@@ -64,46 +67,6 @@ public abstract class CXXMethodDeclarationTest : PInvokeGeneratorTest
[Test]
public Task VirtualWithVtblIndexAttributeTest() => VirtualWithVtblIndexAttributeTestImpl();
- [Test]
- public virtual Task MacrosExpansionTest()
- {
- var inputContents = @"typedef struct
-{
- unsigned char *buf;
- int size;
-} context_t;
-
-int buf_close(void *pContext)
-{
- ((context_t*)pContext)->buf=0;
- return 0;
-}
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public unsafe partial struct context_t
- {
- [NativeTypeName(""unsigned char *"")]
- public byte* buf;
-
- public int size;
- }
-
- public static unsafe partial class Methods
- {
- public static int buf_close(void* pContext)
- {
- ((context_t*)(pContext))->buf = null;
- return 0;
- }
- }
-}
-";
-
- return ValidateBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected abstract Task ConstructorTestImpl();
protected abstract Task ConstructorWithInitializeTestImpl();
@@ -116,6 +79,8 @@ public static int buf_close(void* pContext)
protected abstract Task InstanceTestImpl();
+ protected abstract Task MacrosExpansionTestImpl();
+
protected abstract Task MemberCallTestImpl();
protected abstract Task MemberTestImpl();
diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/Base/CXXMethodDeclarationXmlTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/Base/CXXMethodDeclarationXmlTest.cs
index 6c828d97..0a37bdf1 100644
--- a/tests/ClangSharp.PInvokeGenerator.UnitTests/Base/CXXMethodDeclarationXmlTest.cs
+++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/Base/CXXMethodDeclarationXmlTest.cs
@@ -1,25 +1,204 @@
// Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
using System.Threading.Tasks;
-using NUnit.Framework;
namespace ClangSharp.UnitTests;
public abstract class CXXMethodDeclarationXmlTest: CXXMethodDeclarationTest
{
- [Test]
- public override Task MacrosExpansionTest()
+ protected override Task ConstructorTestImpl()
+ {
+ var inputContents = @"struct MyStruct
+{
+ int _value;
+
+ MyStruct(int value)
+ {
+ _value = value;
+ }
+};
+";
+
+ var expectedOutputContents = @"
+
+
+
+
+ int
+
+
+ void
+
+ int
+
+ _value = value;
+
+
+
+
+";
+
+ return ValidateBindingsAsync(inputContents, expectedOutputContents);
+ }
+
+ protected override Task ConstructorWithInitializeTestImpl()
+ {
+ var inputContents = @"struct MyStruct
+{
+ int _x;
+ int _y;
+ int _z;
+
+ MyStruct(int x) : _x(x)
+ {
+ }
+
+ MyStruct(int x, int y) : _x(x), _y(y)
+ {
+ }
+
+ MyStruct(int x, int y, int z) : _x(x), _y(y), _z()
+ {
+ }
+};
+";
+
+ var expectedOutputContents = @"
+
+
+
+
+ int
+
+
+ int
+
+
+ int
+
+
+ void
+
+ int
+
+
+ x
+
+
+
+
+ void
+
+ int
+
+
+ int
+
+
+ x
+
+
+ y
+
+
+
+
+ void
+
+ int
+
+
+ int
+
+
+ int
+
+
+ x
+
+
+ y
+
+
+
+
+
+
+";
+
+ return ValidateBindingsAsync(inputContents, expectedOutputContents);
+ }
+
+ protected override Task ConversionTestImpl()
+ {
+ var inputContents = @"struct MyStruct
+{
+ int value;
+
+ operator int()
+ {
+ return value;
+ }
+};
+";
+
+ var expectedOutputContents = @"
+
+
+
+
+ int
+
+
+ int
+ return value;
+
+
+
+
+";
+
+ return ValidateBindingsAsync(inputContents, expectedOutputContents);
+ }
+
+ protected override Task DestructorTestImpl()
+ {
+ var inputContents = @"struct MyStruct
+{
+ ~MyStruct()
+ {
+ }
+};
+";
+
+ var expectedOutputContents = @"
+
+
+
+
+ void
+
+
+
+
+
+";
+
+ return ValidateBindingsAsync(inputContents, expectedOutputContents);
+ }
+
+ protected override Task MacrosExpansionTestImpl()
{
var inputContents = @"typedef struct
{
- unsigned char *buf;
- int size;
+ unsigned char *buf;
+ int size;
} context_t;
int buf_close(void *pcontext)
{
- ((context_t*)pcontext)->buf=0;
- return 0;
+ ((context_t*)pcontext)->buf=0;
+ return 0;
}
";
@@ -46,6 +225,450 @@ int buf_close(void *pcontext)
+";
+
+ return ValidateBindingsAsync(inputContents, expectedOutputContents);
+ }
+
+ protected override Task MemberCallTestImpl()
+ {
+ var inputContents = @"struct MyStruct
+{
+ int value;
+
+ int MyFunction1()
+ {
+ return value;
+ }
+
+ int MyFunction2()
+ {
+ return MyFunction1();
+ }
+
+ int MyFunction3()
+ {
+ return this->MyFunction1();
+ }
+};
+
+int MyFunctionA(MyStruct x)
+{
+ return x.MyFunction1();
+}
+
+int MyFunctionB(MyStruct* x)
+{
+ return x->MyFunction2();
+}
+";
+
+ var expectedOutputContents = @"
+
+
+
+
+ int
+
+
+ int
+ return value;
+
+
+ int
+ return MyFunction1();
+
+
+ int
+ return this.MyFunction1();
+
+
+
+
+ int
+
+ MyStruct
+
+ return x.MyFunction1();
+
+
+ int
+
+ MyStruct*
+
+ return x->MyFunction2();
+
+
+
+
+";
+
+ return ValidateBindingsAsync(inputContents, expectedOutputContents);
+ }
+
+ protected override Task MemberTestImpl()
+ {
+ var inputContents = @"struct MyStruct
+{
+ int value;
+
+ int MyFunction()
+ {
+ return value;
+ }
+};
+";
+
+ var expectedOutputContents = @"
+
+
+
+
+ int
+
+
+ int
+ return value;
+
+
+
+
+";
+
+ return ValidateBindingsAsync(inputContents, expectedOutputContents);
+ }
+
+ protected override Task NewKeywordTestImpl()
+ {
+ var inputContents = @"struct MyStruct
+{
+ int Equals() { return 0; }
+ int Equals(int obj) { return 0; }
+ int Dispose() { return 0; }
+ int Dispose(int obj) { return 0; }
+ int GetHashCode() { return 0; }
+ int GetHashCode(int obj) { return 0; }
+ int GetType() { return 0; }
+ int GetType(int obj) { return 0; }
+ int MemberwiseClone() { return 0; }
+ int MemberwiseClone(int obj) { return 0; }
+ int ReferenceEquals() { return 0; }
+ int ReferenceEquals(int obj) { return 0; }
+ int ToString() { return 0; }
+ int ToString(int obj) { return 0; }
+};";
+
+ var expectedOutputContents = $@"
+
+
+
+
+ int
+ return 0;
+
+
+ int
+
+ int
+
+ return 0;
+
+
+ int
+ return 0;
+
+
+ int
+
+ int
+
+ return 0;
+
+
+ int
+ return 0;
+
+
+ int
+
+ int
+
+ return 0;
+
+
+ int
+ return 0;
+
+
+ int
+
+ int
+
+ return 0;
+
+
+ int
+ return 0;
+
+
+ int
+
+ int
+
+ return 0;
+
+
+ int
+ return 0;
+
+
+ int
+
+ int
+
+ return 0;
+
+
+ int
+ return 0;
+
+
+ int
+
+ int
+
+ return 0;
+
+
+
+
+";
+
+ return ValidateBindingsAsync(inputContents, expectedOutputContents);
+ }
+
+ protected override Task OperatorTestImpl()
+ {
+ var inputContents = @"struct MyStruct
+{
+ int value;
+
+ MyStruct(int value) : value(value)
+ {
+ }
+
+ MyStruct operator+(MyStruct rhs)
+ {
+ return MyStruct(value + rhs.value);
+ }
+};
+
+MyStruct operator-(MyStruct lhs, MyStruct rhs)
+{
+ return MyStruct(lhs.value - rhs.value);
+}
+";
+
+ var expectedOutputContents = @"
+
+
+
+
+ int
+
+
+ void
+
+ int
+
+
+ value
+
+
+
+
+ MyStruct
+
+ MyStruct
+
+ return new MyStruct(value + rhs.value);
+
+
+
+
+ MyStruct
+
+ MyStruct
+
+
+ MyStruct
+
+ return new MyStruct(lhs.value - rhs.value);
+
+
+
+
+";
+
+ return ValidateBindingsAsync(inputContents, expectedOutputContents);
+ }
+
+ protected override Task OperatorCallTestImpl()
+ {
+ var inputContents = @"struct MyStruct
+{
+ int value;
+
+ MyStruct(int value) : value(value)
+ {
+ }
+
+ MyStruct operator+(MyStruct rhs)
+ {
+ return MyStruct(value + rhs.value);
+ }
+};
+
+MyStruct MyFunction1(MyStruct lhs, MyStruct rhs)
+{
+ return lhs + rhs;
+}
+
+MyStruct operator-(MyStruct lhs, MyStruct rhs)
+{
+ return MyStruct(lhs.value - rhs.value);
+}
+
+MyStruct MyFunction2(MyStruct lhs, MyStruct rhs)
+{
+ return lhs - rhs;
+}
+";
+
+ var expectedOutputContents = @"
+
+
+
+
+ int
+
+
+ void
+
+ int
+
+
+ value
+
+
+
+
+ MyStruct
+
+ MyStruct
+
+ return new MyStruct(value + rhs.value);
+
+
+
+
+ MyStruct
+
+ MyStruct
+
+
+ MyStruct
+
+ return lhs.Add(rhs);
+
+
+ MyStruct
+
+ MyStruct
+
+
+ MyStruct
+
+ return new MyStruct(lhs.value - rhs.value);
+
+
+ MyStruct
+
+ MyStruct
+
+
+ MyStruct
+
+ return Subtract(lhs, rhs);
+
+
+
+
+";
+
+ return ValidateBindingsAsync(inputContents, expectedOutputContents);
+ }
+
+ protected override Task ThisTestImpl()
+ {
+ var inputContents = @"struct MyStruct
+{
+ int value;
+
+ int MyFunction()
+ {
+ return this->value;
+ }
+};
+";
+
+ var expectedOutputContents = @"
+
+
+
+
+ int
+
+
+ int
+ return this.value;
+
+
+
+
+";
+
+ return ValidateBindingsAsync(inputContents, expectedOutputContents);
+ }
+
+ protected override Task UnsafeDoesNotImpactDllImportTestImpl()
+ {
+ var inputContents = @"struct MyStruct
+{
+ void* MyVoidStarMethod()
+ {
+ return nullptr;
+ }
+};
+
+extern ""C"" void MyFunction();";
+
+ var expectedOutputContents = @"
+
+
+
+
+ void*
+ return null;
+
+
+
+
+ void
+
+
+
+
";
return ValidateBindingsAsync(inputContents, expectedOutputContents);
diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleUnix/CXXMethodDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleUnix/CXXMethodDeclarationTest.cs
index 5a363544..509a92c0 100644
--- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleUnix/CXXMethodDeclarationTest.cs
+++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleUnix/CXXMethodDeclarationTest.cs
@@ -8,123 +8,8 @@
namespace ClangSharp.UnitTests;
[Platform("unix")]
-public sealed class CSharpCompatibleUnix_CXXMethodDeclarationTest : CXXMethodDeclarationTest
+public sealed class CSharpCompatibleUnix_CXXMethodDeclarationTest : CXXMethodDeclarationCSharpTest
{
- protected override Task ConstructorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int _value;
-
- MyStruct(int value)
- {
- _value = value;
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int _value;
-
- public MyStruct(int value)
- {
- _value = value;
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpCompatibleUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task ConstructorWithInitializeTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int _x;
- int _y;
- int _z;
-
- MyStruct(int x) : _x(x)
- {
- }
-
- MyStruct(int x, int y) : _x(x), _y(y)
- {
- }
-
- MyStruct(int x, int y, int z) : _x(x), _y(y), _z()
- {
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int _x;
-
- public int _y;
-
- public int _z;
-
- public MyStruct(int x)
- {
- _x = x;
- }
-
- public MyStruct(int x, int y)
- {
- _x = x;
- _y = y;
- }
-
- public MyStruct(int x, int y, int z)
- {
- _x = x;
- _y = y;
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpCompatibleUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task ConversionTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- operator int()
- {
- return value;
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public int ToInt32()
- {
- return value;
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpCompatibleUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task DefaultParameterInheritedFromTemplateTestImpl()
{
// NOTE: This is a regression test where a struct inherits a function from a template with a default parameter.
@@ -159,30 +44,6 @@ public unsafe partial struct MyStruct
return ValidateGeneratedCSharpCompatibleUnixBindingsAsync(InputContents, expectedOutputContents);
}
- protected override Task DestructorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- ~MyStruct()
- {
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public void Dispose()
- {
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpCompatibleUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task InstanceTestImpl()
{
var inputContents = @"struct MyStruct
@@ -239,209 +100,6 @@ public int MyInt32Method()
return ValidateGeneratedCSharpCompatibleUnixBindingsAsync(inputContents, expectedOutputContents);
}
- protected override Task MemberCallTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction1()
- {
- return value;
- }
-
- int MyFunction2()
- {
- return MyFunction1();
- }
-
- int MyFunction3()
- {
- return this->MyFunction1();
- }
-};
-
-int MyFunctionA(MyStruct x)
-{
- return x.MyFunction1();
-}
-
-int MyFunctionB(MyStruct* x)
-{
- return x->MyFunction2();
-}
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public int MyFunction1()
- {
- return value;
- }
-
- public int MyFunction2()
- {
- return MyFunction1();
- }
-
- public int MyFunction3()
- {
- return this.MyFunction1();
- }
- }
-
- public static unsafe partial class Methods
- {
- public static int MyFunctionA(MyStruct x)
- {
- return x.MyFunction1();
- }
-
- public static int MyFunctionB(MyStruct* x)
- {
- return x->MyFunction2();
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpCompatibleUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task MemberTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction()
- {
- return value;
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public int MyFunction()
- {
- return value;
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpCompatibleUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task NewKeywordTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int Equals() { return 0; }
- int Equals(int obj) { return 0; }
- int Dispose() { return 0; }
- int Dispose(int obj) { return 0; }
- int GetHashCode() { return 0; }
- int GetHashCode(int obj) { return 0; }
- int GetType() { return 0; }
- int GetType(int obj) { return 0; }
- int MemberwiseClone() { return 0; }
- int MemberwiseClone(int obj) { return 0; }
- int ReferenceEquals() { return 0; }
- int ReferenceEquals(int obj) { return 0; }
- int ToString() { return 0; }
- int ToString(int obj) { return 0; }
-};";
-
- var expectedOutputContents = $@"namespace ClangSharp.Test
-{{
- public partial struct MyStruct
- {{
- public int Equals()
- {{
- return 0;
- }}
-
- public int Equals(int obj)
- {{
- return 0;
- }}
-
- public int Dispose()
- {{
- return 0;
- }}
-
- public int Dispose(int obj)
- {{
- return 0;
- }}
-
- public new int GetHashCode()
- {{
- return 0;
- }}
-
- public int GetHashCode(int obj)
- {{
- return 0;
- }}
-
- public new int GetType()
- {{
- return 0;
- }}
-
- public int GetType(int obj)
- {{
- return 0;
- }}
-
- public new int MemberwiseClone()
- {{
- return 0;
- }}
-
- public int MemberwiseClone(int obj)
- {{
- return 0;
- }}
-
- public int ReferenceEquals()
- {{
- return 0;
- }}
-
- public int ReferenceEquals(int obj)
- {{
- return 0;
- }}
-
- public new int ToString()
- {{
- return 0;
- }}
-
- public int ToString(int obj)
- {{
- return 0;
- }}
- }}
-}}
-";
-
- return ValidateGeneratedCSharpCompatibleUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task NewKeywordVirtualTestImpl()
{
var inputContents = @"struct MyStruct
@@ -660,130 +318,6 @@ public partial struct Vtbl
return ValidateGeneratedCSharpCompatibleUnixBindingsAsync(inputContents, expectedOutputContents, PInvokeGeneratorConfigurationOptions.GenerateExplicitVtbls | PInvokeGeneratorConfigurationOptions.GenerateMarkerInterfaces);
}
- protected override Task OperatorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- MyStruct(int value) : value(value)
- {
- }
-
- MyStruct operator+(MyStruct rhs)
- {
- return MyStruct(value + rhs.value);
- }
-};
-
-MyStruct operator-(MyStruct lhs, MyStruct rhs)
-{
- return MyStruct(lhs.value - rhs.value);
-}
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public MyStruct(int value)
- {
- this.value = value;
- }
-
- public MyStruct Add(MyStruct rhs)
- {
- return new MyStruct(value + rhs.value);
- }
- }
-
- public static partial class Methods
- {
- public static MyStruct Subtract(MyStruct lhs, MyStruct rhs)
- {
- return new MyStruct(lhs.value - rhs.value);
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpCompatibleUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task OperatorCallTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- MyStruct(int value) : value(value)
- {
- }
-
- MyStruct operator+(MyStruct rhs)
- {
- return MyStruct(value + rhs.value);
- }
-};
-
-MyStruct MyFunction1(MyStruct lhs, MyStruct rhs)
-{
- return lhs + rhs;
-}
-
-MyStruct operator-(MyStruct lhs, MyStruct rhs)
-{
- return MyStruct(lhs.value - rhs.value);
-}
-
-MyStruct MyFunction2(MyStruct lhs, MyStruct rhs)
-{
- return lhs - rhs;
-}
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public MyStruct(int value)
- {
- this.value = value;
- }
-
- public MyStruct Add(MyStruct rhs)
- {
- return new MyStruct(value + rhs.value);
- }
- }
-
- public static partial class Methods
- {
- public static MyStruct MyFunction1(MyStruct lhs, MyStruct rhs)
- {
- return lhs.Add(rhs);
- }
-
- public static MyStruct Subtract(MyStruct lhs, MyStruct rhs)
- {
- return new MyStruct(lhs.value - rhs.value);
- }
-
- public static MyStruct MyFunction2(MyStruct lhs, MyStruct rhs)
- {
- return Subtract(lhs, rhs);
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpCompatibleUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task StaticTestImpl()
{
var inputContents = @"struct MyStruct
@@ -834,71 +368,6 @@ public static int MyInt32Method()
return ValidateGeneratedCSharpCompatibleUnixBindingsAsync(inputContents, expectedOutputContents);
}
- protected override Task ThisTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction()
- {
- return this->value;
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public int MyFunction()
- {
- return this.value;
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpCompatibleUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task UnsafeDoesNotImpactDllImportTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- void* MyVoidStarMethod()
- {
- return nullptr;
- }
-};
-
-extern ""C"" void MyFunction();";
-
- var expectedOutputContents = @"using System.Runtime.InteropServices;
-
-namespace ClangSharp.Test
-{
- public unsafe partial struct MyStruct
- {
- public void* MyVoidStarMethod()
- {
- return null;
- }
- }
-
- public static partial class Methods
- {
- [DllImport(""ClangSharpPInvokeGenerator"", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
- public static extern void MyFunction();
- }
-}
-";
-
- return ValidateGeneratedCSharpCompatibleUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task VirtualTestImpl()
{
var inputContents = @"struct MyStruct
diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleWindows/CXXMethodDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleWindows/CXXMethodDeclarationTest.cs
index 88bd0b5e..89527a39 100644
--- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleWindows/CXXMethodDeclarationTest.cs
+++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleWindows/CXXMethodDeclarationTest.cs
@@ -8,123 +8,8 @@
namespace ClangSharp.UnitTests;
[Platform("win")]
-public sealed class CSharpCompatibleWindows_CXXMethodDeclarationTest : CXXMethodDeclarationTest
+public sealed class CSharpCompatibleWindows_CXXMethodDeclarationTest : CXXMethodDeclarationCSharpTest
{
- protected override Task ConstructorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int _value;
-
- MyStruct(int value)
- {
- _value = value;
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int _value;
-
- public MyStruct(int value)
- {
- _value = value;
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpCompatibleWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task ConstructorWithInitializeTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int _x;
- int _y;
- int _z;
-
- MyStruct(int x) : _x(x)
- {
- }
-
- MyStruct(int x, int y) : _x(x), _y(y)
- {
- }
-
- MyStruct(int x, int y, int z) : _x(x), _y(y), _z()
- {
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int _x;
-
- public int _y;
-
- public int _z;
-
- public MyStruct(int x)
- {
- _x = x;
- }
-
- public MyStruct(int x, int y)
- {
- _x = x;
- _y = y;
- }
-
- public MyStruct(int x, int y, int z)
- {
- _x = x;
- _y = y;
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpCompatibleWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task ConversionTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- operator int()
- {
- return value;
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public int ToInt32()
- {
- return value;
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpCompatibleWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task DefaultParameterInheritedFromTemplateTestImpl()
{
// NOTE: This is a regression test where a struct inherits a function from a template with a default parameter.
@@ -159,30 +44,6 @@ public unsafe partial struct MyStruct
return ValidateGeneratedCSharpCompatibleWindowsBindingsAsync(InputContents, expectedOutputContents);
}
- protected override Task DestructorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- ~MyStruct()
- {
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public void Dispose()
- {
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpCompatibleWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task InstanceTestImpl()
{
var inputContents = @"struct MyStruct
@@ -234,209 +95,6 @@ public int MyInt32Method()
return ValidateGeneratedCSharpCompatibleWindowsBindingsAsync(inputContents, expectedOutputContents);
}
- protected override Task MemberCallTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction1()
- {
- return value;
- }
-
- int MyFunction2()
- {
- return MyFunction1();
- }
-
- int MyFunction3()
- {
- return this->MyFunction1();
- }
-};
-
-int MyFunctionA(MyStruct x)
-{
- return x.MyFunction1();
-}
-
-int MyFunctionB(MyStruct* x)
-{
- return x->MyFunction2();
-}
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public int MyFunction1()
- {
- return value;
- }
-
- public int MyFunction2()
- {
- return MyFunction1();
- }
-
- public int MyFunction3()
- {
- return this.MyFunction1();
- }
- }
-
- public static unsafe partial class Methods
- {
- public static int MyFunctionA(MyStruct x)
- {
- return x.MyFunction1();
- }
-
- public static int MyFunctionB(MyStruct* x)
- {
- return x->MyFunction2();
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpCompatibleWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task MemberTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction()
- {
- return value;
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public int MyFunction()
- {
- return value;
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpCompatibleWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task NewKeywordTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int Equals() { return 0; }
- int Equals(int obj) { return 0; }
- int Dispose() { return 0; }
- int Dispose(int obj) { return 0; }
- int GetHashCode() { return 0; }
- int GetHashCode(int obj) { return 0; }
- int GetType() { return 0; }
- int GetType(int obj) { return 0; }
- int MemberwiseClone() { return 0; }
- int MemberwiseClone(int obj) { return 0; }
- int ReferenceEquals() { return 0; }
- int ReferenceEquals(int obj) { return 0; }
- int ToString() { return 0; }
- int ToString(int obj) { return 0; }
-};";
-
- var expectedOutputContents = $@"namespace ClangSharp.Test
-{{
- public partial struct MyStruct
- {{
- public int Equals()
- {{
- return 0;
- }}
-
- public int Equals(int obj)
- {{
- return 0;
- }}
-
- public int Dispose()
- {{
- return 0;
- }}
-
- public int Dispose(int obj)
- {{
- return 0;
- }}
-
- public new int GetHashCode()
- {{
- return 0;
- }}
-
- public int GetHashCode(int obj)
- {{
- return 0;
- }}
-
- public new int GetType()
- {{
- return 0;
- }}
-
- public int GetType(int obj)
- {{
- return 0;
- }}
-
- public new int MemberwiseClone()
- {{
- return 0;
- }}
-
- public int MemberwiseClone(int obj)
- {{
- return 0;
- }}
-
- public int ReferenceEquals()
- {{
- return 0;
- }}
-
- public int ReferenceEquals(int obj)
- {{
- return 0;
- }}
-
- public new int ToString()
- {{
- return 0;
- }}
-
- public int ToString(int obj)
- {{
- return 0;
- }}
- }}
-}}
-";
-
- return ValidateGeneratedCSharpCompatibleWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task NewKeywordVirtualTestImpl()
{
var inputContents = @"struct MyStruct
@@ -655,130 +313,6 @@ public partial struct Vtbl
return ValidateGeneratedCSharpCompatibleWindowsBindingsAsync(inputContents, expectedOutputContents, PInvokeGeneratorConfigurationOptions.GenerateExplicitVtbls | PInvokeGeneratorConfigurationOptions.GenerateMarkerInterfaces);
}
- protected override Task OperatorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- MyStruct(int value) : value(value)
- {
- }
-
- MyStruct operator+(MyStruct rhs)
- {
- return MyStruct(value + rhs.value);
- }
-};
-
-MyStruct operator-(MyStruct lhs, MyStruct rhs)
-{
- return MyStruct(lhs.value - rhs.value);
-}
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public MyStruct(int value)
- {
- this.value = value;
- }
-
- public MyStruct Add(MyStruct rhs)
- {
- return new MyStruct(value + rhs.value);
- }
- }
-
- public static partial class Methods
- {
- public static MyStruct Subtract(MyStruct lhs, MyStruct rhs)
- {
- return new MyStruct(lhs.value - rhs.value);
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpCompatibleWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task OperatorCallTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- MyStruct(int value) : value(value)
- {
- }
-
- MyStruct operator+(MyStruct rhs)
- {
- return MyStruct(value + rhs.value);
- }
-};
-
-MyStruct MyFunction1(MyStruct lhs, MyStruct rhs)
-{
- return lhs + rhs;
-}
-
-MyStruct operator-(MyStruct lhs, MyStruct rhs)
-{
- return MyStruct(lhs.value - rhs.value);
-}
-
-MyStruct MyFunction2(MyStruct lhs, MyStruct rhs)
-{
- return lhs - rhs;
-}
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public MyStruct(int value)
- {
- this.value = value;
- }
-
- public MyStruct Add(MyStruct rhs)
- {
- return new MyStruct(value + rhs.value);
- }
- }
-
- public static partial class Methods
- {
- public static MyStruct MyFunction1(MyStruct lhs, MyStruct rhs)
- {
- return lhs.Add(rhs);
- }
-
- public static MyStruct Subtract(MyStruct lhs, MyStruct rhs)
- {
- return new MyStruct(lhs.value - rhs.value);
- }
-
- public static MyStruct MyFunction2(MyStruct lhs, MyStruct rhs)
- {
- return Subtract(lhs, rhs);
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpCompatibleWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task StaticTestImpl()
{
var inputContents = @"struct MyStruct
@@ -829,71 +363,6 @@ public static int MyInt32Method()
return ValidateGeneratedCSharpCompatibleWindowsBindingsAsync(inputContents, expectedOutputContents);
}
- protected override Task ThisTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction()
- {
- return this->value;
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public int MyFunction()
- {
- return this.value;
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpCompatibleWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task UnsafeDoesNotImpactDllImportTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- void* MyVoidStarMethod()
- {
- return nullptr;
- }
-};
-
-extern ""C"" void MyFunction();";
-
- var expectedOutputContents = @"using System.Runtime.InteropServices;
-
-namespace ClangSharp.Test
-{
- public unsafe partial struct MyStruct
- {
- public void* MyVoidStarMethod()
- {
- return null;
- }
- }
-
- public static partial class Methods
- {
- [DllImport(""ClangSharpPInvokeGenerator"", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
- public static extern void MyFunction();
- }
-}
-";
-
- return ValidateGeneratedCSharpCompatibleWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task VirtualTestImpl()
{
var inputContents = @"struct MyStruct
diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpDefaultUnix/CXXMethodDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpDefaultUnix/CXXMethodDeclarationTest.cs
index 9049cd5d..d06fc90a 100644
--- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpDefaultUnix/CXXMethodDeclarationTest.cs
+++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpDefaultUnix/CXXMethodDeclarationTest.cs
@@ -8,123 +8,8 @@
namespace ClangSharp.UnitTests;
[Platform("unix")]
-public sealed class CSharpDefaultUnix_CXXMethodDeclarationTest : CXXMethodDeclarationTest
+public sealed class CSharpDefaultUnix_CXXMethodDeclarationTest : CXXMethodDeclarationCSharpTest
{
- protected override Task ConstructorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int _value;
-
- MyStruct(int value)
- {
- _value = value;
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int _value;
-
- public MyStruct(int value)
- {
- _value = value;
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpDefaultUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task ConstructorWithInitializeTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int _x;
- int _y;
- int _z;
-
- MyStruct(int x) : _x(x)
- {
- }
-
- MyStruct(int x, int y) : _x(x), _y(y)
- {
- }
-
- MyStruct(int x, int y, int z) : _x(x), _y(y), _z()
- {
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int _x;
-
- public int _y;
-
- public int _z;
-
- public MyStruct(int x)
- {
- _x = x;
- }
-
- public MyStruct(int x, int y)
- {
- _x = x;
- _y = y;
- }
-
- public MyStruct(int x, int y, int z)
- {
- _x = x;
- _y = y;
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpDefaultUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task ConversionTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- operator int()
- {
- return value;
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public int ToInt32()
- {
- return value;
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpDefaultUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task DefaultParameterInheritedFromTemplateTestImpl()
{
// NOTE: This is a regression test where a struct inherits a function from a template with a default parameter.
@@ -159,30 +44,6 @@ public unsafe partial struct MyStruct
return ValidateGeneratedCSharpDefaultUnixBindingsAsync(InputContents, expectedOutputContents);
}
- protected override Task DestructorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- ~MyStruct()
- {
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public void Dispose()
- {
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpDefaultUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task InstanceTestImpl()
{
var inputContents = @"struct MyStruct
@@ -234,209 +95,6 @@ public int MyInt32Method()
return ValidateGeneratedCSharpDefaultUnixBindingsAsync(inputContents, expectedOutputContents);
}
- protected override Task MemberCallTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction1()
- {
- return value;
- }
-
- int MyFunction2()
- {
- return MyFunction1();
- }
-
- int MyFunction3()
- {
- return this->MyFunction1();
- }
-};
-
-int MyFunctionA(MyStruct x)
-{
- return x.MyFunction1();
-}
-
-int MyFunctionB(MyStruct* x)
-{
- return x->MyFunction2();
-}
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public int MyFunction1()
- {
- return value;
- }
-
- public int MyFunction2()
- {
- return MyFunction1();
- }
-
- public int MyFunction3()
- {
- return this.MyFunction1();
- }
- }
-
- public static unsafe partial class Methods
- {
- public static int MyFunctionA(MyStruct x)
- {
- return x.MyFunction1();
- }
-
- public static int MyFunctionB(MyStruct* x)
- {
- return x->MyFunction2();
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpDefaultUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task MemberTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction()
- {
- return value;
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public int MyFunction()
- {
- return value;
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpDefaultUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task NewKeywordTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int Equals() { return 0; }
- int Equals(int obj) { return 0; }
- int Dispose() { return 0; }
- int Dispose(int obj) { return 0; }
- int GetHashCode() { return 0; }
- int GetHashCode(int obj) { return 0; }
- int GetType() { return 0; }
- int GetType(int obj) { return 0; }
- int MemberwiseClone() { return 0; }
- int MemberwiseClone(int obj) { return 0; }
- int ReferenceEquals() { return 0; }
- int ReferenceEquals(int obj) { return 0; }
- int ToString() { return 0; }
- int ToString(int obj) { return 0; }
-};";
-
- var expectedOutputContents = $@"namespace ClangSharp.Test
-{{
- public partial struct MyStruct
- {{
- public int Equals()
- {{
- return 0;
- }}
-
- public int Equals(int obj)
- {{
- return 0;
- }}
-
- public int Dispose()
- {{
- return 0;
- }}
-
- public int Dispose(int obj)
- {{
- return 0;
- }}
-
- public new int GetHashCode()
- {{
- return 0;
- }}
-
- public int GetHashCode(int obj)
- {{
- return 0;
- }}
-
- public new int GetType()
- {{
- return 0;
- }}
-
- public int GetType(int obj)
- {{
- return 0;
- }}
-
- public new int MemberwiseClone()
- {{
- return 0;
- }}
-
- public int MemberwiseClone(int obj)
- {{
- return 0;
- }}
-
- public int ReferenceEquals()
- {{
- return 0;
- }}
-
- public int ReferenceEquals(int obj)
- {{
- return 0;
- }}
-
- public new int ToString()
- {{
- return 0;
- }}
-
- public int ToString(int obj)
- {{
- return 0;
- }}
- }}
-}}
-";
-
- return ValidateGeneratedCSharpDefaultUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task NewKeywordVirtualTestImpl()
{
var inputContents = @"struct MyStruct
@@ -599,130 +257,6 @@ public partial struct Vtbl
return ValidateGeneratedCSharpDefaultUnixBindingsAsync(inputContents, expectedOutputContents, PInvokeGeneratorConfigurationOptions.GenerateExplicitVtbls | PInvokeGeneratorConfigurationOptions.GenerateMarkerInterfaces);
}
- protected override Task OperatorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- MyStruct(int value) : value(value)
- {
- }
-
- MyStruct operator+(MyStruct rhs)
- {
- return MyStruct(value + rhs.value);
- }
-};
-
-MyStruct operator-(MyStruct lhs, MyStruct rhs)
-{
- return MyStruct(lhs.value - rhs.value);
-}
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public MyStruct(int value)
- {
- this.value = value;
- }
-
- public MyStruct Add(MyStruct rhs)
- {
- return new MyStruct(value + rhs.value);
- }
- }
-
- public static partial class Methods
- {
- public static MyStruct Subtract(MyStruct lhs, MyStruct rhs)
- {
- return new MyStruct(lhs.value - rhs.value);
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpDefaultUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task OperatorCallTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- MyStruct(int value) : value(value)
- {
- }
-
- MyStruct operator+(MyStruct rhs)
- {
- return MyStruct(value + rhs.value);
- }
-};
-
-MyStruct MyFunction1(MyStruct lhs, MyStruct rhs)
-{
- return lhs + rhs;
-}
-
-MyStruct operator-(MyStruct lhs, MyStruct rhs)
-{
- return MyStruct(lhs.value - rhs.value);
-}
-
-MyStruct MyFunction2(MyStruct lhs, MyStruct rhs)
-{
- return lhs - rhs;
-}
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public MyStruct(int value)
- {
- this.value = value;
- }
-
- public MyStruct Add(MyStruct rhs)
- {
- return new MyStruct(value + rhs.value);
- }
- }
-
- public static partial class Methods
- {
- public static MyStruct MyFunction1(MyStruct lhs, MyStruct rhs)
- {
- return lhs.Add(rhs);
- }
-
- public static MyStruct Subtract(MyStruct lhs, MyStruct rhs)
- {
- return new MyStruct(lhs.value - rhs.value);
- }
-
- public static MyStruct MyFunction2(MyStruct lhs, MyStruct rhs)
- {
- return Subtract(lhs, rhs);
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpDefaultUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task StaticTestImpl()
{
var inputContents = @"struct MyStruct
@@ -773,71 +307,6 @@ public static int MyInt32Method()
return ValidateGeneratedCSharpDefaultUnixBindingsAsync(inputContents, expectedOutputContents);
}
- protected override Task ThisTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction()
- {
- return this->value;
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public int MyFunction()
- {
- return this.value;
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpDefaultUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task UnsafeDoesNotImpactDllImportTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- void* MyVoidStarMethod()
- {
- return nullptr;
- }
-};
-
-extern ""C"" void MyFunction();";
-
- var expectedOutputContents = @"using System.Runtime.InteropServices;
-
-namespace ClangSharp.Test
-{
- public unsafe partial struct MyStruct
- {
- public void* MyVoidStarMethod()
- {
- return null;
- }
- }
-
- public static partial class Methods
- {
- [DllImport(""ClangSharpPInvokeGenerator"", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
- public static extern void MyFunction();
- }
-}
-";
-
- return ValidateGeneratedCSharpDefaultUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task VirtualTestImpl()
{
var inputContents = @"struct MyStruct
diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpDefaultWindows/CXXMethodDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpDefaultWindows/CXXMethodDeclarationTest.cs
index a668f2c1..3b6c0c73 100644
--- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpDefaultWindows/CXXMethodDeclarationTest.cs
+++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpDefaultWindows/CXXMethodDeclarationTest.cs
@@ -8,123 +8,8 @@
namespace ClangSharp.UnitTests;
[Platform("win")]
-public sealed class CSharpDefaultWindows_CXXMethodDeclarationTest : CXXMethodDeclarationTest
+public sealed class CSharpDefaultWindows_CXXMethodDeclarationTest : CXXMethodDeclarationCSharpTest
{
- protected override Task ConstructorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int _value;
-
- MyStruct(int value)
- {
- _value = value;
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int _value;
-
- public MyStruct(int value)
- {
- _value = value;
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpDefaultWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task ConstructorWithInitializeTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int _x;
- int _y;
- int _z;
-
- MyStruct(int x) : _x(x)
- {
- }
-
- MyStruct(int x, int y) : _x(x), _y(y)
- {
- }
-
- MyStruct(int x, int y, int z) : _x(x), _y(y), _z()
- {
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int _x;
-
- public int _y;
-
- public int _z;
-
- public MyStruct(int x)
- {
- _x = x;
- }
-
- public MyStruct(int x, int y)
- {
- _x = x;
- _y = y;
- }
-
- public MyStruct(int x, int y, int z)
- {
- _x = x;
- _y = y;
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpDefaultWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task ConversionTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- operator int()
- {
- return value;
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public int ToInt32()
- {
- return value;
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpDefaultWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task DefaultParameterInheritedFromTemplateTestImpl()
{
// NOTE: This is a regression test where a struct inherits a function from a template with a default parameter.
@@ -159,30 +44,6 @@ public unsafe partial struct MyStruct
return ValidateGeneratedCSharpDefaultWindowsBindingsAsync(InputContents, expectedOutputContents);
}
- protected override Task DestructorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- ~MyStruct()
- {
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public void Dispose()
- {
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpDefaultWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task InstanceTestImpl()
{
var inputContents = @"struct MyStruct
@@ -239,209 +100,6 @@ public int MyInt32Method()
return ValidateGeneratedCSharpDefaultWindowsBindingsAsync(inputContents, expectedOutputContents);
}
- protected override Task MemberCallTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction1()
- {
- return value;
- }
-
- int MyFunction2()
- {
- return MyFunction1();
- }
-
- int MyFunction3()
- {
- return this->MyFunction1();
- }
-};
-
-int MyFunctionA(MyStruct x)
-{
- return x.MyFunction1();
-}
-
-int MyFunctionB(MyStruct* x)
-{
- return x->MyFunction2();
-}
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public int MyFunction1()
- {
- return value;
- }
-
- public int MyFunction2()
- {
- return MyFunction1();
- }
-
- public int MyFunction3()
- {
- return this.MyFunction1();
- }
- }
-
- public static unsafe partial class Methods
- {
- public static int MyFunctionA(MyStruct x)
- {
- return x.MyFunction1();
- }
-
- public static int MyFunctionB(MyStruct* x)
- {
- return x->MyFunction2();
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpDefaultWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task MemberTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction()
- {
- return value;
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public int MyFunction()
- {
- return value;
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpDefaultWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task NewKeywordTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int Equals() { return 0; }
- int Equals(int obj) { return 0; }
- int Dispose() { return 0; }
- int Dispose(int obj) { return 0; }
- int GetHashCode() { return 0; }
- int GetHashCode(int obj) { return 0; }
- int GetType() { return 0; }
- int GetType(int obj) { return 0; }
- int MemberwiseClone() { return 0; }
- int MemberwiseClone(int obj) { return 0; }
- int ReferenceEquals() { return 0; }
- int ReferenceEquals(int obj) { return 0; }
- int ToString() { return 0; }
- int ToString(int obj) { return 0; }
-};";
-
- var expectedOutputContents = $@"namespace ClangSharp.Test
-{{
- public partial struct MyStruct
- {{
- public int Equals()
- {{
- return 0;
- }}
-
- public int Equals(int obj)
- {{
- return 0;
- }}
-
- public int Dispose()
- {{
- return 0;
- }}
-
- public int Dispose(int obj)
- {{
- return 0;
- }}
-
- public new int GetHashCode()
- {{
- return 0;
- }}
-
- public int GetHashCode(int obj)
- {{
- return 0;
- }}
-
- public new int GetType()
- {{
- return 0;
- }}
-
- public int GetType(int obj)
- {{
- return 0;
- }}
-
- public new int MemberwiseClone()
- {{
- return 0;
- }}
-
- public int MemberwiseClone(int obj)
- {{
- return 0;
- }}
-
- public int ReferenceEquals()
- {{
- return 0;
- }}
-
- public int ReferenceEquals(int obj)
- {{
- return 0;
- }}
-
- public new int ToString()
- {{
- return 0;
- }}
-
- public int ToString(int obj)
- {{
- return 0;
- }}
- }}
-}}
-";
-
- return ValidateGeneratedCSharpDefaultWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task NewKeywordVirtualTestImpl()
{
var inputContents = @"struct MyStruct
@@ -604,130 +262,6 @@ public partial struct Vtbl
return ValidateGeneratedCSharpDefaultWindowsBindingsAsync(inputContents, expectedOutputContents, PInvokeGeneratorConfigurationOptions.GenerateExplicitVtbls | PInvokeGeneratorConfigurationOptions.GenerateMarkerInterfaces);
}
- protected override Task OperatorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- MyStruct(int value) : value(value)
- {
- }
-
- MyStruct operator+(MyStruct rhs)
- {
- return MyStruct(value + rhs.value);
- }
-};
-
-MyStruct operator-(MyStruct lhs, MyStruct rhs)
-{
- return MyStruct(lhs.value - rhs.value);
-}
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public MyStruct(int value)
- {
- this.value = value;
- }
-
- public MyStruct Add(MyStruct rhs)
- {
- return new MyStruct(value + rhs.value);
- }
- }
-
- public static partial class Methods
- {
- public static MyStruct Subtract(MyStruct lhs, MyStruct rhs)
- {
- return new MyStruct(lhs.value - rhs.value);
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpDefaultWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task OperatorCallTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- MyStruct(int value) : value(value)
- {
- }
-
- MyStruct operator+(MyStruct rhs)
- {
- return MyStruct(value + rhs.value);
- }
-};
-
-MyStruct MyFunction1(MyStruct lhs, MyStruct rhs)
-{
- return lhs + rhs;
-}
-
-MyStruct operator-(MyStruct lhs, MyStruct rhs)
-{
- return MyStruct(lhs.value - rhs.value);
-}
-
-MyStruct MyFunction2(MyStruct lhs, MyStruct rhs)
-{
- return lhs - rhs;
-}
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public MyStruct(int value)
- {
- this.value = value;
- }
-
- public MyStruct Add(MyStruct rhs)
- {
- return new MyStruct(value + rhs.value);
- }
- }
-
- public static partial class Methods
- {
- public static MyStruct MyFunction1(MyStruct lhs, MyStruct rhs)
- {
- return lhs.Add(rhs);
- }
-
- public static MyStruct Subtract(MyStruct lhs, MyStruct rhs)
- {
- return new MyStruct(lhs.value - rhs.value);
- }
-
- public static MyStruct MyFunction2(MyStruct lhs, MyStruct rhs)
- {
- return Subtract(lhs, rhs);
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpDefaultWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task StaticTestImpl()
{
var inputContents = @"struct MyStruct
@@ -778,71 +312,6 @@ public static int MyInt32Method()
return ValidateGeneratedCSharpDefaultWindowsBindingsAsync(inputContents, expectedOutputContents);
}
- protected override Task ThisTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction()
- {
- return this->value;
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public int MyFunction()
- {
- return this.value;
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpDefaultWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task UnsafeDoesNotImpactDllImportTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- void* MyVoidStarMethod()
- {
- return nullptr;
- }
-};
-
-extern ""C"" void MyFunction();";
-
- var expectedOutputContents = @"using System.Runtime.InteropServices;
-
-namespace ClangSharp.Test
-{
- public unsafe partial struct MyStruct
- {
- public void* MyVoidStarMethod()
- {
- return null;
- }
- }
-
- public static partial class Methods
- {
- [DllImport(""ClangSharpPInvokeGenerator"", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
- public static extern void MyFunction();
- }
-}
-";
-
- return ValidateGeneratedCSharpDefaultWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task VirtualTestImpl()
{
var inputContents = @"struct MyStruct
diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestUnix/CXXMethodDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestUnix/CXXMethodDeclarationTest.cs
index 6d422c23..a3b7736d 100644
--- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestUnix/CXXMethodDeclarationTest.cs
+++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestUnix/CXXMethodDeclarationTest.cs
@@ -8,123 +8,8 @@
namespace ClangSharp.UnitTests;
[Platform("unix")]
-public sealed class CSharpLatestUnix_CXXMethodDeclarationTest : CXXMethodDeclarationTest
+public sealed class CSharpLatestUnix_CXXMethodDeclarationTest : CXXMethodDeclarationCSharpTest
{
- protected override Task ConstructorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int _value;
-
- MyStruct(int value)
- {
- _value = value;
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int _value;
-
- public MyStruct(int value)
- {
- _value = value;
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpLatestUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task ConstructorWithInitializeTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int _x;
- int _y;
- int _z;
-
- MyStruct(int x) : _x(x)
- {
- }
-
- MyStruct(int x, int y) : _x(x), _y(y)
- {
- }
-
- MyStruct(int x, int y, int z) : _x(x), _y(y), _z()
- {
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int _x;
-
- public int _y;
-
- public int _z;
-
- public MyStruct(int x)
- {
- _x = x;
- }
-
- public MyStruct(int x, int y)
- {
- _x = x;
- _y = y;
- }
-
- public MyStruct(int x, int y, int z)
- {
- _x = x;
- _y = y;
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpLatestUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task ConversionTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- operator int()
- {
- return value;
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public int ToInt32()
- {
- return value;
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpLatestUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task DefaultParameterInheritedFromTemplateTestImpl()
{
// NOTE: This is a regression test where a struct inherits a function from a template with a default parameter.
@@ -159,30 +44,6 @@ public unsafe partial struct MyStruct
return ValidateGeneratedCSharpLatestUnixBindingsAsync(InputContents, expectedOutputContents);
}
- protected override Task DestructorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- ~MyStruct()
- {
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public void Dispose()
- {
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpLatestUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task InstanceTestImpl()
{
var inputContents = @"struct MyStruct
@@ -234,209 +95,6 @@ public int MyInt32Method()
return ValidateGeneratedCSharpLatestUnixBindingsAsync(inputContents, expectedOutputContents);
}
- protected override Task MemberCallTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction1()
- {
- return value;
- }
-
- int MyFunction2()
- {
- return MyFunction1();
- }
-
- int MyFunction3()
- {
- return this->MyFunction1();
- }
-};
-
-int MyFunctionA(MyStruct x)
-{
- return x.MyFunction1();
-}
-
-int MyFunctionB(MyStruct* x)
-{
- return x->MyFunction2();
-}
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public int MyFunction1()
- {
- return value;
- }
-
- public int MyFunction2()
- {
- return MyFunction1();
- }
-
- public int MyFunction3()
- {
- return this.MyFunction1();
- }
- }
-
- public static unsafe partial class Methods
- {
- public static int MyFunctionA(MyStruct x)
- {
- return x.MyFunction1();
- }
-
- public static int MyFunctionB(MyStruct* x)
- {
- return x->MyFunction2();
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpLatestUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task MemberTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction()
- {
- return value;
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public int MyFunction()
- {
- return value;
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpLatestUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task NewKeywordTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int Equals() { return 0; }
- int Equals(int obj) { return 0; }
- int Dispose() { return 0; }
- int Dispose(int obj) { return 0; }
- int GetHashCode() { return 0; }
- int GetHashCode(int obj) { return 0; }
- int GetType() { return 0; }
- int GetType(int obj) { return 0; }
- int MemberwiseClone() { return 0; }
- int MemberwiseClone(int obj) { return 0; }
- int ReferenceEquals() { return 0; }
- int ReferenceEquals(int obj) { return 0; }
- int ToString() { return 0; }
- int ToString(int obj) { return 0; }
-};";
-
- var expectedOutputContents = $@"namespace ClangSharp.Test
-{{
- public partial struct MyStruct
- {{
- public int Equals()
- {{
- return 0;
- }}
-
- public int Equals(int obj)
- {{
- return 0;
- }}
-
- public int Dispose()
- {{
- return 0;
- }}
-
- public int Dispose(int obj)
- {{
- return 0;
- }}
-
- public new int GetHashCode()
- {{
- return 0;
- }}
-
- public int GetHashCode(int obj)
- {{
- return 0;
- }}
-
- public new int GetType()
- {{
- return 0;
- }}
-
- public int GetType(int obj)
- {{
- return 0;
- }}
-
- public new int MemberwiseClone()
- {{
- return 0;
- }}
-
- public int MemberwiseClone(int obj)
- {{
- return 0;
- }}
-
- public int ReferenceEquals()
- {{
- return 0;
- }}
-
- public int ReferenceEquals(int obj)
- {{
- return 0;
- }}
-
- public new int ToString()
- {{
- return 0;
- }}
-
- public int ToString(int obj)
- {{
- return 0;
- }}
- }}
-}}
-";
-
- return ValidateGeneratedCSharpLatestUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task NewKeywordVirtualTestImpl()
{
var inputContents = @"struct MyStruct
@@ -599,130 +257,6 @@ public partial struct Vtbl
return ValidateGeneratedCSharpLatestUnixBindingsAsync(inputContents, expectedOutputContents, PInvokeGeneratorConfigurationOptions.GenerateExplicitVtbls | PInvokeGeneratorConfigurationOptions.GenerateMarkerInterfaces);
}
- protected override Task OperatorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- MyStruct(int value) : value(value)
- {
- }
-
- MyStruct operator+(MyStruct rhs)
- {
- return MyStruct(value + rhs.value);
- }
-};
-
-MyStruct operator-(MyStruct lhs, MyStruct rhs)
-{
- return MyStruct(lhs.value - rhs.value);
-}
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public MyStruct(int value)
- {
- this.value = value;
- }
-
- public MyStruct Add(MyStruct rhs)
- {
- return new MyStruct(value + rhs.value);
- }
- }
-
- public static partial class Methods
- {
- public static MyStruct Subtract(MyStruct lhs, MyStruct rhs)
- {
- return new MyStruct(lhs.value - rhs.value);
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpLatestUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task OperatorCallTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- MyStruct(int value) : value(value)
- {
- }
-
- MyStruct operator+(MyStruct rhs)
- {
- return MyStruct(value + rhs.value);
- }
-};
-
-MyStruct MyFunction1(MyStruct lhs, MyStruct rhs)
-{
- return lhs + rhs;
-}
-
-MyStruct operator-(MyStruct lhs, MyStruct rhs)
-{
- return MyStruct(lhs.value - rhs.value);
-}
-
-MyStruct MyFunction2(MyStruct lhs, MyStruct rhs)
-{
- return lhs - rhs;
-}
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public MyStruct(int value)
- {
- this.value = value;
- }
-
- public MyStruct Add(MyStruct rhs)
- {
- return new MyStruct(value + rhs.value);
- }
- }
-
- public static partial class Methods
- {
- public static MyStruct MyFunction1(MyStruct lhs, MyStruct rhs)
- {
- return lhs.Add(rhs);
- }
-
- public static MyStruct Subtract(MyStruct lhs, MyStruct rhs)
- {
- return new MyStruct(lhs.value - rhs.value);
- }
-
- public static MyStruct MyFunction2(MyStruct lhs, MyStruct rhs)
- {
- return Subtract(lhs, rhs);
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpLatestUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task StaticTestImpl()
{
var inputContents = @"struct MyStruct
@@ -773,71 +307,6 @@ public static int MyInt32Method()
return ValidateGeneratedCSharpLatestUnixBindingsAsync(inputContents, expectedOutputContents);
}
- protected override Task ThisTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction()
- {
- return this->value;
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public int MyFunction()
- {
- return this.value;
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpLatestUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task UnsafeDoesNotImpactDllImportTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- void* MyVoidStarMethod()
- {
- return nullptr;
- }
-};
-
-extern ""C"" void MyFunction();";
-
- var expectedOutputContents = @"using System.Runtime.InteropServices;
-
-namespace ClangSharp.Test
-{
- public unsafe partial struct MyStruct
- {
- public void* MyVoidStarMethod()
- {
- return null;
- }
- }
-
- public static partial class Methods
- {
- [DllImport(""ClangSharpPInvokeGenerator"", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
- public static extern void MyFunction();
- }
-}
-";
-
- return ValidateGeneratedCSharpLatestUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task VirtualTestImpl()
{
var inputContents = @"struct MyStruct
diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestWindows/CXXMethodDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestWindows/CXXMethodDeclarationTest.cs
index 731613c9..f4ed0603 100644
--- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestWindows/CXXMethodDeclarationTest.cs
+++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestWindows/CXXMethodDeclarationTest.cs
@@ -8,123 +8,8 @@
namespace ClangSharp.UnitTests;
[Platform("win")]
-public sealed class CSharpLatestWindows_CXXMethodDeclarationTest : CXXMethodDeclarationTest
+public sealed class CSharpLatestWindows_CXXMethodDeclarationTest : CXXMethodDeclarationCSharpTest
{
- protected override Task ConstructorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int _value;
-
- MyStruct(int value)
- {
- _value = value;
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int _value;
-
- public MyStruct(int value)
- {
- _value = value;
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpLatestWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task ConstructorWithInitializeTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int _x;
- int _y;
- int _z;
-
- MyStruct(int x) : _x(x)
- {
- }
-
- MyStruct(int x, int y) : _x(x), _y(y)
- {
- }
-
- MyStruct(int x, int y, int z) : _x(x), _y(y), _z()
- {
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int _x;
-
- public int _y;
-
- public int _z;
-
- public MyStruct(int x)
- {
- _x = x;
- }
-
- public MyStruct(int x, int y)
- {
- _x = x;
- _y = y;
- }
-
- public MyStruct(int x, int y, int z)
- {
- _x = x;
- _y = y;
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpLatestWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task ConversionTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- operator int()
- {
- return value;
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public int ToInt32()
- {
- return value;
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpLatestWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task DefaultParameterInheritedFromTemplateTestImpl()
{
// NOTE: This is a regression test where a struct inherits a function from a template with a default parameter.
@@ -159,30 +44,6 @@ public unsafe partial struct MyStruct
return ValidateGeneratedCSharpLatestWindowsBindingsAsync(InputContents, expectedOutputContents);
}
- protected override Task DestructorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- ~MyStruct()
- {
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public void Dispose()
- {
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpLatestWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task InstanceTestImpl()
{
var inputContents = @"struct MyStruct
@@ -234,209 +95,6 @@ public int MyInt32Method()
return ValidateGeneratedCSharpLatestWindowsBindingsAsync(inputContents, expectedOutputContents);
}
- protected override Task MemberCallTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction1()
- {
- return value;
- }
-
- int MyFunction2()
- {
- return MyFunction1();
- }
-
- int MyFunction3()
- {
- return this->MyFunction1();
- }
-};
-
-int MyFunctionA(MyStruct x)
-{
- return x.MyFunction1();
-}
-
-int MyFunctionB(MyStruct* x)
-{
- return x->MyFunction2();
-}
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public int MyFunction1()
- {
- return value;
- }
-
- public int MyFunction2()
- {
- return MyFunction1();
- }
-
- public int MyFunction3()
- {
- return this.MyFunction1();
- }
- }
-
- public static unsafe partial class Methods
- {
- public static int MyFunctionA(MyStruct x)
- {
- return x.MyFunction1();
- }
-
- public static int MyFunctionB(MyStruct* x)
- {
- return x->MyFunction2();
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpLatestWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task MemberTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction()
- {
- return value;
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public int MyFunction()
- {
- return value;
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpLatestWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task NewKeywordTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int Equals() { return 0; }
- int Equals(int obj) { return 0; }
- int Dispose() { return 0; }
- int Dispose(int obj) { return 0; }
- int GetHashCode() { return 0; }
- int GetHashCode(int obj) { return 0; }
- int GetType() { return 0; }
- int GetType(int obj) { return 0; }
- int MemberwiseClone() { return 0; }
- int MemberwiseClone(int obj) { return 0; }
- int ReferenceEquals() { return 0; }
- int ReferenceEquals(int obj) { return 0; }
- int ToString() { return 0; }
- int ToString(int obj) { return 0; }
-};";
-
- var expectedOutputContents = $@"namespace ClangSharp.Test
-{{
- public partial struct MyStruct
- {{
- public int Equals()
- {{
- return 0;
- }}
-
- public int Equals(int obj)
- {{
- return 0;
- }}
-
- public int Dispose()
- {{
- return 0;
- }}
-
- public int Dispose(int obj)
- {{
- return 0;
- }}
-
- public new int GetHashCode()
- {{
- return 0;
- }}
-
- public int GetHashCode(int obj)
- {{
- return 0;
- }}
-
- public new int GetType()
- {{
- return 0;
- }}
-
- public int GetType(int obj)
- {{
- return 0;
- }}
-
- public new int MemberwiseClone()
- {{
- return 0;
- }}
-
- public int MemberwiseClone(int obj)
- {{
- return 0;
- }}
-
- public int ReferenceEquals()
- {{
- return 0;
- }}
-
- public int ReferenceEquals(int obj)
- {{
- return 0;
- }}
-
- public new int ToString()
- {{
- return 0;
- }}
-
- public int ToString(int obj)
- {{
- return 0;
- }}
- }}
-}}
-";
-
- return ValidateGeneratedCSharpLatestWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task NewKeywordVirtualTestImpl()
{
var inputContents = @"struct MyStruct
@@ -599,130 +257,6 @@ public partial struct Vtbl
return ValidateGeneratedCSharpLatestWindowsBindingsAsync(inputContents, expectedOutputContents, PInvokeGeneratorConfigurationOptions.GenerateExplicitVtbls | PInvokeGeneratorConfigurationOptions.GenerateMarkerInterfaces);
}
- protected override Task OperatorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- MyStruct(int value) : value(value)
- {
- }
-
- MyStruct operator+(MyStruct rhs)
- {
- return MyStruct(value + rhs.value);
- }
-};
-
-MyStruct operator-(MyStruct lhs, MyStruct rhs)
-{
- return MyStruct(lhs.value - rhs.value);
-}
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public MyStruct(int value)
- {
- this.value = value;
- }
-
- public MyStruct Add(MyStruct rhs)
- {
- return new MyStruct(value + rhs.value);
- }
- }
-
- public static partial class Methods
- {
- public static MyStruct Subtract(MyStruct lhs, MyStruct rhs)
- {
- return new MyStruct(lhs.value - rhs.value);
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpLatestWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task OperatorCallTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- MyStruct(int value) : value(value)
- {
- }
-
- MyStruct operator+(MyStruct rhs)
- {
- return MyStruct(value + rhs.value);
- }
-};
-
-MyStruct MyFunction1(MyStruct lhs, MyStruct rhs)
-{
- return lhs + rhs;
-}
-
-MyStruct operator-(MyStruct lhs, MyStruct rhs)
-{
- return MyStruct(lhs.value - rhs.value);
-}
-
-MyStruct MyFunction2(MyStruct lhs, MyStruct rhs)
-{
- return lhs - rhs;
-}
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public MyStruct(int value)
- {
- this.value = value;
- }
-
- public MyStruct Add(MyStruct rhs)
- {
- return new MyStruct(value + rhs.value);
- }
- }
-
- public static partial class Methods
- {
- public static MyStruct MyFunction1(MyStruct lhs, MyStruct rhs)
- {
- return lhs.Add(rhs);
- }
-
- public static MyStruct Subtract(MyStruct lhs, MyStruct rhs)
- {
- return new MyStruct(lhs.value - rhs.value);
- }
-
- public static MyStruct MyFunction2(MyStruct lhs, MyStruct rhs)
- {
- return Subtract(lhs, rhs);
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpLatestWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task StaticTestImpl()
{
var inputContents = @"struct MyStruct
@@ -773,71 +307,6 @@ public static int MyInt32Method()
return ValidateGeneratedCSharpLatestWindowsBindingsAsync(inputContents, expectedOutputContents);
}
- protected override Task ThisTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction()
- {
- return this->value;
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public int MyFunction()
- {
- return this.value;
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpLatestWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task UnsafeDoesNotImpactDllImportTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- void* MyVoidStarMethod()
- {
- return nullptr;
- }
-};
-
-extern ""C"" void MyFunction();";
-
- var expectedOutputContents = @"using System.Runtime.InteropServices;
-
-namespace ClangSharp.Test
-{
- public unsafe partial struct MyStruct
- {
- public void* MyVoidStarMethod()
- {
- return null;
- }
- }
-
- public static partial class Methods
- {
- [DllImport(""ClangSharpPInvokeGenerator"", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
- public static extern void MyFunction();
- }
-}
-";
-
- return ValidateGeneratedCSharpLatestWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task VirtualTestImpl()
{
var inputContents = @"struct MyStruct
diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpPreviewUnix/CXXMethodDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpPreviewUnix/CXXMethodDeclarationTest.cs
index d0e056f3..d8b9a251 100644
--- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpPreviewUnix/CXXMethodDeclarationTest.cs
+++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpPreviewUnix/CXXMethodDeclarationTest.cs
@@ -8,123 +8,8 @@
namespace ClangSharp.UnitTests;
[Platform("unix")]
-public sealed class CSharpPreviewUnix_CXXMethodDeclarationTest : CXXMethodDeclarationTest
+public sealed class CSharpPreviewUnix_CXXMethodDeclarationTest : CXXMethodDeclarationCSharpTest
{
- protected override Task ConstructorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int _value;
-
- MyStruct(int value)
- {
- _value = value;
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int _value;
-
- public MyStruct(int value)
- {
- _value = value;
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpPreviewUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task ConstructorWithInitializeTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int _x;
- int _y;
- int _z;
-
- MyStruct(int x) : _x(x)
- {
- }
-
- MyStruct(int x, int y) : _x(x), _y(y)
- {
- }
-
- MyStruct(int x, int y, int z) : _x(x), _y(y), _z()
- {
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int _x;
-
- public int _y;
-
- public int _z;
-
- public MyStruct(int x)
- {
- _x = x;
- }
-
- public MyStruct(int x, int y)
- {
- _x = x;
- _y = y;
- }
-
- public MyStruct(int x, int y, int z)
- {
- _x = x;
- _y = y;
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpPreviewUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task ConversionTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- operator int()
- {
- return value;
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public int ToInt32()
- {
- return value;
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpPreviewUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task DefaultParameterInheritedFromTemplateTestImpl()
{
// NOTE: This is a regression test where a struct inherits a function from a template with a default parameter.
@@ -159,30 +44,6 @@ public unsafe partial struct MyStruct
return ValidateGeneratedCSharpPreviewUnixBindingsAsync(InputContents, expectedOutputContents);
}
- protected override Task DestructorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- ~MyStruct()
- {
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public void Dispose()
- {
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpPreviewUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task InstanceTestImpl()
{
var inputContents = @"struct MyStruct
@@ -234,209 +95,6 @@ public int MyInt32Method()
return ValidateGeneratedCSharpPreviewUnixBindingsAsync(inputContents, expectedOutputContents);
}
- protected override Task MemberCallTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction1()
- {
- return value;
- }
-
- int MyFunction2()
- {
- return MyFunction1();
- }
-
- int MyFunction3()
- {
- return this->MyFunction1();
- }
-};
-
-int MyFunctionA(MyStruct x)
-{
- return x.MyFunction1();
-}
-
-int MyFunctionB(MyStruct* x)
-{
- return x->MyFunction2();
-}
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public int MyFunction1()
- {
- return value;
- }
-
- public int MyFunction2()
- {
- return MyFunction1();
- }
-
- public int MyFunction3()
- {
- return this.MyFunction1();
- }
- }
-
- public static unsafe partial class Methods
- {
- public static int MyFunctionA(MyStruct x)
- {
- return x.MyFunction1();
- }
-
- public static int MyFunctionB(MyStruct* x)
- {
- return x->MyFunction2();
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpPreviewUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task MemberTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction()
- {
- return value;
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public int MyFunction()
- {
- return value;
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpPreviewUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task NewKeywordTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int Equals() { return 0; }
- int Equals(int obj) { return 0; }
- int Dispose() { return 0; }
- int Dispose(int obj) { return 0; }
- int GetHashCode() { return 0; }
- int GetHashCode(int obj) { return 0; }
- int GetType() { return 0; }
- int GetType(int obj) { return 0; }
- int MemberwiseClone() { return 0; }
- int MemberwiseClone(int obj) { return 0; }
- int ReferenceEquals() { return 0; }
- int ReferenceEquals(int obj) { return 0; }
- int ToString() { return 0; }
- int ToString(int obj) { return 0; }
-};";
-
- var expectedOutputContents = $@"namespace ClangSharp.Test
-{{
- public partial struct MyStruct
- {{
- public int Equals()
- {{
- return 0;
- }}
-
- public int Equals(int obj)
- {{
- return 0;
- }}
-
- public int Dispose()
- {{
- return 0;
- }}
-
- public int Dispose(int obj)
- {{
- return 0;
- }}
-
- public new int GetHashCode()
- {{
- return 0;
- }}
-
- public int GetHashCode(int obj)
- {{
- return 0;
- }}
-
- public new int GetType()
- {{
- return 0;
- }}
-
- public int GetType(int obj)
- {{
- return 0;
- }}
-
- public new int MemberwiseClone()
- {{
- return 0;
- }}
-
- public int MemberwiseClone(int obj)
- {{
- return 0;
- }}
-
- public int ReferenceEquals()
- {{
- return 0;
- }}
-
- public int ReferenceEquals(int obj)
- {{
- return 0;
- }}
-
- public new int ToString()
- {{
- return 0;
- }}
-
- public int ToString(int obj)
- {{
- return 0;
- }}
- }}
-}}
-";
-
- return ValidateGeneratedCSharpPreviewUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task NewKeywordVirtualTestImpl()
{
var inputContents = @"struct MyStruct
@@ -599,130 +257,6 @@ public partial struct Vtbl
return ValidateGeneratedCSharpPreviewUnixBindingsAsync(inputContents, expectedOutputContents, PInvokeGeneratorConfigurationOptions.GenerateExplicitVtbls | PInvokeGeneratorConfigurationOptions.GenerateMarkerInterfaces);
}
- protected override Task OperatorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- MyStruct(int value) : value(value)
- {
- }
-
- MyStruct operator+(MyStruct rhs)
- {
- return MyStruct(value + rhs.value);
- }
-};
-
-MyStruct operator-(MyStruct lhs, MyStruct rhs)
-{
- return MyStruct(lhs.value - rhs.value);
-}
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public MyStruct(int value)
- {
- this.value = value;
- }
-
- public MyStruct Add(MyStruct rhs)
- {
- return new MyStruct(value + rhs.value);
- }
- }
-
- public static partial class Methods
- {
- public static MyStruct Subtract(MyStruct lhs, MyStruct rhs)
- {
- return new MyStruct(lhs.value - rhs.value);
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpPreviewUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task OperatorCallTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- MyStruct(int value) : value(value)
- {
- }
-
- MyStruct operator+(MyStruct rhs)
- {
- return MyStruct(value + rhs.value);
- }
-};
-
-MyStruct MyFunction1(MyStruct lhs, MyStruct rhs)
-{
- return lhs + rhs;
-}
-
-MyStruct operator-(MyStruct lhs, MyStruct rhs)
-{
- return MyStruct(lhs.value - rhs.value);
-}
-
-MyStruct MyFunction2(MyStruct lhs, MyStruct rhs)
-{
- return lhs - rhs;
-}
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public MyStruct(int value)
- {
- this.value = value;
- }
-
- public MyStruct Add(MyStruct rhs)
- {
- return new MyStruct(value + rhs.value);
- }
- }
-
- public static partial class Methods
- {
- public static MyStruct MyFunction1(MyStruct lhs, MyStruct rhs)
- {
- return lhs.Add(rhs);
- }
-
- public static MyStruct Subtract(MyStruct lhs, MyStruct rhs)
- {
- return new MyStruct(lhs.value - rhs.value);
- }
-
- public static MyStruct MyFunction2(MyStruct lhs, MyStruct rhs)
- {
- return Subtract(lhs, rhs);
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpPreviewUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task StaticTestImpl()
{
var inputContents = @"struct MyStruct
@@ -773,71 +307,6 @@ public static int MyInt32Method()
return ValidateGeneratedCSharpPreviewUnixBindingsAsync(inputContents, expectedOutputContents);
}
- protected override Task ThisTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction()
- {
- return this->value;
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public int MyFunction()
- {
- return this.value;
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpPreviewUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task UnsafeDoesNotImpactDllImportTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- void* MyVoidStarMethod()
- {
- return nullptr;
- }
-};
-
-extern ""C"" void MyFunction();";
-
- var expectedOutputContents = @"using System.Runtime.InteropServices;
-
-namespace ClangSharp.Test
-{
- public unsafe partial struct MyStruct
- {
- public void* MyVoidStarMethod()
- {
- return null;
- }
- }
-
- public static partial class Methods
- {
- [DllImport(""ClangSharpPInvokeGenerator"", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
- public static extern void MyFunction();
- }
-}
-";
-
- return ValidateGeneratedCSharpPreviewUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task VirtualTestImpl()
{
var inputContents = @"struct MyStruct
diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpPreviewWindows/CXXMethodDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpPreviewWindows/CXXMethodDeclarationTest.cs
index a49a18d3..0f1641a6 100644
--- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpPreviewWindows/CXXMethodDeclarationTest.cs
+++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpPreviewWindows/CXXMethodDeclarationTest.cs
@@ -8,123 +8,8 @@
namespace ClangSharp.UnitTests;
[Platform("win")]
-public sealed class CSharpPreviewWindows_CXXMethodDeclarationTest : CXXMethodDeclarationTest
+public sealed class CSharpPreviewWindows_CXXMethodDeclarationTest : CXXMethodDeclarationCSharpTest
{
- protected override Task ConstructorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int _value;
-
- MyStruct(int value)
- {
- _value = value;
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int _value;
-
- public MyStruct(int value)
- {
- _value = value;
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpPreviewWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task ConstructorWithInitializeTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int _x;
- int _y;
- int _z;
-
- MyStruct(int x) : _x(x)
- {
- }
-
- MyStruct(int x, int y) : _x(x), _y(y)
- {
- }
-
- MyStruct(int x, int y, int z) : _x(x), _y(y), _z()
- {
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int _x;
-
- public int _y;
-
- public int _z;
-
- public MyStruct(int x)
- {
- _x = x;
- }
-
- public MyStruct(int x, int y)
- {
- _x = x;
- _y = y;
- }
-
- public MyStruct(int x, int y, int z)
- {
- _x = x;
- _y = y;
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpPreviewWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task ConversionTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- operator int()
- {
- return value;
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public int ToInt32()
- {
- return value;
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpPreviewWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task DefaultParameterInheritedFromTemplateTestImpl()
{
// NOTE: This is a regression test where a struct inherits a function from a template with a default parameter.
@@ -159,30 +44,6 @@ public unsafe partial struct MyStruct
return ValidateGeneratedCSharpPreviewWindowsBindingsAsync(InputContents, expectedOutputContents);
}
- protected override Task DestructorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- ~MyStruct()
- {
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public void Dispose()
- {
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpPreviewWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task InstanceTestImpl()
{
var inputContents = @"struct MyStruct
@@ -234,209 +95,6 @@ public int MyInt32Method()
return ValidateGeneratedCSharpPreviewWindowsBindingsAsync(inputContents, expectedOutputContents);
}
- protected override Task MemberCallTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction1()
- {
- return value;
- }
-
- int MyFunction2()
- {
- return MyFunction1();
- }
-
- int MyFunction3()
- {
- return this->MyFunction1();
- }
-};
-
-int MyFunctionA(MyStruct x)
-{
- return x.MyFunction1();
-}
-
-int MyFunctionB(MyStruct* x)
-{
- return x->MyFunction2();
-}
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public int MyFunction1()
- {
- return value;
- }
-
- public int MyFunction2()
- {
- return MyFunction1();
- }
-
- public int MyFunction3()
- {
- return this.MyFunction1();
- }
- }
-
- public static unsafe partial class Methods
- {
- public static int MyFunctionA(MyStruct x)
- {
- return x.MyFunction1();
- }
-
- public static int MyFunctionB(MyStruct* x)
- {
- return x->MyFunction2();
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpPreviewWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task MemberTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction()
- {
- return value;
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public int MyFunction()
- {
- return value;
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpPreviewWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task NewKeywordTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int Equals() { return 0; }
- int Equals(int obj) { return 0; }
- int Dispose() { return 0; }
- int Dispose(int obj) { return 0; }
- int GetHashCode() { return 0; }
- int GetHashCode(int obj) { return 0; }
- int GetType() { return 0; }
- int GetType(int obj) { return 0; }
- int MemberwiseClone() { return 0; }
- int MemberwiseClone(int obj) { return 0; }
- int ReferenceEquals() { return 0; }
- int ReferenceEquals(int obj) { return 0; }
- int ToString() { return 0; }
- int ToString(int obj) { return 0; }
-};";
-
- var expectedOutputContents = $@"namespace ClangSharp.Test
-{{
- public partial struct MyStruct
- {{
- public int Equals()
- {{
- return 0;
- }}
-
- public int Equals(int obj)
- {{
- return 0;
- }}
-
- public int Dispose()
- {{
- return 0;
- }}
-
- public int Dispose(int obj)
- {{
- return 0;
- }}
-
- public new int GetHashCode()
- {{
- return 0;
- }}
-
- public int GetHashCode(int obj)
- {{
- return 0;
- }}
-
- public new int GetType()
- {{
- return 0;
- }}
-
- public int GetType(int obj)
- {{
- return 0;
- }}
-
- public new int MemberwiseClone()
- {{
- return 0;
- }}
-
- public int MemberwiseClone(int obj)
- {{
- return 0;
- }}
-
- public int ReferenceEquals()
- {{
- return 0;
- }}
-
- public int ReferenceEquals(int obj)
- {{
- return 0;
- }}
-
- public new int ToString()
- {{
- return 0;
- }}
-
- public int ToString(int obj)
- {{
- return 0;
- }}
- }}
-}}
-";
-
- return ValidateGeneratedCSharpPreviewWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task NewKeywordVirtualTestImpl()
{
var inputContents = @"struct MyStruct
@@ -599,130 +257,6 @@ public partial struct Vtbl
return ValidateGeneratedCSharpPreviewWindowsBindingsAsync(inputContents, expectedOutputContents, PInvokeGeneratorConfigurationOptions.GenerateExplicitVtbls | PInvokeGeneratorConfigurationOptions.GenerateMarkerInterfaces);
}
- protected override Task OperatorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- MyStruct(int value) : value(value)
- {
- }
-
- MyStruct operator+(MyStruct rhs)
- {
- return MyStruct(value + rhs.value);
- }
-};
-
-MyStruct operator-(MyStruct lhs, MyStruct rhs)
-{
- return MyStruct(lhs.value - rhs.value);
-}
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public MyStruct(int value)
- {
- this.value = value;
- }
-
- public MyStruct Add(MyStruct rhs)
- {
- return new MyStruct(value + rhs.value);
- }
- }
-
- public static partial class Methods
- {
- public static MyStruct Subtract(MyStruct lhs, MyStruct rhs)
- {
- return new MyStruct(lhs.value - rhs.value);
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpPreviewWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task OperatorCallTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- MyStruct(int value) : value(value)
- {
- }
-
- MyStruct operator+(MyStruct rhs)
- {
- return MyStruct(value + rhs.value);
- }
-};
-
-MyStruct MyFunction1(MyStruct lhs, MyStruct rhs)
-{
- return lhs + rhs;
-}
-
-MyStruct operator-(MyStruct lhs, MyStruct rhs)
-{
- return MyStruct(lhs.value - rhs.value);
-}
-
-MyStruct MyFunction2(MyStruct lhs, MyStruct rhs)
-{
- return lhs - rhs;
-}
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public MyStruct(int value)
- {
- this.value = value;
- }
-
- public MyStruct Add(MyStruct rhs)
- {
- return new MyStruct(value + rhs.value);
- }
- }
-
- public static partial class Methods
- {
- public static MyStruct MyFunction1(MyStruct lhs, MyStruct rhs)
- {
- return lhs.Add(rhs);
- }
-
- public static MyStruct Subtract(MyStruct lhs, MyStruct rhs)
- {
- return new MyStruct(lhs.value - rhs.value);
- }
-
- public static MyStruct MyFunction2(MyStruct lhs, MyStruct rhs)
- {
- return Subtract(lhs, rhs);
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpPreviewWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task StaticTestImpl()
{
var inputContents = @"struct MyStruct
@@ -773,71 +307,6 @@ public static int MyInt32Method()
return ValidateGeneratedCSharpPreviewWindowsBindingsAsync(inputContents, expectedOutputContents);
}
- protected override Task ThisTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction()
- {
- return this->value;
- }
-};
-";
-
- var expectedOutputContents = @"namespace ClangSharp.Test
-{
- public partial struct MyStruct
- {
- public int value;
-
- public int MyFunction()
- {
- return this.value;
- }
- }
-}
-";
-
- return ValidateGeneratedCSharpPreviewWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task UnsafeDoesNotImpactDllImportTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- void* MyVoidStarMethod()
- {
- return nullptr;
- }
-};
-
-extern ""C"" void MyFunction();";
-
- var expectedOutputContents = @"using System.Runtime.InteropServices;
-
-namespace ClangSharp.Test
-{
- public unsafe partial struct MyStruct
- {
- public void* MyVoidStarMethod()
- {
- return null;
- }
- }
-
- public static partial class Methods
- {
- [DllImport(""ClangSharpPInvokeGenerator"", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
- public static extern void MyFunction();
- }
-}
-";
-
- return ValidateGeneratedCSharpPreviewWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task VirtualTestImpl()
{
var inputContents = @"struct MyStruct
diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleUnix/CXXMethodDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleUnix/CXXMethodDeclarationTest.cs
index 7485d37c..2b20f321 100644
--- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleUnix/CXXMethodDeclarationTest.cs
+++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleUnix/CXXMethodDeclarationTest.cs
@@ -10,161 +10,6 @@ namespace ClangSharp.UnitTests;
[Platform("unix")]
public sealed class XmlCompatibleUnix_CXXMethodDeclarationTest : CXXMethodDeclarationXmlTest
{
- protected override Task ConstructorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int _value;
-
- MyStruct(int value)
- {
- _value = value;
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- void
-
- int
-
- _value = value;
-
-
-
-
-";
-
- return ValidateGeneratedXmlCompatibleUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task ConstructorWithInitializeTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int _x;
- int _y;
- int _z;
-
- MyStruct(int x) : _x(x)
- {
- }
-
- MyStruct(int x, int y) : _x(x), _y(y)
- {
- }
-
- MyStruct(int x, int y, int z) : _x(x), _y(y), _z()
- {
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- int
-
-
- int
-
-
- void
-
- int
-
-
- x
-
-
-
-
- void
-
- int
-
-
- int
-
-
- x
-
-
- y
-
-
-
-
- void
-
- int
-
-
- int
-
-
- int
-
-
- x
-
-
- y
-
-
-
-
-
-
-";
-
- return ValidateGeneratedXmlCompatibleUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task ConversionTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- operator int()
- {
- return value;
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- int
- return value;
-
-
-
-
-";
-
- return ValidateGeneratedXmlCompatibleUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task DefaultParameterInheritedFromTemplateTestImpl()
{
// NOTE: This is a regression test where a struct inherits a function from a template with a default parameter.
@@ -206,32 +51,6 @@ struct MyStruct : public MyTemplate
return ValidateGeneratedXmlCompatibleUnixBindingsAsync(InputContents, expectedOutputContents);
}
- protected override Task DestructorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- ~MyStruct()
- {
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- void
-
-
-
-
-
-";
-
- return ValidateGeneratedXmlCompatibleUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task InstanceTestImpl()
{
var inputContents = @"struct MyStruct
@@ -284,223 +103,6 @@ int MyInt32Method()
return ValidateGeneratedXmlCompatibleUnixBindingsAsync(inputContents, expectedOutputContents);
}
- protected override Task MemberCallTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction1()
- {
- return value;
- }
-
- int MyFunction2()
- {
- return MyFunction1();
- }
-
- int MyFunction3()
- {
- return this->MyFunction1();
- }
-};
-
-int MyFunctionA(MyStruct x)
-{
- return x.MyFunction1();
-}
-
-int MyFunctionB(MyStruct* x)
-{
- return x->MyFunction2();
-}
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- int
- return value;
-
-
- int
- return MyFunction1();
-
-
- int
- return this.MyFunction1();
-
-
-
-
- int
-
- MyStruct
-
- return x.MyFunction1();
-
-
- int
-
- MyStruct*
-
- return x->MyFunction2();
-
-
-
-
-";
-
- return ValidateGeneratedXmlCompatibleUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task MemberTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction()
- {
- return value;
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- int
- return value;
-
-
-
-
-";
-
- return ValidateGeneratedXmlCompatibleUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task NewKeywordTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int Equals() { return 0; }
- int Equals(int obj) { return 0; }
- int Dispose() { return 0; }
- int Dispose(int obj) { return 0; }
- int GetHashCode() { return 0; }
- int GetHashCode(int obj) { return 0; }
- int GetType() { return 0; }
- int GetType(int obj) { return 0; }
- int MemberwiseClone() { return 0; }
- int MemberwiseClone(int obj) { return 0; }
- int ReferenceEquals() { return 0; }
- int ReferenceEquals(int obj) { return 0; }
- int ToString() { return 0; }
- int ToString(int obj) { return 0; }
-};";
-
- var expectedOutputContents = $@"
-
-
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
-
-
-";
-
- return ValidateGeneratedXmlCompatibleUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task NewKeywordVirtualTestImpl()
{
var inputContents = @"struct MyStruct
@@ -818,168 +420,6 @@ protected override Task NewKeywordVirtualWithExplicitVtblAndMarkerInterfaceTestI
return ValidateGeneratedXmlCompatibleUnixBindingsAsync(inputContents, expectedOutputContents, PInvokeGeneratorConfigurationOptions.GenerateExplicitVtbls | PInvokeGeneratorConfigurationOptions.GenerateMarkerInterfaces);
}
- protected override Task OperatorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- MyStruct(int value) : value(value)
- {
- }
-
- MyStruct operator+(MyStruct rhs)
- {
- return MyStruct(value + rhs.value);
- }
-};
-
-MyStruct operator-(MyStruct lhs, MyStruct rhs)
-{
- return MyStruct(lhs.value - rhs.value);
-}
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- void
-
- int
-
-
- value
-
-
-
-
- MyStruct
-
- MyStruct
-
- return new MyStruct(value + rhs.value);
-
-
-
-
- MyStruct
-
- MyStruct
-
-
- MyStruct
-
- return new MyStruct(lhs.value - rhs.value);
-
-
-
-
-";
-
- return ValidateGeneratedXmlCompatibleUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task OperatorCallTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- MyStruct(int value) : value(value)
- {
- }
-
- MyStruct operator+(MyStruct rhs)
- {
- return MyStruct(value + rhs.value);
- }
-};
-
-MyStruct MyFunction1(MyStruct lhs, MyStruct rhs)
-{
- return lhs + rhs;
-}
-
-MyStruct operator-(MyStruct lhs, MyStruct rhs)
-{
- return MyStruct(lhs.value - rhs.value);
-}
-
-MyStruct MyFunction2(MyStruct lhs, MyStruct rhs)
-{
- return lhs - rhs;
-}
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- void
-
- int
-
-
- value
-
-
-
-
- MyStruct
-
- MyStruct
-
- return new MyStruct(value + rhs.value);
-
-
-
-
- MyStruct
-
- MyStruct
-
-
- MyStruct
-
- return lhs.Add(rhs);
-
-
- MyStruct
-
- MyStruct
-
-
- MyStruct
-
- return new MyStruct(lhs.value - rhs.value);
-
-
- MyStruct
-
- MyStruct
-
-
- MyStruct
-
- return Subtract(lhs, rhs);
-
-
-
-
-";
-
- return ValidateGeneratedXmlCompatibleUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task StaticTestImpl()
{
var inputContents = @"struct MyStruct
@@ -1028,71 +468,6 @@ static int MyInt32Method()
return ValidateGeneratedXmlCompatibleUnixBindingsAsync(inputContents, expectedOutputContents);
}
- protected override Task ThisTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction()
- {
- return this->value;
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- int
- return this.value;
-
-
-
-
-";
-
- return ValidateGeneratedXmlCompatibleUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task UnsafeDoesNotImpactDllImportTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- void* MyVoidStarMethod()
- {
- return nullptr;
- }
-};
-
-extern ""C"" void MyFunction();";
-
- var expectedOutputContents = @"
-
-
-
-
- void*
- return null;
-
-
-
-
- void
-
-
-
-
-";
-
- return ValidateGeneratedXmlCompatibleUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task VirtualTestImpl()
{
var inputContents = @"struct MyStruct
diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleWindows/CXXMethodDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleWindows/CXXMethodDeclarationTest.cs
index bcdda1f4..32f5b3a0 100644
--- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleWindows/CXXMethodDeclarationTest.cs
+++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleWindows/CXXMethodDeclarationTest.cs
@@ -10,161 +10,6 @@ namespace ClangSharp.UnitTests;
[Platform("win")]
public sealed class XmlCompatibleWindows_CXXMethodDeclarationTest : CXXMethodDeclarationXmlTest
{
- protected override Task ConstructorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int _value;
-
- MyStruct(int value)
- {
- _value = value;
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- void
-
- int
-
- _value = value;
-
-
-
-
-";
-
- return ValidateGeneratedXmlCompatibleWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task ConstructorWithInitializeTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int _x;
- int _y;
- int _z;
-
- MyStruct(int x) : _x(x)
- {
- }
-
- MyStruct(int x, int y) : _x(x), _y(y)
- {
- }
-
- MyStruct(int x, int y, int z) : _x(x), _y(y), _z()
- {
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- int
-
-
- int
-
-
- void
-
- int
-
-
- x
-
-
-
-
- void
-
- int
-
-
- int
-
-
- x
-
-
- y
-
-
-
-
- void
-
- int
-
-
- int
-
-
- int
-
-
- x
-
-
- y
-
-
-
-
-
-
-";
-
- return ValidateGeneratedXmlCompatibleWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task ConversionTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- operator int()
- {
- return value;
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- int
- return value;
-
-
-
-
-";
-
- return ValidateGeneratedXmlCompatibleWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task DefaultParameterInheritedFromTemplateTestImpl()
{
// NOTE: This is a regression test where a struct inherits a function from a template with a default parameter.
@@ -207,32 +52,6 @@ struct MyStruct : public MyTemplate
return ValidateGeneratedXmlCompatibleWindowsBindingsAsync(InputContents, expectedOutputContents);
}
- protected override Task DestructorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- ~MyStruct()
- {
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- void
-
-
-
-
-
-";
-
- return ValidateGeneratedXmlCompatibleWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task InstanceTestImpl()
{
var inputContents = @"struct MyStruct
@@ -285,223 +104,6 @@ int MyInt32Method()
return ValidateGeneratedXmlCompatibleWindowsBindingsAsync(inputContents, expectedOutputContents);
}
- protected override Task MemberCallTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction1()
- {
- return value;
- }
-
- int MyFunction2()
- {
- return MyFunction1();
- }
-
- int MyFunction3()
- {
- return this->MyFunction1();
- }
-};
-
-int MyFunctionA(MyStruct x)
-{
- return x.MyFunction1();
-}
-
-int MyFunctionB(MyStruct* x)
-{
- return x->MyFunction2();
-}
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- int
- return value;
-
-
- int
- return MyFunction1();
-
-
- int
- return this.MyFunction1();
-
-
-
-
- int
-
- MyStruct
-
- return x.MyFunction1();
-
-
- int
-
- MyStruct*
-
- return x->MyFunction2();
-
-
-
-
-";
-
- return ValidateGeneratedXmlCompatibleWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task MemberTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction()
- {
- return value;
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- int
- return value;
-
-
-
-
-";
-
- return ValidateGeneratedXmlCompatibleWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task NewKeywordTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int Equals() { return 0; }
- int Equals(int obj) { return 0; }
- int Dispose() { return 0; }
- int Dispose(int obj) { return 0; }
- int GetHashCode() { return 0; }
- int GetHashCode(int obj) { return 0; }
- int GetType() { return 0; }
- int GetType(int obj) { return 0; }
- int MemberwiseClone() { return 0; }
- int MemberwiseClone(int obj) { return 0; }
- int ReferenceEquals() { return 0; }
- int ReferenceEquals(int obj) { return 0; }
- int ToString() { return 0; }
- int ToString(int obj) { return 0; }
-};";
-
- var expectedOutputContents = $@"
-
-
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
-
-
-";
-
- return ValidateGeneratedXmlCompatibleWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task NewKeywordVirtualTestImpl()
{
var inputContents = @"struct MyStruct
@@ -819,168 +421,6 @@ protected override Task NewKeywordVirtualWithExplicitVtblAndMarkerInterfaceTestI
return ValidateGeneratedXmlCompatibleWindowsBindingsAsync(inputContents, expectedOutputContents, PInvokeGeneratorConfigurationOptions.GenerateExplicitVtbls | PInvokeGeneratorConfigurationOptions.GenerateMarkerInterfaces);
}
- protected override Task OperatorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- MyStruct(int value) : value(value)
- {
- }
-
- MyStruct operator+(MyStruct rhs)
- {
- return MyStruct(value + rhs.value);
- }
-};
-
-MyStruct operator-(MyStruct lhs, MyStruct rhs)
-{
- return MyStruct(lhs.value - rhs.value);
-}
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- void
-
- int
-
-
- value
-
-
-
-
- MyStruct
-
- MyStruct
-
- return new MyStruct(value + rhs.value);
-
-
-
-
- MyStruct
-
- MyStruct
-
-
- MyStruct
-
- return new MyStruct(lhs.value - rhs.value);
-
-
-
-
-";
-
- return ValidateGeneratedXmlCompatibleWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task OperatorCallTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- MyStruct(int value) : value(value)
- {
- }
-
- MyStruct operator+(MyStruct rhs)
- {
- return MyStruct(value + rhs.value);
- }
-};
-
-MyStruct MyFunction1(MyStruct lhs, MyStruct rhs)
-{
- return lhs + rhs;
-}
-
-MyStruct operator-(MyStruct lhs, MyStruct rhs)
-{
- return MyStruct(lhs.value - rhs.value);
-}
-
-MyStruct MyFunction2(MyStruct lhs, MyStruct rhs)
-{
- return lhs - rhs;
-}
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- void
-
- int
-
-
- value
-
-
-
-
- MyStruct
-
- MyStruct
-
- return new MyStruct(value + rhs.value);
-
-
-
-
- MyStruct
-
- MyStruct
-
-
- MyStruct
-
- return lhs.Add(rhs);
-
-
- MyStruct
-
- MyStruct
-
-
- MyStruct
-
- return new MyStruct(lhs.value - rhs.value);
-
-
- MyStruct
-
- MyStruct
-
-
- MyStruct
-
- return Subtract(lhs, rhs);
-
-
-
-
-";
-
- return ValidateGeneratedXmlCompatibleWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task StaticTestImpl()
{
var inputContents = @"struct MyStruct
@@ -1029,71 +469,6 @@ static int MyInt32Method()
return ValidateGeneratedXmlCompatibleWindowsBindingsAsync(inputContents, expectedOutputContents);
}
- protected override Task ThisTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction()
- {
- return this->value;
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- int
- return this.value;
-
-
-
-
-";
-
- return ValidateGeneratedXmlCompatibleWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task UnsafeDoesNotImpactDllImportTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- void* MyVoidStarMethod()
- {
- return nullptr;
- }
-};
-
-extern ""C"" void MyFunction();";
-
- var expectedOutputContents = @"
-
-
-
-
- void*
- return null;
-
-
-
-
- void
-
-
-
-
-";
-
- return ValidateGeneratedXmlCompatibleWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task VirtualTestImpl()
{
var inputContents = @"struct MyStruct
diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlDefaultUnix/CXXMethodDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlDefaultUnix/CXXMethodDeclarationTest.cs
index 5a4859f9..f05bd5fc 100644
--- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlDefaultUnix/CXXMethodDeclarationTest.cs
+++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlDefaultUnix/CXXMethodDeclarationTest.cs
@@ -10,161 +10,6 @@ namespace ClangSharp.UnitTests;
[Platform("unix")]
public sealed class XmlDefaultUnix_CXXMethodDeclarationTest : CXXMethodDeclarationXmlTest
{
- protected override Task ConstructorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int _value;
-
- MyStruct(int value)
- {
- _value = value;
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- void
-
- int
-
- _value = value;
-
-
-
-
-";
-
- return ValidateGeneratedXmlDefaultUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task ConstructorWithInitializeTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int _x;
- int _y;
- int _z;
-
- MyStruct(int x) : _x(x)
- {
- }
-
- MyStruct(int x, int y) : _x(x), _y(y)
- {
- }
-
- MyStruct(int x, int y, int z) : _x(x), _y(y), _z()
- {
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- int
-
-
- int
-
-
- void
-
- int
-
-
- x
-
-
-
-
- void
-
- int
-
-
- int
-
-
- x
-
-
- y
-
-
-
-
- void
-
- int
-
-
- int
-
-
- int
-
-
- x
-
-
- y
-
-
-
-
-
-
-";
-
- return ValidateGeneratedXmlDefaultUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task ConversionTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- operator int()
- {
- return value;
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- int
- return value;
-
-
-
-
-";
-
- return ValidateGeneratedXmlDefaultUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task DefaultParameterInheritedFromTemplateTestImpl()
{
// NOTE: This is a regression test where a struct inherits a function from a template with a default parameter.
@@ -207,32 +52,6 @@ struct MyStruct : public MyTemplate
return ValidateGeneratedXmlDefaultUnixBindingsAsync(InputContents, expectedOutputContents);
}
- protected override Task DestructorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- ~MyStruct()
- {
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- void
-
-
-
-
-
-";
-
- return ValidateGeneratedXmlDefaultUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task InstanceTestImpl()
{
var inputContents = @"struct MyStruct
@@ -285,223 +104,6 @@ int MyInt32Method()
return ValidateGeneratedXmlDefaultUnixBindingsAsync(inputContents, expectedOutputContents);
}
- protected override Task MemberCallTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction1()
- {
- return value;
- }
-
- int MyFunction2()
- {
- return MyFunction1();
- }
-
- int MyFunction3()
- {
- return this->MyFunction1();
- }
-};
-
-int MyFunctionA(MyStruct x)
-{
- return x.MyFunction1();
-}
-
-int MyFunctionB(MyStruct* x)
-{
- return x->MyFunction2();
-}
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- int
- return value;
-
-
- int
- return MyFunction1();
-
-
- int
- return this.MyFunction1();
-
-
-
-
- int
-
- MyStruct
-
- return x.MyFunction1();
-
-
- int
-
- MyStruct*
-
- return x->MyFunction2();
-
-
-
-
-";
-
- return ValidateGeneratedXmlDefaultUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task MemberTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction()
- {
- return value;
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- int
- return value;
-
-
-
-
-";
-
- return ValidateGeneratedXmlDefaultUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task NewKeywordTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int Equals() { return 0; }
- int Equals(int obj) { return 0; }
- int Dispose() { return 0; }
- int Dispose(int obj) { return 0; }
- int GetHashCode() { return 0; }
- int GetHashCode(int obj) { return 0; }
- int GetType() { return 0; }
- int GetType(int obj) { return 0; }
- int MemberwiseClone() { return 0; }
- int MemberwiseClone(int obj) { return 0; }
- int ReferenceEquals() { return 0; }
- int ReferenceEquals(int obj) { return 0; }
- int ToString() { return 0; }
- int ToString(int obj) { return 0; }
-};";
-
- var expectedOutputContents = $@"
-
-
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
-
-
-";
-
- return ValidateGeneratedXmlDefaultUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task NewKeywordVirtualTestImpl()
{
var inputContents = @"struct MyStruct
@@ -711,168 +313,6 @@ protected override Task NewKeywordVirtualWithExplicitVtblAndMarkerInterfaceTestI
return ValidateGeneratedXmlDefaultUnixBindingsAsync(inputContents, expectedOutputContents, PInvokeGeneratorConfigurationOptions.GenerateExplicitVtbls | PInvokeGeneratorConfigurationOptions.GenerateMarkerInterfaces);
}
- protected override Task OperatorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- MyStruct(int value) : value(value)
- {
- }
-
- MyStruct operator+(MyStruct rhs)
- {
- return MyStruct(value + rhs.value);
- }
-};
-
-MyStruct operator-(MyStruct lhs, MyStruct rhs)
-{
- return MyStruct(lhs.value - rhs.value);
-}
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- void
-
- int
-
-
- value
-
-
-
-
- MyStruct
-
- MyStruct
-
- return new MyStruct(value + rhs.value);
-
-
-
-
- MyStruct
-
- MyStruct
-
-
- MyStruct
-
- return new MyStruct(lhs.value - rhs.value);
-
-
-
-
-";
-
- return ValidateGeneratedXmlDefaultUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task OperatorCallTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- MyStruct(int value) : value(value)
- {
- }
-
- MyStruct operator+(MyStruct rhs)
- {
- return MyStruct(value + rhs.value);
- }
-};
-
-MyStruct MyFunction1(MyStruct lhs, MyStruct rhs)
-{
- return lhs + rhs;
-}
-
-MyStruct operator-(MyStruct lhs, MyStruct rhs)
-{
- return MyStruct(lhs.value - rhs.value);
-}
-
-MyStruct MyFunction2(MyStruct lhs, MyStruct rhs)
-{
- return lhs - rhs;
-}
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- void
-
- int
-
-
- value
-
-
-
-
- MyStruct
-
- MyStruct
-
- return new MyStruct(value + rhs.value);
-
-
-
-
- MyStruct
-
- MyStruct
-
-
- MyStruct
-
- return lhs.Add(rhs);
-
-
- MyStruct
-
- MyStruct
-
-
- MyStruct
-
- return new MyStruct(lhs.value - rhs.value);
-
-
- MyStruct
-
- MyStruct
-
-
- MyStruct
-
- return Subtract(lhs, rhs);
-
-
-
-
-";
-
- return ValidateGeneratedXmlDefaultUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task StaticTestImpl()
{
var inputContents = @"struct MyStruct
@@ -921,71 +361,6 @@ static int MyInt32Method()
return ValidateGeneratedXmlDefaultUnixBindingsAsync(inputContents, expectedOutputContents);
}
- protected override Task ThisTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction()
- {
- return this->value;
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- int
- return this.value;
-
-
-
-
-";
-
- return ValidateGeneratedXmlDefaultUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task UnsafeDoesNotImpactDllImportTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- void* MyVoidStarMethod()
- {
- return nullptr;
- }
-};
-
-extern ""C"" void MyFunction();";
-
- var expectedOutputContents = @"
-
-
-
-
- void*
- return null;
-
-
-
-
- void
-
-
-
-
-";
-
- return ValidateGeneratedXmlDefaultUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task VirtualTestImpl()
{
var inputContents = @"struct MyStruct
diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlDefaultWindows/CXXMethodDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlDefaultWindows/CXXMethodDeclarationTest.cs
index 85afa10c..dc80a866 100644
--- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlDefaultWindows/CXXMethodDeclarationTest.cs
+++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlDefaultWindows/CXXMethodDeclarationTest.cs
@@ -10,161 +10,6 @@ namespace ClangSharp.UnitTests;
[Platform("win")]
public sealed class XmlDefaultWindows_CXXMethodDeclarationTest : CXXMethodDeclarationXmlTest
{
- protected override Task ConstructorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int _value;
-
- MyStruct(int value)
- {
- _value = value;
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- void
-
- int
-
- _value = value;
-
-
-
-
-";
-
- return ValidateGeneratedXmlDefaultWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task ConstructorWithInitializeTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int _x;
- int _y;
- int _z;
-
- MyStruct(int x) : _x(x)
- {
- }
-
- MyStruct(int x, int y) : _x(x), _y(y)
- {
- }
-
- MyStruct(int x, int y, int z) : _x(x), _y(y), _z()
- {
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- int
-
-
- int
-
-
- void
-
- int
-
-
- x
-
-
-
-
- void
-
- int
-
-
- int
-
-
- x
-
-
- y
-
-
-
-
- void
-
- int
-
-
- int
-
-
- int
-
-
- x
-
-
- y
-
-
-
-
-
-
-";
-
- return ValidateGeneratedXmlDefaultWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task ConversionTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- operator int()
- {
- return value;
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- int
- return value;
-
-
-
-
-";
-
- return ValidateGeneratedXmlDefaultWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task DefaultParameterInheritedFromTemplateTestImpl()
{
// NOTE: This is a regression test where a struct inherits a function from a template with a default parameter.
@@ -207,32 +52,6 @@ struct MyStruct : public MyTemplate
return ValidateGeneratedXmlDefaultWindowsBindingsAsync(InputContents, expectedOutputContents);
}
- protected override Task DestructorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- ~MyStruct()
- {
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- void
-
-
-
-
-
-";
-
- return ValidateGeneratedXmlDefaultWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task InstanceTestImpl()
{
var inputContents = @"struct MyStruct
@@ -285,223 +104,6 @@ int MyInt32Method()
return ValidateGeneratedXmlDefaultWindowsBindingsAsync(inputContents, expectedOutputContents);
}
- protected override Task MemberCallTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction1()
- {
- return value;
- }
-
- int MyFunction2()
- {
- return MyFunction1();
- }
-
- int MyFunction3()
- {
- return this->MyFunction1();
- }
-};
-
-int MyFunctionA(MyStruct x)
-{
- return x.MyFunction1();
-}
-
-int MyFunctionB(MyStruct* x)
-{
- return x->MyFunction2();
-}
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- int
- return value;
-
-
- int
- return MyFunction1();
-
-
- int
- return this.MyFunction1();
-
-
-
-
- int
-
- MyStruct
-
- return x.MyFunction1();
-
-
- int
-
- MyStruct*
-
- return x->MyFunction2();
-
-
-
-
-";
-
- return ValidateGeneratedXmlDefaultWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task MemberTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction()
- {
- return value;
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- int
- return value;
-
-
-
-
-";
-
- return ValidateGeneratedXmlDefaultWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task NewKeywordTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int Equals() { return 0; }
- int Equals(int obj) { return 0; }
- int Dispose() { return 0; }
- int Dispose(int obj) { return 0; }
- int GetHashCode() { return 0; }
- int GetHashCode(int obj) { return 0; }
- int GetType() { return 0; }
- int GetType(int obj) { return 0; }
- int MemberwiseClone() { return 0; }
- int MemberwiseClone(int obj) { return 0; }
- int ReferenceEquals() { return 0; }
- int ReferenceEquals(int obj) { return 0; }
- int ToString() { return 0; }
- int ToString(int obj) { return 0; }
-};";
-
- var expectedOutputContents = $@"
-
-
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
-
-
-";
-
- return ValidateGeneratedXmlDefaultWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task NewKeywordVirtualTestImpl()
{
var inputContents = @"struct MyStruct
@@ -711,168 +313,6 @@ protected override Task NewKeywordVirtualWithExplicitVtblAndMarkerInterfaceTestI
return ValidateGeneratedXmlDefaultWindowsBindingsAsync(inputContents, expectedOutputContents, PInvokeGeneratorConfigurationOptions.GenerateExplicitVtbls | PInvokeGeneratorConfigurationOptions.GenerateMarkerInterfaces);
}
- protected override Task OperatorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- MyStruct(int value) : value(value)
- {
- }
-
- MyStruct operator+(MyStruct rhs)
- {
- return MyStruct(value + rhs.value);
- }
-};
-
-MyStruct operator-(MyStruct lhs, MyStruct rhs)
-{
- return MyStruct(lhs.value - rhs.value);
-}
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- void
-
- int
-
-
- value
-
-
-
-
- MyStruct
-
- MyStruct
-
- return new MyStruct(value + rhs.value);
-
-
-
-
- MyStruct
-
- MyStruct
-
-
- MyStruct
-
- return new MyStruct(lhs.value - rhs.value);
-
-
-
-
-";
-
- return ValidateGeneratedXmlDefaultWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task OperatorCallTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- MyStruct(int value) : value(value)
- {
- }
-
- MyStruct operator+(MyStruct rhs)
- {
- return MyStruct(value + rhs.value);
- }
-};
-
-MyStruct MyFunction1(MyStruct lhs, MyStruct rhs)
-{
- return lhs + rhs;
-}
-
-MyStruct operator-(MyStruct lhs, MyStruct rhs)
-{
- return MyStruct(lhs.value - rhs.value);
-}
-
-MyStruct MyFunction2(MyStruct lhs, MyStruct rhs)
-{
- return lhs - rhs;
-}
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- void
-
- int
-
-
- value
-
-
-
-
- MyStruct
-
- MyStruct
-
- return new MyStruct(value + rhs.value);
-
-
-
-
- MyStruct
-
- MyStruct
-
-
- MyStruct
-
- return lhs.Add(rhs);
-
-
- MyStruct
-
- MyStruct
-
-
- MyStruct
-
- return new MyStruct(lhs.value - rhs.value);
-
-
- MyStruct
-
- MyStruct
-
-
- MyStruct
-
- return Subtract(lhs, rhs);
-
-
-
-
-";
-
- return ValidateGeneratedXmlDefaultWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task StaticTestImpl()
{
var inputContents = @"struct MyStruct
@@ -921,71 +361,6 @@ static int MyInt32Method()
return ValidateGeneratedXmlDefaultWindowsBindingsAsync(inputContents, expectedOutputContents);
}
- protected override Task ThisTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction()
- {
- return this->value;
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- int
- return this.value;
-
-
-
-
-";
-
- return ValidateGeneratedXmlDefaultWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task UnsafeDoesNotImpactDllImportTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- void* MyVoidStarMethod()
- {
- return nullptr;
- }
-};
-
-extern ""C"" void MyFunction();";
-
- var expectedOutputContents = @"
-
-
-
-
- void*
- return null;
-
-
-
-
- void
-
-
-
-
-";
-
- return ValidateGeneratedXmlDefaultWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task VirtualTestImpl()
{
var inputContents = @"struct MyStruct
diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestUnix/CXXMethodDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestUnix/CXXMethodDeclarationTest.cs
index b843483e..4f53a63d 100644
--- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestUnix/CXXMethodDeclarationTest.cs
+++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestUnix/CXXMethodDeclarationTest.cs
@@ -10,161 +10,6 @@ namespace ClangSharp.UnitTests;
[Platform("unix")]
public sealed class XmlLatestUnix_CXXMethodDeclarationTest : CXXMethodDeclarationXmlTest
{
- protected override Task ConstructorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int _value;
-
- MyStruct(int value)
- {
- _value = value;
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- void
-
- int
-
- _value = value;
-
-
-
-
-";
-
- return ValidateGeneratedXmlLatestUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task ConstructorWithInitializeTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int _x;
- int _y;
- int _z;
-
- MyStruct(int x) : _x(x)
- {
- }
-
- MyStruct(int x, int y) : _x(x), _y(y)
- {
- }
-
- MyStruct(int x, int y, int z) : _x(x), _y(y), _z()
- {
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- int
-
-
- int
-
-
- void
-
- int
-
-
- x
-
-
-
-
- void
-
- int
-
-
- int
-
-
- x
-
-
- y
-
-
-
-
- void
-
- int
-
-
- int
-
-
- int
-
-
- x
-
-
- y
-
-
-
-
-
-
-";
-
- return ValidateGeneratedXmlLatestUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task ConversionTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- operator int()
- {
- return value;
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- int
- return value;
-
-
-
-
-";
-
- return ValidateGeneratedXmlLatestUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task DefaultParameterInheritedFromTemplateTestImpl()
{
// NOTE: This is a regression test where a struct inherits a function from a template with a default parameter.
@@ -207,32 +52,6 @@ struct MyStruct : public MyTemplate
return ValidateGeneratedXmlLatestUnixBindingsAsync(InputContents, expectedOutputContents);
}
- protected override Task DestructorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- ~MyStruct()
- {
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- void
-
-
-
-
-
-";
-
- return ValidateGeneratedXmlLatestUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task InstanceTestImpl()
{
var inputContents = @"struct MyStruct
@@ -285,223 +104,6 @@ int MyInt32Method()
return ValidateGeneratedXmlLatestUnixBindingsAsync(inputContents, expectedOutputContents);
}
- protected override Task MemberCallTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction1()
- {
- return value;
- }
-
- int MyFunction2()
- {
- return MyFunction1();
- }
-
- int MyFunction3()
- {
- return this->MyFunction1();
- }
-};
-
-int MyFunctionA(MyStruct x)
-{
- return x.MyFunction1();
-}
-
-int MyFunctionB(MyStruct* x)
-{
- return x->MyFunction2();
-}
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- int
- return value;
-
-
- int
- return MyFunction1();
-
-
- int
- return this.MyFunction1();
-
-
-
-
- int
-
- MyStruct
-
- return x.MyFunction1();
-
-
- int
-
- MyStruct*
-
- return x->MyFunction2();
-
-
-
-
-";
-
- return ValidateGeneratedXmlLatestUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task MemberTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction()
- {
- return value;
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- int
- return value;
-
-
-
-
-";
-
- return ValidateGeneratedXmlLatestUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task NewKeywordTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int Equals() { return 0; }
- int Equals(int obj) { return 0; }
- int Dispose() { return 0; }
- int Dispose(int obj) { return 0; }
- int GetHashCode() { return 0; }
- int GetHashCode(int obj) { return 0; }
- int GetType() { return 0; }
- int GetType(int obj) { return 0; }
- int MemberwiseClone() { return 0; }
- int MemberwiseClone(int obj) { return 0; }
- int ReferenceEquals() { return 0; }
- int ReferenceEquals(int obj) { return 0; }
- int ToString() { return 0; }
- int ToString(int obj) { return 0; }
-};";
-
- var expectedOutputContents = $@"
-
-
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
-
-
-";
-
- return ValidateGeneratedXmlLatestUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task NewKeywordVirtualTestImpl()
{
var inputContents = @"struct MyStruct
@@ -711,168 +313,6 @@ protected override Task NewKeywordVirtualWithExplicitVtblAndMarkerInterfaceTestI
return ValidateGeneratedXmlLatestUnixBindingsAsync(inputContents, expectedOutputContents, PInvokeGeneratorConfigurationOptions.GenerateExplicitVtbls | PInvokeGeneratorConfigurationOptions.GenerateMarkerInterfaces);
}
- protected override Task OperatorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- MyStruct(int value) : value(value)
- {
- }
-
- MyStruct operator+(MyStruct rhs)
- {
- return MyStruct(value + rhs.value);
- }
-};
-
-MyStruct operator-(MyStruct lhs, MyStruct rhs)
-{
- return MyStruct(lhs.value - rhs.value);
-}
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- void
-
- int
-
-
- value
-
-
-
-
- MyStruct
-
- MyStruct
-
- return new MyStruct(value + rhs.value);
-
-
-
-
- MyStruct
-
- MyStruct
-
-
- MyStruct
-
- return new MyStruct(lhs.value - rhs.value);
-
-
-
-
-";
-
- return ValidateGeneratedXmlLatestUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task OperatorCallTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- MyStruct(int value) : value(value)
- {
- }
-
- MyStruct operator+(MyStruct rhs)
- {
- return MyStruct(value + rhs.value);
- }
-};
-
-MyStruct MyFunction1(MyStruct lhs, MyStruct rhs)
-{
- return lhs + rhs;
-}
-
-MyStruct operator-(MyStruct lhs, MyStruct rhs)
-{
- return MyStruct(lhs.value - rhs.value);
-}
-
-MyStruct MyFunction2(MyStruct lhs, MyStruct rhs)
-{
- return lhs - rhs;
-}
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- void
-
- int
-
-
- value
-
-
-
-
- MyStruct
-
- MyStruct
-
- return new MyStruct(value + rhs.value);
-
-
-
-
- MyStruct
-
- MyStruct
-
-
- MyStruct
-
- return lhs.Add(rhs);
-
-
- MyStruct
-
- MyStruct
-
-
- MyStruct
-
- return new MyStruct(lhs.value - rhs.value);
-
-
- MyStruct
-
- MyStruct
-
-
- MyStruct
-
- return Subtract(lhs, rhs);
-
-
-
-
-";
-
- return ValidateGeneratedXmlLatestUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task StaticTestImpl()
{
var inputContents = @"struct MyStruct
@@ -921,71 +361,6 @@ static int MyInt32Method()
return ValidateGeneratedXmlLatestUnixBindingsAsync(inputContents, expectedOutputContents);
}
- protected override Task ThisTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction()
- {
- return this->value;
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- int
- return this.value;
-
-
-
-
-";
-
- return ValidateGeneratedXmlLatestUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task UnsafeDoesNotImpactDllImportTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- void* MyVoidStarMethod()
- {
- return nullptr;
- }
-};
-
-extern ""C"" void MyFunction();";
-
- var expectedOutputContents = @"
-
-
-
-
- void*
- return null;
-
-
-
-
- void
-
-
-
-
-";
-
- return ValidateGeneratedXmlLatestUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task VirtualTestImpl()
{
var inputContents = @"struct MyStruct
diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestWindows/CXXMethodDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestWindows/CXXMethodDeclarationTest.cs
index d22ffa78..bcc3b0ce 100644
--- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestWindows/CXXMethodDeclarationTest.cs
+++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestWindows/CXXMethodDeclarationTest.cs
@@ -10,161 +10,6 @@ namespace ClangSharp.UnitTests;
[Platform("win")]
public sealed class XmlLatestWindows_CXXMethodDeclarationTest : CXXMethodDeclarationXmlTest
{
- protected override Task ConstructorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int _value;
-
- MyStruct(int value)
- {
- _value = value;
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- void
-
- int
-
- _value = value;
-
-
-
-
-";
-
- return ValidateGeneratedXmlLatestWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task ConstructorWithInitializeTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int _x;
- int _y;
- int _z;
-
- MyStruct(int x) : _x(x)
- {
- }
-
- MyStruct(int x, int y) : _x(x), _y(y)
- {
- }
-
- MyStruct(int x, int y, int z) : _x(x), _y(y), _z()
- {
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- int
-
-
- int
-
-
- void
-
- int
-
-
- x
-
-
-
-
- void
-
- int
-
-
- int
-
-
- x
-
-
- y
-
-
-
-
- void
-
- int
-
-
- int
-
-
- int
-
-
- x
-
-
- y
-
-
-
-
-
-
-";
-
- return ValidateGeneratedXmlLatestWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task ConversionTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- operator int()
- {
- return value;
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- int
- return value;
-
-
-
-
-";
-
- return ValidateGeneratedXmlLatestWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task DefaultParameterInheritedFromTemplateTestImpl()
{
// NOTE: This is a regression test where a struct inherits a function from a template with a default parameter.
@@ -207,32 +52,6 @@ struct MyStruct : public MyTemplate
return ValidateGeneratedXmlLatestWindowsBindingsAsync(InputContents, expectedOutputContents);
}
- protected override Task DestructorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- ~MyStruct()
- {
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- void
-
-
-
-
-
-";
-
- return ValidateGeneratedXmlLatestWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task InstanceTestImpl()
{
var inputContents = @"struct MyStruct
@@ -285,223 +104,6 @@ int MyInt32Method()
return ValidateGeneratedXmlLatestWindowsBindingsAsync(inputContents, expectedOutputContents);
}
- protected override Task MemberCallTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction1()
- {
- return value;
- }
-
- int MyFunction2()
- {
- return MyFunction1();
- }
-
- int MyFunction3()
- {
- return this->MyFunction1();
- }
-};
-
-int MyFunctionA(MyStruct x)
-{
- return x.MyFunction1();
-}
-
-int MyFunctionB(MyStruct* x)
-{
- return x->MyFunction2();
-}
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- int
- return value;
-
-
- int
- return MyFunction1();
-
-
- int
- return this.MyFunction1();
-
-
-
-
- int
-
- MyStruct
-
- return x.MyFunction1();
-
-
- int
-
- MyStruct*
-
- return x->MyFunction2();
-
-
-
-
-";
-
- return ValidateGeneratedXmlLatestWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task MemberTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction()
- {
- return value;
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- int
- return value;
-
-
-
-
-";
-
- return ValidateGeneratedXmlLatestWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task NewKeywordTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int Equals() { return 0; }
- int Equals(int obj) { return 0; }
- int Dispose() { return 0; }
- int Dispose(int obj) { return 0; }
- int GetHashCode() { return 0; }
- int GetHashCode(int obj) { return 0; }
- int GetType() { return 0; }
- int GetType(int obj) { return 0; }
- int MemberwiseClone() { return 0; }
- int MemberwiseClone(int obj) { return 0; }
- int ReferenceEquals() { return 0; }
- int ReferenceEquals(int obj) { return 0; }
- int ToString() { return 0; }
- int ToString(int obj) { return 0; }
-};";
-
- var expectedOutputContents = $@"
-
-
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
-
-
-";
-
- return ValidateGeneratedXmlLatestWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task NewKeywordVirtualTestImpl()
{
var inputContents = @"struct MyStruct
@@ -711,168 +313,6 @@ protected override Task NewKeywordVirtualWithExplicitVtblAndMarkerInterfaceTestI
return ValidateGeneratedXmlLatestWindowsBindingsAsync(inputContents, expectedOutputContents, PInvokeGeneratorConfigurationOptions.GenerateExplicitVtbls | PInvokeGeneratorConfigurationOptions.GenerateMarkerInterfaces);
}
- protected override Task OperatorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- MyStruct(int value) : value(value)
- {
- }
-
- MyStruct operator+(MyStruct rhs)
- {
- return MyStruct(value + rhs.value);
- }
-};
-
-MyStruct operator-(MyStruct lhs, MyStruct rhs)
-{
- return MyStruct(lhs.value - rhs.value);
-}
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- void
-
- int
-
-
- value
-
-
-
-
- MyStruct
-
- MyStruct
-
- return new MyStruct(value + rhs.value);
-
-
-
-
- MyStruct
-
- MyStruct
-
-
- MyStruct
-
- return new MyStruct(lhs.value - rhs.value);
-
-
-
-
-";
-
- return ValidateGeneratedXmlLatestWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task OperatorCallTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- MyStruct(int value) : value(value)
- {
- }
-
- MyStruct operator+(MyStruct rhs)
- {
- return MyStruct(value + rhs.value);
- }
-};
-
-MyStruct MyFunction1(MyStruct lhs, MyStruct rhs)
-{
- return lhs + rhs;
-}
-
-MyStruct operator-(MyStruct lhs, MyStruct rhs)
-{
- return MyStruct(lhs.value - rhs.value);
-}
-
-MyStruct MyFunction2(MyStruct lhs, MyStruct rhs)
-{
- return lhs - rhs;
-}
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- void
-
- int
-
-
- value
-
-
-
-
- MyStruct
-
- MyStruct
-
- return new MyStruct(value + rhs.value);
-
-
-
-
- MyStruct
-
- MyStruct
-
-
- MyStruct
-
- return lhs.Add(rhs);
-
-
- MyStruct
-
- MyStruct
-
-
- MyStruct
-
- return new MyStruct(lhs.value - rhs.value);
-
-
- MyStruct
-
- MyStruct
-
-
- MyStruct
-
- return Subtract(lhs, rhs);
-
-
-
-
-";
-
- return ValidateGeneratedXmlLatestWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task StaticTestImpl()
{
var inputContents = @"struct MyStruct
@@ -921,71 +361,6 @@ static int MyInt32Method()
return ValidateGeneratedXmlLatestWindowsBindingsAsync(inputContents, expectedOutputContents);
}
- protected override Task ThisTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction()
- {
- return this->value;
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- int
- return this.value;
-
-
-
-
-";
-
- return ValidateGeneratedXmlLatestWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task UnsafeDoesNotImpactDllImportTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- void* MyVoidStarMethod()
- {
- return nullptr;
- }
-};
-
-extern ""C"" void MyFunction();";
-
- var expectedOutputContents = @"
-
-
-
-
- void*
- return null;
-
-
-
-
- void
-
-
-
-
-";
-
- return ValidateGeneratedXmlLatestWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task VirtualTestImpl()
{
var inputContents = @"struct MyStruct
diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlPreviewUnix/CXXMethodDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlPreviewUnix/CXXMethodDeclarationTest.cs
index fd20ea07..a7ce8031 100644
--- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlPreviewUnix/CXXMethodDeclarationTest.cs
+++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlPreviewUnix/CXXMethodDeclarationTest.cs
@@ -10,161 +10,6 @@ namespace ClangSharp.UnitTests;
[Platform("unix")]
public sealed class XmlPreviewUnix_CXXMethodDeclarationTest : CXXMethodDeclarationXmlTest
{
- protected override Task ConstructorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int _value;
-
- MyStruct(int value)
- {
- _value = value;
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- void
-
- int
-
- _value = value;
-
-
-
-
-";
-
- return ValidateGeneratedXmlPreviewUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task ConstructorWithInitializeTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int _x;
- int _y;
- int _z;
-
- MyStruct(int x) : _x(x)
- {
- }
-
- MyStruct(int x, int y) : _x(x), _y(y)
- {
- }
-
- MyStruct(int x, int y, int z) : _x(x), _y(y), _z()
- {
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- int
-
-
- int
-
-
- void
-
- int
-
-
- x
-
-
-
-
- void
-
- int
-
-
- int
-
-
- x
-
-
- y
-
-
-
-
- void
-
- int
-
-
- int
-
-
- int
-
-
- x
-
-
- y
-
-
-
-
-
-
-";
-
- return ValidateGeneratedXmlPreviewUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task ConversionTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- operator int()
- {
- return value;
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- int
- return value;
-
-
-
-
-";
-
- return ValidateGeneratedXmlPreviewUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task DefaultParameterInheritedFromTemplateTestImpl()
{
// NOTE: This is a regression test where a struct inherits a function from a template with a default parameter.
@@ -205,32 +50,6 @@ struct MyStruct : public MyTemplate
return ValidateGeneratedXmlPreviewUnixBindingsAsync(InputContents, expectedOutputContents);
}
- protected override Task DestructorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- ~MyStruct()
- {
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- void
-
-
-
-
-
-";
-
- return ValidateGeneratedXmlPreviewUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task InstanceTestImpl()
{
var inputContents = @"struct MyStruct
@@ -283,223 +102,6 @@ int MyInt32Method()
return ValidateGeneratedXmlPreviewUnixBindingsAsync(inputContents, expectedOutputContents);
}
- protected override Task MemberCallTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction1()
- {
- return value;
- }
-
- int MyFunction2()
- {
- return MyFunction1();
- }
-
- int MyFunction3()
- {
- return this->MyFunction1();
- }
-};
-
-int MyFunctionA(MyStruct x)
-{
- return x.MyFunction1();
-}
-
-int MyFunctionB(MyStruct* x)
-{
- return x->MyFunction2();
-}
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- int
- return value;
-
-
- int
- return MyFunction1();
-
-
- int
- return this.MyFunction1();
-
-
-
-
- int
-
- MyStruct
-
- return x.MyFunction1();
-
-
- int
-
- MyStruct*
-
- return x->MyFunction2();
-
-
-
-
-";
-
- return ValidateGeneratedXmlPreviewUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task MemberTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction()
- {
- return value;
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- int
- return value;
-
-
-
-
-";
-
- return ValidateGeneratedXmlPreviewUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task NewKeywordTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int Equals() { return 0; }
- int Equals(int obj) { return 0; }
- int Dispose() { return 0; }
- int Dispose(int obj) { return 0; }
- int GetHashCode() { return 0; }
- int GetHashCode(int obj) { return 0; }
- int GetType() { return 0; }
- int GetType(int obj) { return 0; }
- int MemberwiseClone() { return 0; }
- int MemberwiseClone(int obj) { return 0; }
- int ReferenceEquals() { return 0; }
- int ReferenceEquals(int obj) { return 0; }
- int ToString() { return 0; }
- int ToString(int obj) { return 0; }
-};";
-
- var expectedOutputContents = $@"
-
-
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
-
-
-";
-
- return ValidateGeneratedXmlPreviewUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task NewKeywordVirtualTestImpl()
{
var inputContents = @"struct MyStruct
@@ -709,168 +311,6 @@ protected override Task NewKeywordVirtualWithExplicitVtblAndMarkerInterfaceTestI
return ValidateGeneratedXmlPreviewUnixBindingsAsync(inputContents, expectedOutputContents, PInvokeGeneratorConfigurationOptions.GenerateExplicitVtbls | PInvokeGeneratorConfigurationOptions.GenerateMarkerInterfaces);
}
- protected override Task OperatorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- MyStruct(int value) : value(value)
- {
- }
-
- MyStruct operator+(MyStruct rhs)
- {
- return MyStruct(value + rhs.value);
- }
-};
-
-MyStruct operator-(MyStruct lhs, MyStruct rhs)
-{
- return MyStruct(lhs.value - rhs.value);
-}
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- void
-
- int
-
-
- value
-
-
-
-
- MyStruct
-
- MyStruct
-
- return new MyStruct(value + rhs.value);
-
-
-
-
- MyStruct
-
- MyStruct
-
-
- MyStruct
-
- return new MyStruct(lhs.value - rhs.value);
-
-
-
-
-";
-
- return ValidateGeneratedXmlPreviewUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task OperatorCallTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- MyStruct(int value) : value(value)
- {
- }
-
- MyStruct operator+(MyStruct rhs)
- {
- return MyStruct(value + rhs.value);
- }
-};
-
-MyStruct MyFunction1(MyStruct lhs, MyStruct rhs)
-{
- return lhs + rhs;
-}
-
-MyStruct operator-(MyStruct lhs, MyStruct rhs)
-{
- return MyStruct(lhs.value - rhs.value);
-}
-
-MyStruct MyFunction2(MyStruct lhs, MyStruct rhs)
-{
- return lhs - rhs;
-}
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- void
-
- int
-
-
- value
-
-
-
-
- MyStruct
-
- MyStruct
-
- return new MyStruct(value + rhs.value);
-
-
-
-
- MyStruct
-
- MyStruct
-
-
- MyStruct
-
- return lhs.Add(rhs);
-
-
- MyStruct
-
- MyStruct
-
-
- MyStruct
-
- return new MyStruct(lhs.value - rhs.value);
-
-
- MyStruct
-
- MyStruct
-
-
- MyStruct
-
- return Subtract(lhs, rhs);
-
-
-
-
-";
-
- return ValidateGeneratedXmlPreviewUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task StaticTestImpl()
{
var inputContents = @"struct MyStruct
@@ -919,71 +359,6 @@ static int MyInt32Method()
return ValidateGeneratedXmlPreviewUnixBindingsAsync(inputContents, expectedOutputContents);
}
- protected override Task ThisTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction()
- {
- return this->value;
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- int
- return this.value;
-
-
-
-
-";
-
- return ValidateGeneratedXmlPreviewUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task UnsafeDoesNotImpactDllImportTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- void* MyVoidStarMethod()
- {
- return nullptr;
- }
-};
-
-extern ""C"" void MyFunction();";
-
- var expectedOutputContents = @"
-
-
-
-
- void*
- return null;
-
-
-
-
- void
-
-
-
-
-";
-
- return ValidateGeneratedXmlPreviewUnixBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task VirtualTestImpl()
{
var inputContents = @"struct MyStruct
diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlPreviewWindows/CXXMethodDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlPreviewWindows/CXXMethodDeclarationTest.cs
index 7fa773bb..84a3add5 100644
--- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlPreviewWindows/CXXMethodDeclarationTest.cs
+++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlPreviewWindows/CXXMethodDeclarationTest.cs
@@ -10,161 +10,6 @@ namespace ClangSharp.UnitTests;
[Platform("win")]
public sealed class XmlPreviewWindows_CXXMethodDeclarationTest : CXXMethodDeclarationXmlTest
{
- protected override Task ConstructorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int _value;
-
- MyStruct(int value)
- {
- _value = value;
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- void
-
- int
-
- _value = value;
-
-
-
-
-";
-
- return ValidateGeneratedXmlPreviewWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task ConstructorWithInitializeTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int _x;
- int _y;
- int _z;
-
- MyStruct(int x) : _x(x)
- {
- }
-
- MyStruct(int x, int y) : _x(x), _y(y)
- {
- }
-
- MyStruct(int x, int y, int z) : _x(x), _y(y), _z()
- {
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- int
-
-
- int
-
-
- void
-
- int
-
-
- x
-
-
-
-
- void
-
- int
-
-
- int
-
-
- x
-
-
- y
-
-
-
-
- void
-
- int
-
-
- int
-
-
- int
-
-
- x
-
-
- y
-
-
-
-
-
-
-";
-
- return ValidateGeneratedXmlPreviewWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task ConversionTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- operator int()
- {
- return value;
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- int
- return value;
-
-
-
-
-";
-
- return ValidateGeneratedXmlPreviewWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task DefaultParameterInheritedFromTemplateTestImpl()
{
// NOTE: This is a regression test where a struct inherits a function from a template with a default parameter.
@@ -206,32 +51,6 @@ struct MyStruct : public MyTemplate
return ValidateGeneratedXmlPreviewWindowsBindingsAsync(InputContents, expectedOutputContents);
}
- protected override Task DestructorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- ~MyStruct()
- {
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- void
-
-
-
-
-
-";
-
- return ValidateGeneratedXmlPreviewWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task InstanceTestImpl()
{
var inputContents = @"struct MyStruct
@@ -284,223 +103,6 @@ int MyInt32Method()
return ValidateGeneratedXmlPreviewWindowsBindingsAsync(inputContents, expectedOutputContents);
}
- protected override Task MemberCallTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction1()
- {
- return value;
- }
-
- int MyFunction2()
- {
- return MyFunction1();
- }
-
- int MyFunction3()
- {
- return this->MyFunction1();
- }
-};
-
-int MyFunctionA(MyStruct x)
-{
- return x.MyFunction1();
-}
-
-int MyFunctionB(MyStruct* x)
-{
- return x->MyFunction2();
-}
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- int
- return value;
-
-
- int
- return MyFunction1();
-
-
- int
- return this.MyFunction1();
-
-
-
-
- int
-
- MyStruct
-
- return x.MyFunction1();
-
-
- int
-
- MyStruct*
-
- return x->MyFunction2();
-
-
-
-
-";
-
- return ValidateGeneratedXmlPreviewWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task MemberTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction()
- {
- return value;
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- int
- return value;
-
-
-
-
-";
-
- return ValidateGeneratedXmlPreviewWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task NewKeywordTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int Equals() { return 0; }
- int Equals(int obj) { return 0; }
- int Dispose() { return 0; }
- int Dispose(int obj) { return 0; }
- int GetHashCode() { return 0; }
- int GetHashCode(int obj) { return 0; }
- int GetType() { return 0; }
- int GetType(int obj) { return 0; }
- int MemberwiseClone() { return 0; }
- int MemberwiseClone(int obj) { return 0; }
- int ReferenceEquals() { return 0; }
- int ReferenceEquals(int obj) { return 0; }
- int ToString() { return 0; }
- int ToString(int obj) { return 0; }
-};";
-
- var expectedOutputContents = $@"
-
-
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
- int
- return 0;
-
-
- int
-
- int
-
- return 0;
-
-
-
-
-";
-
- return ValidateGeneratedXmlPreviewWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task NewKeywordVirtualTestImpl()
{
var inputContents = @"struct MyStruct
@@ -710,168 +312,6 @@ protected override Task NewKeywordVirtualWithExplicitVtblAndMarkerInterfaceTestI
return ValidateGeneratedXmlPreviewWindowsBindingsAsync(inputContents, expectedOutputContents, PInvokeGeneratorConfigurationOptions.GenerateExplicitVtbls | PInvokeGeneratorConfigurationOptions.GenerateMarkerInterfaces);
}
- protected override Task OperatorTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- MyStruct(int value) : value(value)
- {
- }
-
- MyStruct operator+(MyStruct rhs)
- {
- return MyStruct(value + rhs.value);
- }
-};
-
-MyStruct operator-(MyStruct lhs, MyStruct rhs)
-{
- return MyStruct(lhs.value - rhs.value);
-}
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- void
-
- int
-
-
- value
-
-
-
-
- MyStruct
-
- MyStruct
-
- return new MyStruct(value + rhs.value);
-
-
-
-
- MyStruct
-
- MyStruct
-
-
- MyStruct
-
- return new MyStruct(lhs.value - rhs.value);
-
-
-
-
-";
-
- return ValidateGeneratedXmlPreviewWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task OperatorCallTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- MyStruct(int value) : value(value)
- {
- }
-
- MyStruct operator+(MyStruct rhs)
- {
- return MyStruct(value + rhs.value);
- }
-};
-
-MyStruct MyFunction1(MyStruct lhs, MyStruct rhs)
-{
- return lhs + rhs;
-}
-
-MyStruct operator-(MyStruct lhs, MyStruct rhs)
-{
- return MyStruct(lhs.value - rhs.value);
-}
-
-MyStruct MyFunction2(MyStruct lhs, MyStruct rhs)
-{
- return lhs - rhs;
-}
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- void
-
- int
-
-
- value
-
-
-
-
- MyStruct
-
- MyStruct
-
- return new MyStruct(value + rhs.value);
-
-
-
-
- MyStruct
-
- MyStruct
-
-
- MyStruct
-
- return lhs.Add(rhs);
-
-
- MyStruct
-
- MyStruct
-
-
- MyStruct
-
- return new MyStruct(lhs.value - rhs.value);
-
-
- MyStruct
-
- MyStruct
-
-
- MyStruct
-
- return Subtract(lhs, rhs);
-
-
-
-
-";
-
- return ValidateGeneratedXmlPreviewWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task StaticTestImpl()
{
var inputContents = @"struct MyStruct
@@ -920,71 +360,6 @@ static int MyInt32Method()
return ValidateGeneratedXmlPreviewWindowsBindingsAsync(inputContents, expectedOutputContents);
}
- protected override Task ThisTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- int value;
-
- int MyFunction()
- {
- return this->value;
- }
-};
-";
-
- var expectedOutputContents = @"
-
-
-
-
- int
-
-
- int
- return this.value;
-
-
-
-
-";
-
- return ValidateGeneratedXmlPreviewWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
- protected override Task UnsafeDoesNotImpactDllImportTestImpl()
- {
- var inputContents = @"struct MyStruct
-{
- void* MyVoidStarMethod()
- {
- return nullptr;
- }
-};
-
-extern ""C"" void MyFunction();";
-
- var expectedOutputContents = @"
-
-
-
-
- void*
- return null;
-
-
-
-
- void
-
-
-
-
-";
-
- return ValidateGeneratedXmlPreviewWindowsBindingsAsync(inputContents, expectedOutputContents);
- }
-
protected override Task VirtualTestImpl()
{
var inputContents = @"struct MyStruct