ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

mvctor_test.h
Go to the documentation of this file.
00001 #include <cstdio> //size_t and STLport macros
00002 
00003 #include "cppunit/cppunit_proxy.h"
00004 
00005 //
00006 // TestCase class
00007 //
00008 class MoveConstructorTest : public CPPUNIT_NS::TestCase
00009 {
00010   CPPUNIT_TEST_SUITE(MoveConstructorTest);
00011   CPPUNIT_TEST(move_construct_test);
00012   CPPUNIT_TEST(deque_test);
00013   CPPUNIT_TEST(vector_test);
00014   CPPUNIT_TEST(move_traits);
00015 #if !defined (STLPORT) || defined (_STLP_NO_MOVE_SEMANTIC) || \
00016     defined (_STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS) || \
00017     (defined (__BORLANDC__) && (__BORLANDC__ < 0x564))
00018   CPPUNIT_IGNORE;
00019 #  endif
00020   CPPUNIT_TEST(movable_declaration)
00021   CPPUNIT_TEST(movable_declaration_assoc)
00022   CPPUNIT_TEST(movable_declaration_hash)
00023 #if defined (__BORLANDC__)
00024   CPPUNIT_STOP_IGNORE;
00025   CPPUNIT_TEST(nb_destructor_calls);
00026 #endif
00027   CPPUNIT_TEST_SUITE_END();
00028 
00029 protected:
00030   void move_construct_test();
00031   void deque_test();
00032   void vector_test();
00033   void move_traits();
00034   void movable_declaration();
00035   void movable_declaration_assoc();
00036   void movable_declaration_hash();
00037   void nb_destructor_calls();
00038 
00039   /*
00040   template <class _Container>
00041   void standard_test1(_Container const& ref_cont) {
00042     vector<_Container> vec_cont(1, ref_cont);
00043     typedef typename _Container::value_type value_type;
00044     value_type *pvalue = &(*vec_cont.front().begin());
00045     size_t cur_capacity= vec_cont.capacity();
00046     //force reallocation
00047     while (cur_capacity == vec_cont.capacity()) {
00048       vec_cont.push_back(ref_cont);
00049     }
00050     bool b=( (pvalue==(&(*vec_cont.front().begin()))) );
00051     CPPUNIT_ASSERT(b);
00052   }
00053   */
00054 
00055 private:
00056   void move_traits_vec();
00057   void move_traits_vec_complete();
00058   void move_traits_deq();
00059   void move_traits_deq_complete();
00060 };
00061 
00062 struct MovableStruct {
00063   MovableStruct() { ++nb_dft_construct_call; }
00064   MovableStruct(MovableStruct const&) { ++nb_cpy_construct_call; }
00065 #if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
00066 #  if defined (_STLP_USE_NAMESPACES)
00067   MovableStruct(std::__move_source<MovableStruct>)
00068 #  else
00069   MovableStruct(__move_source<MovableStruct>)
00070 #  endif
00071   { ++nb_mv_construct_call; }
00072 #endif
00073   ~MovableStruct() { ++nb_destruct_call; }
00074 
00075   MovableStruct& operator = (const MovableStruct&) {
00076     ++nb_assignment_call;
00077     return *this;
00078   }
00079 
00080   static void reset() {
00081     nb_dft_construct_call = nb_cpy_construct_call = nb_mv_construct_call = 0;
00082     nb_assignment_call = 0;
00083     nb_destruct_call = 0;
00084   }
00085 
00086   static size_t nb_dft_construct_call;
00087   static size_t nb_cpy_construct_call;
00088   static size_t nb_mv_construct_call;
00089   static size_t nb_assignment_call;
00090   static size_t nb_destruct_call;
00091 
00092   //Dummy data just to control struct sizeof
00093   //As node allocator implementation align memory blocks on 2 * sizeof(void*)
00094   //we give MovableStruct the same size in order to have expected allocation
00095   //and not more
00096   void* dummy_data[2];
00097 };

Generated on Fri May 25 2012 04:34:03 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.