Browse Source

Fixed the remaining tests from the pull request.

pull/219/merge
triton 12 years ago
parent
commit
46f92e30d0
  1. 9
      tests/Basic/Basic.Tests.cs
  2. 14
      tests/Basic/Basic.h

9
tests/Basic/Basic.Tests.cs

@ -225,5 +225,14 @@ public class BasicTests : GeneratorTestFixture
var someStruct = new SomeStruct(); var someStruct = new SomeStruct();
Assert.That(someStruct[0], Is.EqualTo(1)); 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);
}
} }

14
tests/Basic/Basic.h

@ -304,7 +304,7 @@ struct EmptyNamedNestedEnum
}; };
typedef unsigned long foo_t; typedef unsigned long foo_t;
typedef DLL_API struct SomeStruct typedef struct DLL_API SomeStruct
{ {
SomeStruct() : p(1) {} SomeStruct() : p(1) {}
const foo_t& operator[](int i) const { return p; } const foo_t& operator[](int i) const { return p; }
@ -313,13 +313,13 @@ typedef DLL_API struct SomeStruct
} }
SomeStruct; SomeStruct;
class SomeClassExtendingTheStruct : public SomeStruct class DLL_API SomeClassExtendingTheStruct : public SomeStruct
{ {
}; };
namespace SomeNamespace namespace SomeNamespace
{ {
class AbstractClass class DLL_API AbstractClass
{ {
public: public:
virtual void AbstractMethod() = 0; virtual void AbstractMethod() = 0;
@ -327,10 +327,10 @@ namespace SomeNamespace
} }
// Test operator overloads // Test operator overloads
class ClassWithOverloadedOperators class DLL_API ClassWithOverloadedOperators
{ {
public: public:
operator char(); operator char() { return 1; }
operator int(); operator int() { return 2; }
operator short(); operator short() { return 3; }
}; };

Loading…
Cancel
Save