Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygentest_rope.cpp
Go to the documentation of this file.
00001 /*********************************************************************************** 00002 test_rope.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 00017 # ifdef __SUNPRO_CC 00018 # define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1 00019 # endif 00020 00021 #include "Prefix.h" 00022 #include "Tests.h" 00023 #include "TestClass.h" 00024 #include "LeakCheck.h" 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 00031 #if defined( EH_ROPE_IMPLEMENTED ) 00032 #if !( defined(__MWERKS__) && __MWERKS__ < 0x1900 ) // CW1.8 can't compile this! 00033 # define __STD_STUFF 1 00034 # if defined (EH_NEW_HEADERS) 00035 #include <rope> 00036 #else 00037 #include <rope.h> 00038 #endif 00039 00040 00041 typedef STLPORT::rope<char, eh_allocator(char) > TestRope; 00042 00043 inline sequence_container_tag 00044 container_category(const TestRope&) 00045 { 00046 return sequence_container_tag(); 00047 } 00048 00049 void test_rope() 00050 { 00051 TestRope testRope, testRope2; 00052 size_t ropeSize = random_number(random_base); 00053 00054 while ( testRope.size() < ropeSize ) 00055 { 00056 TestRope::value_type x = TestRope::value_type(random_number(random_base)); // initialize before use 00057 testRope.push_back( x ); 00058 testRope2.push_back( TestRope::value_type() ); 00059 } 00060 WeakCheck( testRope, test_insert_one<TestRope>(testRope) ); 00061 WeakCheck( testRope, test_insert_one<TestRope>(testRope, 0) ); 00062 WeakCheck( testRope, test_insert_one<TestRope>(testRope, (int)testRope.size()) ); 00063 00064 WeakCheck( testRope, test_insert_n<TestRope>(testRope, random_number(random_base) ) ); 00065 WeakCheck( testRope, test_insert_n<TestRope>(testRope, random_number(random_base), 0 ) ); 00066 WeakCheck( testRope, test_insert_n<TestRope>(testRope, random_number(random_base), (int)testRope.size() ) ); 00067 00068 size_t insCnt = random_number(random_base); 00069 TestRope::value_type *insFirst = new TestRope::value_type[1+insCnt]; 00070 00071 WeakCheck( testRope, insert_range_tester(testRope, insFirst, insFirst+insCnt) ); 00072 WeakCheck( testRope, insert_range_at_begin_tester(testRope, insFirst, insFirst+insCnt) ); 00073 WeakCheck( testRope, insert_range_at_end_tester(testRope, insFirst, insFirst+insCnt) ); 00074 00075 ConstCheck( 0, test_construct_pointer_range<TestRope>(insFirst, insFirst+insCnt) ); 00076 delete[] insFirst; 00077 00078 WeakCheck( testRope, insert_range_tester(testRope, testRope2.begin(), testRope2.end() ) ); 00079 00080 WeakCheck( testRope, test_push_front<TestRope>(testRope) ); 00081 WeakCheck( testRope, test_push_back<TestRope>(testRope) ); 00082 00083 ConstCheck( 0, test_default_construct<TestRope>() ); 00084 00085 // dwa 1/25/00 - not actually valid for rope, because it doesn't 00086 // have the constructor in question! The code will compile, but with the 00087 // wrong result (the constructor that gets used does something different). 00088 00089 // ConstCheck( 0, test_construct_n<TestRope>( random_number(random_base) ) ); 00090 00091 ConstCheck( 0, test_construct_n_instance<TestRope>( random_number(random_base) ) ); 00092 ConstCheck( 0, test_construct_iter_range<TestRope>( testRope2 ) ); 00093 ConstCheck( testRope, test_copy_construct<TestRope>() ); 00094 00095 WeakCheck( testRope, test_assign_op<TestRope>( testRope2 ) ); 00096 } 00097 #endif // __MWERKS__ 00098 00099 #endif // EH_ROPE_IMPLEMENTED Generated on Sat May 26 2012 04:34:05 for ReactOS by
1.7.6.1
|