/* If they are both not past-the-end, make sure they iterate on the
same array (we shouldn't compare iterators that iterate on different
things). */
- gdb_assert (m_array == other.m_array);
+ SELF_CHECK (m_array == other.m_array);
/* They are equal if they have the same current index. */
return m_cur_idx == other.m_cur_idx;
void operator++ ()
{
/* Make sure nothing tries to increment a past the end iterator. */
- gdb_assert (m_cur_idx < m_size);
+ SELF_CHECK (m_cur_idx < m_size);
m_cur_idx++;
int operator* () const
{
/* Make sure nothing tries to dereference a past the end iterator. */
- gdb_assert (m_cur_idx < m_size);
+ SELF_CHECK (m_cur_idx < m_size);
return m_array[m_cur_idx];
}
for (; iter != end; ++iter)
even_ints.push_back (*iter);
- gdb_assert (even_ints == expected_even_ints);
+ SELF_CHECK (even_ints == expected_even_ints);
}
/* Test operator== and operator!=. */
iter2(array, ARRAY_SIZE (array));
/* They start equal. */
- gdb_assert (iter1 == iter2);
- gdb_assert (!(iter1 != iter2));
+ SELF_CHECK (iter1 == iter2);
+ SELF_CHECK (!(iter1 != iter2));
/* Advance 1, now they aren't equal (despite pointing to equal values). */
++iter1;
- gdb_assert (!(iter1 == iter2));
- gdb_assert (iter1 != iter2);
+ SELF_CHECK (!(iter1 == iter2));
+ SELF_CHECK (iter1 != iter2);
/* Advance 2, now they are equal again. */
++iter2;
- gdb_assert (iter1 == iter2);
- gdb_assert (!(iter1 != iter2));
+ SELF_CHECK (iter1 == iter2);
+ SELF_CHECK (!(iter1 != iter2));
}
} /* namespace selftests */
{
const item_type &item = *it;
- gdb_assert (i < expected.size ());
- gdb_assert (&item == expected[i]);
+ SELF_CHECK (i < expected.size ());
+ SELF_CHECK (&item == expected[i]);
++i;
}
- gdb_assert (i == expected.size ());
+ SELF_CHECK (i == expected.size ());
for (typename ListType::reverse_iterator it = list.rbegin ();
it != list.rend ();
--i;
- gdb_assert (i >= 0);
- gdb_assert (&item == expected[i]);
+ SELF_CHECK (i >= 0);
+ SELF_CHECK (&item == expected[i]);
}
- gdb_assert (i == 0);
+ SELF_CHECK (i == 0);
}
static void
list.push_back (b);
list.push_back (c);
- gdb_assert (&list.front () == &a);
- gdb_assert (&clist.front () == &a);
- gdb_assert (&list.back () == &c);
- gdb_assert (&clist.back () == &c);
+ SELF_CHECK (&list.front () == &a);
+ SELF_CHECK (&clist.front () == &a);
+ SELF_CHECK (&list.back () == &c);
+ SELF_CHECK (&clist.back () == &c);
}
static void
expected = {};
verify_items (list, expected);
- gdb_assert (disposer_calls == 3);
- gdb_assert (disposer_seen.find (&a) != disposer_seen.end ());
- gdb_assert (disposer_seen.find (&b) != disposer_seen.end ());
- gdb_assert (disposer_seen.find (&c) != disposer_seen.end ());
+ SELF_CHECK (disposer_calls == 3);
+ SELF_CHECK (disposer_seen.find (&a) != disposer_seen.end ());
+ SELF_CHECK (disposer_seen.find (&b) != disposer_seen.end ());
+ SELF_CHECK (disposer_seen.find (&c) != disposer_seen.end ());
/* Verify idempotency. */
list.clear_and_dispose (disposer);
- gdb_assert (disposer_calls == 3);
+ SELF_CHECK (disposer_calls == 3);
}
static void
item_type a ("a");
ListType list;
- gdb_assert (list.empty ());
+ SELF_CHECK (list.empty ());
list.push_back (a);
- gdb_assert (!list.empty ());
+ SELF_CHECK (!list.empty ());
list.erase (list.iterator_to (a));
- gdb_assert (list.empty ());
+ SELF_CHECK (list.empty ());
}
static void
list.push_back (b);
list.push_back (c);
- gdb_assert (&*list.begin () == &a);
- gdb_assert (&*list.cbegin () == &a);
- gdb_assert (&*clist.begin () == &a);
- gdb_assert (&*list.rbegin () == &c);
- gdb_assert (&*list.crbegin () == &c);
- gdb_assert (&*clist.rbegin () == &c);
+ SELF_CHECK (&*list.begin () == &a);
+ SELF_CHECK (&*list.cbegin () == &a);
+ SELF_CHECK (&*clist.begin () == &a);
+ SELF_CHECK (&*list.rbegin () == &c);
+ SELF_CHECK (&*list.crbegin () == &c);
+ SELF_CHECK (&*clist.rbegin () == &c);
/* At least check that they compile. */
list.end ();
item_with_base a ("a");
item_with_base_list list;
- gdb_assert (!a.is_linked ());
+ SELF_CHECK (!a.is_linked ());
list.push_back (a);
- gdb_assert (a.is_linked ());
+ SELF_CHECK (a.is_linked ());
list.pop_back ();
- gdb_assert (!a.is_linked ());
+ SELF_CHECK (!a.is_linked ());
}
{
item_with_member a ("a");
item_with_member_list list;
- gdb_assert (!a.node.is_linked ());
+ SELF_CHECK (!a.node.is_linked ());
list.push_back (a);
- gdb_assert (a.node.is_linked ());
+ SELF_CHECK (a.node.is_linked ());
list.pop_back ();
- gdb_assert (!a.node.is_linked ());
+ SELF_CHECK (!a.node.is_linked ());
}
}