diff --git a/tests/Basic/Basic.Tests.cs b/tests/Basic/Basic.Tests.cs index e5674ce2..d4831120 100644 --- a/tests/Basic/Basic.Tests.cs +++ b/tests/Basic/Basic.Tests.cs @@ -225,5 +225,14 @@ public class BasicTests : GeneratorTestFixture var someStruct = new SomeStruct(); Assert.That(someStruct[0], Is.EqualTo(1)); } + + [Test] + public unsafe void TestOperators() + { + var @class = new ClassWithOverloadedOperators(); + Assert.AreEqual(1, (char) @class); + Assert.AreEqual(2, (int)@class); + Assert.AreEqual(3, (short)@class); + } } \ No newline at end of file diff --git a/tests/Basic/Basic.h b/tests/Basic/Basic.h index 83f93fc7..5888b009 100644 --- a/tests/Basic/Basic.h +++ b/tests/Basic/Basic.h @@ -304,7 +304,7 @@ struct EmptyNamedNestedEnum }; typedef unsigned long foo_t; -typedef DLL_API struct SomeStruct +typedef struct DLL_API SomeStruct { SomeStruct() : p(1) {} const foo_t& operator[](int i) const { return p; } @@ -313,13 +313,13 @@ typedef DLL_API struct SomeStruct } SomeStruct; -class SomeClassExtendingTheStruct : public SomeStruct +class DLL_API SomeClassExtendingTheStruct : public SomeStruct { }; namespace SomeNamespace { - class AbstractClass + class DLL_API AbstractClass { public: virtual void AbstractMethod() = 0; @@ -327,10 +327,10 @@ namespace SomeNamespace } // Test operator overloads -class ClassWithOverloadedOperators +class DLL_API ClassWithOverloadedOperators { public: - operator char(); - operator int(); - operator short(); + operator char() { return 1; } + operator int() { return 2; } + operator short() { return 3; } };