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

test_set.cpp
Go to the documentation of this file.
00001 /***********************************************************************************
00002   test_set.cpp
00003 
00004  * Copyright (c) 1997
00005  * Mark of the Unicorn, Inc.
00006  *
00007  * Permission to use, copy, modify, distribute and sell this software
00008  * and its documentation for any purpose is hereby granted without fee,
00009  * provided that the above copyright notice appear in all copies and
00010  * that both that copyright notice and this permission notice appear
00011  * in supporting documentation.  Mark of the Unicorn makes no
00012  * representations about the suitability of this software for any
00013  * purpose.  It is provided "as is" without express or implied warranty.
00014 
00015 ***********************************************************************************/
00016 #include "Tests.h"
00017 #include "TestClass.h"
00018 #include "LeakCheck.h"
00019 #if defined (EH_NEW_HEADERS)
00020 #  include <set>
00021 #else
00022 #  include <multiset.h>
00023 #  include <set.h>
00024 #endif
00025 #include "test_construct.h"
00026 #include "test_assign_op.h"
00027 #include "test_push_back.h"
00028 #include "test_insert.h"
00029 #include "test_push_front.h"
00030 #include "ThrowCompare.h"
00031 
00032 void test_multiset();
00033 
00034 typedef EH_STD::__multiset__<TestClass, ThrowCompare, eh_allocator(TestClass) > TestMultiSet;
00035 
00036 inline multiset_tag
00037 container_category(const TestMultiSet&) {
00038   return multiset_tag();
00039 }
00040 
00041 void test_multiset() {
00042   TestMultiSet testMultiSet, testMultiSet2;
00043 
00044   const size_t setSize = random_number(random_base);
00045 
00046   while (testMultiSet.size() < setSize) {
00047     TestMultiSet::value_type x;
00048     testMultiSet.insert( x );
00049     testMultiSet2.insert( TestMultiSet::value_type() );
00050   }
00051 
00052   StrongCheck( testMultiSet, test_insert_value<TestMultiSet>(testMultiSet) );
00053 
00054   size_t insCnt = random_number(random_base);
00055   TestMultiSet::value_type *insFirst = new TestMultiSet::value_type[1+insCnt];
00056   WeakCheck( testMultiSet, insert_range_tester(testMultiSet, insFirst, insFirst+insCnt) );
00057   ConstCheck( 0, test_construct_pointer_range<TestMultiSet>(insFirst, insFirst+insCnt) );
00058   delete[] insFirst;
00059   WeakCheck( testMultiSet, insert_range_tester(testMultiSet, testMultiSet2.begin(), testMultiSet2.end() ) );
00060 
00061   ConstCheck( 0, test_default_construct<TestMultiSet>() );
00062   ConstCheck( 0, test_construct_iter_range<TestMultiSet>( testMultiSet2 ) );
00063   ConstCheck( testMultiSet, test_copy_construct<TestMultiSet>() );
00064 
00065   WeakCheck( testMultiSet, test_assign_op<TestMultiSet>( testMultiSet2 ) );
00066 }
00067 
00068 typedef EH_STD::__set__<TestClass, ThrowCompare, eh_allocator(TestClass) > TestSet;
00069 
00070 inline set_tag
00071 container_category(const TestSet&) {
00072   return set_tag();
00073 }
00074 
00075 void test_set() {
00076   TestSet testSet, testSet2;
00077 
00078   const size_t setSize = random_number(random_base);
00079 
00080   while ( testSet.size() < setSize ) {
00081     TestSet::value_type x;
00082     testSet.insert( x );
00083     testSet2.insert( TestSet::value_type() );
00084   }
00085   StrongCheck( testSet, test_insert_value<TestSet>(testSet) );
00086 
00087   size_t insCnt = random_number(random_base);
00088   TestSet::value_type *insFirst = new TestSet::value_type[1+insCnt];
00089 
00090   WeakCheck( testSet, insert_range_tester(testSet, insFirst, insFirst+insCnt) );
00091 
00092   ConstCheck( 0, test_construct_pointer_range<TestSet>(insFirst, insFirst+insCnt) );
00093   delete[] insFirst;
00094   WeakCheck( testSet, insert_range_tester(testSet, testSet2.begin(), testSet2.end() ) );
00095 
00096   ConstCheck( 0, test_default_construct<TestSet>() );
00097   ConstCheck( 0, test_construct_iter_range<TestSet>( testSet2 ) );
00098   ConstCheck( testSet, test_copy_construct<TestSet>() );
00099   WeakCheck( testSet, test_assign_op<TestSet>( testSet2 ) );
00100 }

Generated on Sun May 27 2012 04:35:15 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.