Permalink
Browse files

Test for slist::{pop_front,front,push_front}

  • Loading branch information...
1 parent 0dc5863 commit 96f5e600ac95c0aa4c987d23143aa82e97ac2f95 @pmachata committed Feb 12, 2012
Showing with 24 additions and 0 deletions.
  1. +24 −0 slist.cc
View
24 slist.cc
@@ -64,6 +64,30 @@ tests ()
assert (std::distance (h2.begin (), h2.end ()) == 1);
}
+ {
+ H *h2 = new H (h);
+ for (size_t i = 1; i < M; ++i)
+ {
+ if (i % 1000 == 0)
+ std::cout << "." << std::flush;
+ std::vector<typename H::value_type> save;
+ for (size_t j = 0; j < i; ++j)
+ {
+ assert (!h2->empty ());
+ typename H::value_type v = h2->front ();
+ save.push_back (v);
+ h2->pop_front ();
+ }
+ while (!save.empty ())
+ {
+ h2->push_front (save.back ());
+ save.pop_back ();
+ }
+ assert (*h2 == h);
+ }
+ delete h2;
+ }
+
switch (loops)
{
case 0:

0 comments on commit 96f5e60

Please sign in to comment.