示例#1
0
 void
 checkAllocation()
   {
     CHECK (0 == Dummy::checksum());
     {
       HO holder;
       CHECK (!holder);
       CHECK (0 == Dummy::checksum());
       
       create_contained_object (holder);
       CHECK (holder);
       CHECK (false != bool(holder));
       CHECK (bool(holder) != false);
       
       CHECK (0 < Dummy::checksum());
       CHECK ( &(*holder));
       CHECK (holder->acc(2) == 2 + Dummy::checksum());
       
       Dummy *rawP = holder.get();
       CHECK (rawP);
       CHECK (holder);
       CHECK (rawP == &(*holder));
       CHECK (rawP->acc(-5) == holder->acc(-5));
       
       TRACE (test, "holder at %p", &holder);
       TRACE (test, "object at %p", holder.get() );
       TRACE (test, "size(object) = %zu", sizeof(*holder));
       TRACE (test, "size(holder) = %zu", sizeof(holder));
     }
     CHECK (0 == Dummy::checksum());
   }
示例#2
0
 void
 buildVector()
   {
     CHECK (0 == Dummy::checksum());
     {
       typedef typename Table<HO>::Type Vect;
       
       Vect table(50);
       CHECK (0 == Dummy::checksum());
       
       for (uint i=0; i<10; ++i)
         create_contained_object (table[i]);
       
       CHECK (0 < Dummy::checksum());
       CHECK ( table[9]);
       CHECK (!table[10]);
       
       Dummy *rawP = table[5].get();
       CHECK (rawP);
       CHECK (table[5]);
       CHECK (rawP == &(*table[5]));
       CHECK (rawP->acc(-555) == table[5]->acc(-555));
     }
     CHECK (0 == Dummy::checksum());
   }