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_valarray.cpp
Go to the documentation of this file.
00001 // Boris - this file is, um, rather incomplete. Please remove from distribution.
00002 
00003 /***********************************************************************************
00004   test_string.cpp
00005 
00006  * Copyright (c) 1997
00007  * Mark of the Unicorn, Inc.
00008  *
00009  * Permission to use, copy, modify, distribute and sell this software
00010  * and its documentation for any purpose is hereby granted without fee,
00011  * provided that the above copyright notice appear in all copies and
00012  * that both that copyright notice and this permission notice appear
00013  * in supporting documentation.  Mark of the Unicorn makes no
00014  * representations about the suitability of this software for any
00015  * purpose.  It is provided "as is" without express or implied warranty.
00016 
00017 ***********************************************************************************/
00018 #include "Prefix.h"
00019 #if defined( EH_VALARRAY_IMPLEMENTED )
00020 #include "Tests.h"
00021 #include <valarray>
00022 #include "TestClass.h"
00023 #include "LeakCheck.h"
00024 #include "test_construct.h"
00025 #include "test_assign_op.h"
00026 #include "test_push_back.h"
00027 #include "test_insert.h"
00028 #include "test_push_front.h"
00029 
00030 typedef __valarray__<TestClass, eh_allocator(TestClass) > TestValarray;
00031 
00032 inline sequence_container_tag
00033 container_category(const TestValarray&)
00034 {
00035   return sequence_container_tag();
00036 }
00037 
00038 void test_rope()
00039 {
00040     TestValarray testValarray, testValarray2;
00041     size_t ropeSize = random_number(random_base);
00042 
00043     while ( testValarray.size() < ropeSize )
00044     {
00045         TestValarray::value_type x = random_number(random_base) ;  // initialize before use
00046         testValarray.push_back( x );
00047         testValarray2.push_back( TestValarray::value_type() );
00048     }
00049     WeakCheck( testValarray, test_insert_one<TestValarray>(testValarray) );
00050     WeakCheck( testValarray, test_insert_one<TestValarray>(testValarray, 0) );
00051     WeakCheck( testValarray, test_insert_one<TestValarray>(testValarray, testValarray.size()) );
00052 
00053     WeakCheck( testValarray, test_insert_n<TestValarray>(testValarray, random_number(random_base) ) );
00054     WeakCheck( testValarray, test_insert_n<TestValarray>(testValarray, random_number(random_base), 0 ) );
00055     WeakCheck( testValarray, test_insert_n<TestValarray>(testValarray, random_number(random_base), testValarray.size() ) );
00056 
00057     size_t insCnt = random_number(random_base);
00058     TestValarray::value_type *insFirst = new TestValarray::value_type[1+insCnt];
00059 
00060     WeakCheck( testValarray, insert_range_tester(testValarray, insFirst, insFirst+insCnt) );
00061     WeakCheck( testValarray, insert_range_at_begin_tester(testValarray, insFirst, insFirst+insCnt) );
00062     WeakCheck( testValarray, insert_range_at_end_tester(testValarray, insFirst, insFirst+insCnt) );
00063 
00064     ConstCheck( 0, test_construct_pointer_range<TestValarray>(insFirst, insFirst+insCnt) );
00065     delete[] insFirst;
00066 
00067     WeakCheck( testValarray, insert_range_tester(testValarray, testValarray2.begin(), testValarray2.end() ) );
00068 
00069     WeakCheck( testValarray, test_push_front<TestValarray>(testValarray) );
00070     WeakCheck( testValarray, test_push_back<TestValarray>(testValarray) );
00071 
00072     ConstCheck( 0, test_default_construct<TestValarray>() );
00073     ConstCheck( 0, test_construct_n<TestValarray>( random_number(random_base) ) );
00074     ConstCheck( 0, test_construct_n_instance<TestValarray>( random_number(random_base) ) );
00075     ConstCheck( 0, test_construct_iter_range<TestValarray>( testValarray2 ) );
00076     ConstCheck( testValarray, test_copy_construct<TestValarray>() );
00077 
00078     WeakCheck( testValarray, test_assign_op<TestValarray>( testValarray2 ) );
00079 }
00080 
00081 #endif // EH_ROPE_IMPLEMENTED

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.