diff --git a/tests/Basic/Basic.Tests.cs b/tests/Basic/Basic.Tests.cs index d9984a7c..43d9022c 100644 --- a/tests/Basic/Basic.Tests.cs +++ b/tests/Basic/Basic.Tests.cs @@ -116,6 +116,26 @@ public class BasicTests : GeneratorTestFixture Assert.That(e, Is.EqualTo(Enum.C)); } + [Test] + public void TestEnumInOut() + { + var hello = new Hello(); + + var e = Enum.E; + hello.EnumInOut(ref e); + Assert.That(e, Is.EqualTo(Enum.F)); + } + + [Test] + public void TestEnumInOutRef() + { + var hello = new Hello(); + + var e = Enum.E; + hello.EnumInOut(ref e); + Assert.That(e, Is.EqualTo(Enum.F)); + } + [Test] public void TestNullRef() { @@ -368,15 +388,5 @@ public class BasicTests : GeneratorTestFixture var ret = basic.TestNullPtrTypeRet(); Assert.AreEqual(IntPtr.Zero, new IntPtr(ret)); } - - [Test] - public void TestValueTypeInheritance() - { - var bar2 = new Bar2 { A = 24 }; - Assert.That(bar2.RetItem1(), Is.EqualTo(Bar.Item.Item1)); - Assert.That(bar2.returnPointerToValueType().A, Is.EqualTo(24)); - var inheritTestIndexedPropertiesInValueType = new InheritTestIndexedPropertiesInValueType(); - Assert.That(inheritTestIndexedPropertiesInValueType[2], Is.EqualTo(2)); - } } \ No newline at end of file diff --git a/tests/Basic/Basic.cpp b/tests/Basic/Basic.cpp index 73859d4e..4db6854a 100644 --- a/tests/Basic/Basic.cpp +++ b/tests/Basic/Basic.cpp @@ -191,6 +191,18 @@ void Hello::EnumOutRef(int value, CS_OUT Enum& e) e = (Enum)value; } +void Hello::EnumInOut(CS_IN_OUT Enum* e) +{ + if (*e == Enum::E) + *e = Enum::F; +} + +void Hello::EnumInOutRef(CS_IN_OUT Enum& e) +{ + if (e == Enum::E) + e = Enum::F; +} + 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 d9e0b9ef..750dc53d 100644 --- a/tests/Basic/Basic.cs +++ b/tests/Basic/Basic.cs @@ -35,6 +35,8 @@ namespace CppSharp.Tests ctx.SetMethodParameterUsage("Hello", "TestPrimitiveInOutRef", 1, ParameterUsage.InOut); ctx.SetMethodParameterUsage("Hello", "EnumOut", 2, ParameterUsage.Out); ctx.SetMethodParameterUsage("Hello", "EnumOutRef", 2, ParameterUsage.Out); + ctx.SetMethodParameterUsage("Hello", "EnumInOut", 1, ParameterUsage.InOut); + ctx.SetMethodParameterUsage("Hello", "EnumInOutRef", 1, ParameterUsage.InOut); } public static void Main(string[] args) diff --git a/tests/Basic/Basic.h b/tests/Basic/Basic.h index 296c56d3..8736b05f 100644 --- a/tests/Basic/Basic.h +++ b/tests/Basic/Basic.h @@ -129,6 +129,9 @@ public: void EnumOut(int value, CS_OUT Enum* e); void EnumOutRef(int value, CS_OUT Enum& e); + + void EnumInOut(CS_IN_OUT Enum* e); + void EnumInOutRef(CS_IN_OUT Enum& e); }; class DLL_API AbstractFoo @@ -433,7 +436,7 @@ const foo_t& TestIndexedProperties::operator[](double f) { return p; } TestProperties* TestIndexedProperties::operator[](unsigned char b) { return &f; } const TestProperties& TestIndexedProperties::operator[](short b) { return f; } -struct DLL_API CS_VALUETYPE TestIndexedPropertiesInValueType +struct DLL_API TestIndexedPropertiesInValueType { public: int operator[](int i); @@ -441,10 +444,6 @@ public: int TestIndexedPropertiesInValueType::operator[](int i) { return i; } -struct DLL_API CS_VALUETYPE InheritTestIndexedPropertiesInValueType : public TestIndexedPropertiesInValueType -{ -}; - enum struct MyEnum { A, B, C }; class DLL_API TestArraysPointers