Skip to content

Commit 57f6046

Browse files
author
Fabio Anderegg
committed
call by value test code cleanup
1 parent 54a6fb0 commit 57f6046

File tree

3 files changed

+18
-19
lines changed

3 files changed

+18
-19
lines changed

tests/CSharp/CSharp.Tests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1986,17 +1986,17 @@ public void TestCallByValueCppToCSharpPointer()
19861986
}
19871987

19881988
[Test]
1989-
public void TestObjectPassByValue1451()
1989+
public void TestCallByValueCopyConstructor()
19901990
{
1991-
using (var s = new Issue1451())
1991+
using (var s = new CallByValueCopyConstructor())
19921992
{
19931993
s.A = 500;
1994-
Assert.IsTrue(CSharp.CSharp.TestObjectPassByValue(s));
1994+
CSharp.CSharp.CallByValueCopyConstructorFunction(s);
19951995
Assert.That(s.A, Is.EqualTo(500));
19961996
}
19971997

1998-
Assert.That(Issue1451.ConstructorCalls, Is.EqualTo(1));
1999-
Assert.That(Issue1451.CopyConstructorCalls, Is.EqualTo(1));
2000-
Assert.That(Issue1451.DestructorCalls, Is.EqualTo(2));
1998+
Assert.That(CallByValueCopyConstructor.ConstructorCalls, Is.EqualTo(1));
1999+
Assert.That(CallByValueCopyConstructor.CopyConstructorCalls, Is.EqualTo(1));
2000+
Assert.That(CallByValueCopyConstructor.DestructorCalls, Is.EqualTo(2));
20012001
}
20022002
}

tests/CSharp/CSharp.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1751,29 +1751,28 @@ void CallCallByValueInterfacePointer(CallByValueInterface* interface)
17511751
interface->CallByPointer(&value);
17521752
}
17531753

1754-
int Issue1451::constructorCalls = 0;
1755-
int Issue1451::destructorCalls = 0;
1756-
int Issue1451::copyConstructorCalls = 0;
1754+
int CallByValueCopyConstructor::constructorCalls = 0;
1755+
int CallByValueCopyConstructor::destructorCalls = 0;
1756+
int CallByValueCopyConstructor::copyConstructorCalls = 0;
17571757

1758-
Issue1451::Issue1451()
1758+
CallByValueCopyConstructor::CallByValueCopyConstructor()
17591759
{
17601760
a = 0;
17611761
constructorCalls++;
17621762
}
17631763

1764-
Issue1451::Issue1451(const Issue1451& other)
1764+
CallByValueCopyConstructor::CallByValueCopyConstructor(const CallByValueCopyConstructor& other)
17651765
{
17661766
a = other.a;
17671767
copyConstructorCalls++;
17681768
}
17691769

1770-
Issue1451::~Issue1451()
1770+
CallByValueCopyConstructor::~CallByValueCopyConstructor()
17711771
{
17721772
destructorCalls++;
17731773
}
17741774

1775-
bool TestObjectPassByValue(Issue1451 s)
1775+
void CallByValueCopyConstructorFunction(CallByValueCopyConstructor s)
17761776
{
17771777
s.a = 99999;
1778-
return true;
17791778
}

tests/CSharp/CSharp.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1583,15 +1583,15 @@ void DLL_API CallCallByValueInterfaceValue(CallByValueInterface*);
15831583
void DLL_API CallCallByValueInterfaceReference(CallByValueInterface*);
15841584
void DLL_API CallCallByValueInterfacePointer(CallByValueInterface*);
15851585

1586-
struct DLL_API Issue1451 {
1586+
struct DLL_API CallByValueCopyConstructor {
15871587
int a;
15881588
static int constructorCalls;
15891589
static int destructorCalls;
15901590
static int copyConstructorCalls;
15911591

1592-
Issue1451();
1593-
~Issue1451();
1594-
Issue1451(const Issue1451& other);
1592+
CallByValueCopyConstructor();
1593+
~CallByValueCopyConstructor();
1594+
CallByValueCopyConstructor(const CallByValueCopyConstructor& other);
15951595
};
15961596

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

0 commit comments

Comments
 (0)