Skip to content

Rule of three for Client #306

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Oct 4, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions SampleProjects/TestSomething/test/clientServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@ unittest(Client) {
}

unittest(Client_copy_constructor) {
Client client1;
Client client2;
client2 = client1;
assertTrue(true);
{ // Client object contains a reference to a String object
Client c1; // Constructor instantiates a String (s1)
Client c2; // Constructor instantiates a String (s2)
c2 = c1; // Does c2 get a reference to s1 or a copy of it?
} // End of scope calls destructor on c1 and c2
assertTrue(true); // Was s1 deleted once (with c1) or twice (also with c2)?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it just me or does this comment not match the assertion (yet)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not just you! @prestoncarman thought it was still not very clear so I've updated the tests and comments. Let me know if the new code looks better!

// Was s2 deleted at all (should be during assignment)?
}

unittest(IPAddress) {
Expand Down