Skip to content

Commit 60aaf56

Browse files
committed
call by value test code cleanup
1 parent f201b43 commit 60aaf56

File tree

3 files changed

+20
-19
lines changed

3 files changed

+20
-19
lines changed

tests/dotnet/CSharp/CSharp.Tests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1997,17 +1997,17 @@ public void TestPointerToClass()
19971997
}
19981998

19991999
[Test]
2000-
public void TestObjectPassByValue1451()
2000+
public void TestCallByValueCopyConstructor()
20012001
{
2002-
using (var s = new Issue1451())
2002+
using (var s = new CallByValueCopyConstructor())
20032003
{
20042004
s.A = 500;
2005-
Assert.IsTrue(CSharp.CSharp.TestObjectPassByValue(s));
2005+
CSharp.CSharp.CallByValueCopyConstructorFunction(s);
20062006
Assert.That(s.A, Is.EqualTo(500));
20072007
}
20082008

2009-
Assert.That(Issue1451.ConstructorCalls, Is.EqualTo(1));
2010-
Assert.That(Issue1451.CopyConstructorCalls, Is.EqualTo(1));
2011-
Assert.That(Issue1451.DestructorCalls, Is.EqualTo(2));
2009+
Assert.That(CallByValueCopyConstructor.ConstructorCalls, Is.EqualTo(1));
2010+
Assert.That(CallByValueCopyConstructor.CopyConstructorCalls, Is.EqualTo(1));
2011+
Assert.That(CallByValueCopyConstructor.DestructorCalls, Is.EqualTo(2));
20122012
}
20132013
}

tests/dotnet/CSharp/CSharp.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1791,29 +1791,29 @@ bool PointerTester::IsValid()
17911791
}
17921792

17931793
PointerTester* PointerToClass = &internalPointerTesterInstance;
1794-
int Issue1451::constructorCalls = 0;
1795-
int Issue1451::destructorCalls = 0;
1796-
int Issue1451::copyConstructorCalls = 0;
17971794

1798-
Issue1451::Issue1451()
1795+
int CallByValueCopyConstructor::constructorCalls = 0;
1796+
int CallByValueCopyConstructor::destructorCalls = 0;
1797+
int CallByValueCopyConstructor::copyConstructorCalls = 0;
1798+
1799+
CallByValueCopyConstructor::CallByValueCopyConstructor()
17991800
{
18001801
a = 0;
18011802
constructorCalls++;
18021803
}
18031804

1804-
Issue1451::Issue1451(const Issue1451& other)
1805+
CallByValueCopyConstructor::CallByValueCopyConstructor(const CallByValueCopyConstructor& other)
18051806
{
18061807
a = other.a;
18071808
copyConstructorCalls++;
18081809
}
18091810

1810-
Issue1451::~Issue1451()
1811+
CallByValueCopyConstructor::~CallByValueCopyConstructor()
18111812
{
18121813
destructorCalls++;
18131814
}
18141815

1815-
bool TestObjectPassByValue(Issue1451 s)
1816+
void CallByValueCopyConstructorFunction(CallByValueCopyConstructor s)
18161817
{
18171818
s.a = 99999;
1818-
return true;
18191819
}

tests/dotnet/CSharp/CSharp.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1603,15 +1603,16 @@ class DLL_API PointerTester
16031603
};
16041604

16051605
DLL_API extern PointerTester* PointerToClass;
1606-
struct DLL_API Issue1451 {
1606+
1607+
struct DLL_API CallByValueCopyConstructor {
16071608
int a;
16081609
static int constructorCalls;
16091610
static int destructorCalls;
16101611
static int copyConstructorCalls;
16111612

1612-
Issue1451();
1613-
~Issue1451();
1614-
Issue1451(const Issue1451& other);
1613+
CallByValueCopyConstructor();
1614+
~CallByValueCopyConstructor();
1615+
CallByValueCopyConstructor(const CallByValueCopyConstructor& other);
16151616
};
16161617

1617-
bool DLL_API TestObjectPassByValue(Issue1451 s);
1618+
DLL_API void CallByValueCopyConstructorFunction(CallByValueCopyConstructor s);

0 commit comments

Comments
 (0)