CxxTest/cxxtest — Issue #29: Comparison functions have side effects (object copy)
Author: whart222
Created: 2012-02-04 18:07:32+00:00
State: open

The definitions of the comparison function templates in TestSuite.h (equals,
differs, lessThan, etc) cause copies of their arguments to be created. Two
implications are:

1. Unintended side effects from object copies may affect the results of the test.

2. Uncopyable objects cannot be tested; the tests will fail to compile.

The arguments for the comparison functions should be taken as
reference-to-const. For example, instead of:

template equals(X x, Y y) ...

use:

template equals (const X& x, const Y& y)