Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygentest_string.cpp
Go to the documentation of this file.
00001 /*********************************************************************************** 00002 test_string.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 "Prefix.h" 00017 #if defined( EH_STRING_IMPLEMENTED ) 00018 #include "Tests.h" 00019 #include "TestClass.h" 00020 #include "LeakCheck.h" 00021 #include "test_construct.h" 00022 #include "test_assign_op.h" 00023 #include "test_push_back.h" 00024 #include "test_insert.h" 00025 #include "test_push_front.h" 00026 #include <string> 00027 00028 USING_CSTD_NAME(size_t) 00029 00030 typedef EH_STD::basic_string<char, EH_STD::char_traits<char>, eh_allocator(char) > TestString; 00031 00032 inline sequence_container_tag 00033 container_category(const TestString&) 00034 { 00035 return sequence_container_tag(); 00036 } 00037 00038 void test_string() { 00039 TestString testString, testString2; 00040 size_t ropeSize = random_number(random_base); 00041 00042 while ( testString.size() < ropeSize ) { 00043 TestString::value_type x = TestString::value_type(random_number(random_base)) ; // initialize before use 00044 testString.append(1, x ); 00045 testString2.append(1, TestString::value_type() ); 00046 } 00047 WeakCheck( testString, test_insert_one<TestString>(testString) ); 00048 WeakCheck( testString, test_insert_one<TestString>(testString, 0) ); 00049 WeakCheck( testString, test_insert_one<TestString>(testString, (int)testString.size()) ); 00050 00051 WeakCheck( testString, test_insert_n<TestString>(testString, random_number(random_base) ) ); 00052 WeakCheck( testString, test_insert_n<TestString>(testString, random_number(random_base), 0 ) ); 00053 WeakCheck( testString, test_insert_n<TestString>(testString, random_number(random_base), (int)testString.size() ) ); 00054 00055 size_t insCnt = random_number(random_base); 00056 TestString::value_type *insFirst = new TestString::value_type[1+insCnt]; 00057 00058 WeakCheck( testString, insert_range_tester(testString, insFirst, insFirst+insCnt) ); 00059 WeakCheck( testString, insert_range_at_begin_tester(testString, insFirst, insFirst+insCnt) ); 00060 WeakCheck( testString, insert_range_at_end_tester(testString, insFirst, insFirst+insCnt) ); 00061 00062 ConstCheck( 0, test_construct_pointer_range<TestString>(insFirst, insFirst+insCnt) ); 00063 delete[] insFirst; 00064 00065 WeakCheck( testString, insert_range_tester(testString, testString2.begin(), testString2.end() ) ); 00066 /* 00067 WeakCheck( testString, test_push_front<TestString>(testString) ); 00068 WeakCheck( testString, test_push_back<TestString>(testString) ); 00069 */ 00070 ConstCheck( 0, test_default_construct<TestString>() ); 00071 // requires _Reserve_t ConstCheck( 0, test_construct_n<TestString>( random_number(random_base) ) ); 00072 ConstCheck( 0, test_construct_n_instance<TestString>( random_number(random_base) ) ); 00073 ConstCheck( 0, test_construct_iter_range<TestString>( testString2 ) ); 00074 ConstCheck( testString, test_copy_construct<TestString>() ); 00075 00076 WeakCheck( testString, test_assign_op<TestString>( testString2 ) ); 00077 } 00078 00079 #endif // EH_ROPE_IMPLEMENTED Generated on Sat May 26 2012 04:34:08 for ReactOS by
1.7.6.1
|