EntryList
Basic tests
of insert(), update(), remove(),
and getEntry:
-
Create an EntryList; insert a number of entries; check
that contents of the list are correct.
-
Update some of the entries; check that the contents of the list
are correct.
-
getEntry() returns the desired entry in the ret
reference variable. Similarly, remove() returns the entry
that was removed in ret.
-
Remove some of the entries; check that the contents are correct.
-
Check that entries are ordered by increasing vertex after some
combination of insertions and removals.
-
Check that there are no duplicate vertex values in the entries
after some combination of insertions and removals.
Tests of the copy constructor and assignment operator:
-
Copy and assignment create a copy with the correct data.
-
Copy and assignment create a deep copy.
-
Copy and assignment function correctly when the source object is
empty.
-
Assignment protects against self-assignment.
Miscellaneous tests:
-
All functions that return a bool status return the
correct value.
-
at(int indx) throws range_error if indx
is not a valid index.
-
Expansion functions correctly. For example, insert 10
entries; check capacity; insert another entry; capacity should
double.
-
Contraction functions correctly. For example, insert 11 entries;
check capacity; remove seven entries (so size falls to four);
check capacity.
-
Iterator-based for loop lists entries in array order and
terminates correctly.
-
Iterator-based for loop functions correctly for an
empty EntryList.
-
*begin() returns first element of
non-empty EntryList; begin() != end() unless
the EntryList is empty.
-
Test for memory leaks and errors using Valgrind.
Graph
Basic tests of constructor, addEdge(),
and removeEdge():
-
Constructor throws invalid_argument if \(n \leq 0\).
-
Perform combinations of insertions and deletions, checking that
the contents of the data structure are correct.
-
addEdge() and removeEdge()
throw invalid_argument if passed an invalid vertex
number.
Tests of the copy constructor and assignment operator:
-
Copy and assignment create a copy with the correct data.
-
Copy and assignment create a deep copy.
-
Copy and assignment function correctly when the source object is
empty.
-
Assignment protects against self-assignment.
Tests of the edge iterator:
-
Edge iterator functions correctly when every vertex has one or
more neighbors.
-
Edge iterator functions correctly when one or more vertex has no
neighbors; includes the possibility of two or
more consecutive vertices having no neighbors.
-
Dereference and increment throw invalid_argument when
applied to an uninitialized iterator.
-
*egBegin() returns first edge of a
non-empty Graph; egBegin() != egEnd() unless
the Graph has no edges.
Tests of the neighbor iterator:
-
Neighbor iterator functions correctly for vertices having one or
more neighbors.
-
Neighbor iterator functions correctly for vertices
having no neighbors.
-
Dereference and increment throw invalid_argument when
applied to an uninitialized iterator.
-
*nbBegin() returns first neighbor of a
vertex; nbBegin() != nbEnd() unless the vertex has no
neighbors.