Skip to content

Commit

Permalink
[doc] Add unit test advice for DRAKE_DEFAULT_COPY...
Browse files Browse the repository at this point in the history
  • Loading branch information
jwnimmer-tri committed Oct 6, 2021
1 parent 8f79cd8 commit ec2fdbc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions common/drake_copyable.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ class Foo {
// ...
};
When unit testing uses of this macro, it is usually sufficient to check only
one of the functions; usually the copy constructor is the easiest one to check.
Because the implementations are defaulted, we can reason by induction that
either all of them pass or all of them fail. If it is important for
performance that the move functions actually move (instead of making a copy),
then check for that as well. Any tests beyond those two cases woulld usually
be unnecessary bloat to the unit test.
</pre>
*/
#define DRAKE_DEFAULT_COPY_AND_MOVE_AND_ASSIGN(Classname) \
Expand Down

0 comments on commit ec2fdbc

Please sign in to comment.