Checks that when iterating |list| (either from head to tail, or from tail to head, as determined by |forward|), we get back |node_ids|, which is an array of size |num_nodes|.
| 35 | // tail to head, as determined by |forward|), we get back |node_ids|, |
| 36 | // which is an array of size |num_nodes|. |
| 37 | void ExpectListContentsForDirection(const LinkedList<Node>& list, |
| 38 | int num_nodes, const int* node_ids, bool forward) { |
| 39 | int i = 0; |
| 40 | for (const LinkNode<Node>* node = (forward ? list.head() : list.tail()); |
| 41 | node != list.end(); |
| 42 | node = (forward ? node->next() : node->previous())) { |
| 43 | ASSERT_LT(i, num_nodes); |
| 44 | int index_of_id = forward ? i : num_nodes - i - 1; |
| 45 | EXPECT_EQ(node_ids[index_of_id], node->value()->id()); |
| 46 | ++i; |
| 47 | } |
| 48 | EXPECT_EQ(num_nodes, i); |
| 49 | } |
| 50 | |
| 51 | void ExpectListContents(const LinkedList<Node>& list, |
| 52 | int num_nodes, |