mirror of https://github.com/mono/CppSharp.git
5 changed files with 49 additions and 2 deletions
@ -0,0 +1,27 @@ |
|||||||
|
using System; |
||||||
|
using NUnit.Framework; |
||||||
|
|
||||||
|
namespace Tests { |
||||||
|
|
||||||
|
[TestFixture] |
||||||
|
public class FieldTests { |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void TestReadCppObject () |
||||||
|
{ |
||||||
|
var hf1 = new HasField (1, null); |
||||||
|
var hf2 = new HasField (2, hf1); |
||||||
|
var hf3 = new HasField (3, hf2); |
||||||
|
|
||||||
|
Assert.IsNull (hf1.other, "#1"); |
||||||
|
Assert.AreEqual (1, hf1.number); |
||||||
|
|
||||||
|
Assert.AreSame (hf2.other, hf1, "#2"); |
||||||
|
Assert.AreEqual (1, hf2.other.number); |
||||||
|
|
||||||
|
Assert.AreSame (hf3.other.other, hf1, "#3"); |
||||||
|
Assert.AreEqual (1, hf3.other.other.number, "#4"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
@ -0,0 +1,8 @@ |
|||||||
|
|
||||||
|
#include "FieldTests.h" |
||||||
|
|
||||||
|
HasField::HasField (int number, HasField* other) |
||||||
|
{ |
||||||
|
this->number = number; |
||||||
|
this->other = other; |
||||||
|
} |
@ -0,0 +1,7 @@ |
|||||||
|
|
||||||
|
class HasField { |
||||||
|
public: |
||||||
|
int number; |
||||||
|
HasField* other; |
||||||
|
HasField (int number, HasField* other); |
||||||
|
}; |
Loading…
Reference in new issue