diff --git a/tests/Basic/Basic.Tests.cs b/tests/Basic/Basic.Tests.cs index dcf25e84..63011321 100644 --- a/tests/Basic/Basic.Tests.cs +++ b/tests/Basic/Basic.Tests.cs @@ -77,6 +77,28 @@ public class BasicTests : GeneratorTestFixture Assert.That(f, Is.EqualTo(10.0f)); } + [Test] + public void TestEnumOut() + { + var hello = new Hello(); + + int value = (int)Enum.C; + Enum e; + hello.EnumOut(value, out e); + Assert.That(e, Is.EqualTo(value)); + } + + [Test] + public void TestEnumOutRef() + { + var hello = new Hello(); + + int value = (int)Enum.C; + Enum e; + hello.EnumOutRef(value, out e); + Assert.That(e, Is.EqualTo(value)); + } + [Test] public void TestNullRef() { diff --git a/tests/Basic/Basic.cpp b/tests/Basic/Basic.cpp index 48547de4..b3e674fd 100644 --- a/tests/Basic/Basic.cpp +++ b/tests/Basic/Basic.cpp @@ -169,6 +169,16 @@ bool Hello::TestPrimitiveOutRef(CS_OUT float& f) return true; } +void Hello::EnumOut(int value, CS_OUT Enum* e) +{ + *e = (Enum)value; +} + +void Hello::EnumOutRef(int value, CS_OUT Enum& e) +{ + e = (Enum)value; +} + int unsafeFunction(const Bar& ret, char* testForString, void (*foo)(int)) { return ret.A; diff --git a/tests/Basic/Basic.cs b/tests/Basic/Basic.cs index fbf14581..e6615279 100644 --- a/tests/Basic/Basic.cs +++ b/tests/Basic/Basic.cs @@ -31,6 +31,8 @@ namespace CppSharp.Tests ctx.SetClassAsValueType("Bar2"); ctx.SetMethodParameterUsage("Hello", "TestPrimitiveOut", 1, ParameterUsage.Out); ctx.SetMethodParameterUsage("Hello", "TestPrimitiveOutRef", 1, ParameterUsage.Out); + ctx.SetMethodParameterUsage("Hello", "EnumOut", 2, ParameterUsage.Out); + ctx.SetMethodParameterUsage("Hello", "EnumOutRef", 2, ParameterUsage.Out); } public static void Main(string[] args) diff --git a/tests/Basic/Basic.h b/tests/Basic/Basic.h index cebe6778..746d0f33 100644 --- a/tests/Basic/Basic.h +++ b/tests/Basic/Basic.h @@ -123,6 +123,9 @@ public: bool TestPrimitiveOut(CS_OUT float* f); bool TestPrimitiveOutRef(CS_OUT float& f); + + void EnumOut(int value, CS_OUT Enum* e); + void EnumOutRef(int value, CS_OUT Enum& e); }; class DLL_API AbstractFoo