tests/include/23.list.h
tests/src/23.list.cpp
tests/containers/23.list.iterators.cpp
This test (based on 21.string.iterators test) exercises the following
list class methods: begin, end, rbegin, rend, front, back, get_allocator.
There are several notes:
1. 23.list.* is based on 21.strings.* and adapted for the list. But
it looks similar to strings, so I suugest to move the common code to
separate files and reuse it in the containres and strings tests.
2. Two types are used as list elements: POD (char) and NonPOD (struct
X from alg_test.h). But for testing the char and X by the same way it is
needed to adapt the functions from rw_char.h to the type X (rw_expand,
rw_match, ...). I created the temporary functions rw_expand, rw_match
for the type X (defined in 23.list.*). But the rw_match analogue for the
type X is not completely conform to other rw_match'es - it cannot work
with strings which contain "@" and requires expand. Are we needed in
such strings in the container's tests?.
Also maybe it will be useful to add the method X::to_char () (like
UserChar::to_char ()). Currently the test uses the static function
to_char defined in 23.list.h.
3. ListTestCase was expanded from the StringTestCase structure by
adding additional members (functors Predicate, BinaryPredicate, Compare)
for the methods remove_if, unique, merge, sort. I think it should be
enough to define these members as a pointer to a function to leave
ListTestCase non-template. ListTestCaseData<T> contains the functors
pred_, bpred_, comp_ to be passed to the methods mentioned above. These
functors use the pointer corresponding to the function from ListTestCase.
4. ListStateT currently cannot be used in tests modifying the list
object. I think ListStateT::assert_equal should have an additional
argument of type ListTestCaseData to detect which iterators and
references should be changed by the test to not compare them.
Farid.