Skip to content

Commit

Permalink
dummy
Browse files Browse the repository at this point in the history
  • Loading branch information
trungnt2910 committed Jul 21, 2023
1 parent 4bff272 commit 0b4d593
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/dotnet/CSharp/CSharp.Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1988,4 +1988,11 @@ public void TestCallByValueCppToCSharpPointer()
Assert.That(RuleOfThreeTester.CopyConstructorCalls, Is.EqualTo(0));
Assert.That(RuleOfThreeTester.CopyAssignmentCalls, Is.EqualTo(0));
}

[Test]
public void TestPointerToClass()
{
Assert.IsTrue(CSharp.CSharp.PointerToClass.IsDefaultInstance);
Assert.IsTrue(CSharp.CSharp.PointerToClass.IsValid);
}
}
19 changes: 19 additions & 0 deletions tests/dotnet/CSharp/CSharp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1772,3 +1772,22 @@ void CallCallByValueInterfacePointer(CallByValueInterface* interface)
RuleOfThreeTester value;
interface->CallByPointer(&value);
}

static PointerTester internalPointerTesterInstance;

PointerTester::PointerTester()
{
a = 0;
}

bool PointerTester::IsDefaultInstance()
{
return this == &internalPointerTesterInstance;
}

bool PointerTester::IsValid()
{
return a == 0;
}

PointerTester* PointerToClass = &internalPointerTesterInstance;
11 changes: 11 additions & 0 deletions tests/dotnet/CSharp/CSharp.h
Original file line number Diff line number Diff line change
Expand Up @@ -1592,3 +1592,14 @@ struct DLL_API CallByValueInterface {
void DLL_API CallCallByValueInterfaceValue(CallByValueInterface*);
void DLL_API CallCallByValueInterfaceReference(CallByValueInterface*);
void DLL_API CallCallByValueInterfacePointer(CallByValueInterface*);

class DLL_API PointerTester
{
int a;
public:
PointerTester();
bool IsDefaultInstance();
bool IsValid();
};

DLL_API extern PointerTester* PointerToClass;

0 comments on commit 0b4d593

Please sign in to comment.