Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenbinsert_test.cpp
Go to the documentation of this file.
00001 #include <vector> 00002 #include <algorithm> 00003 00004 #include "cppunit/cppunit_proxy.h" 00005 00006 #if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) 00007 using namespace std; 00008 #endif 00009 00010 // 00011 // TestCase class 00012 // 00013 class BinsertTest : public CPPUNIT_NS::TestCase 00014 { 00015 CPPUNIT_TEST_SUITE(BinsertTest); 00016 CPPUNIT_TEST(binsert1); 00017 CPPUNIT_TEST(binsert2); 00018 CPPUNIT_TEST_SUITE_END(); 00019 00020 protected: 00021 void binsert1(); 00022 void binsert2(); 00023 }; 00024 00025 CPPUNIT_TEST_SUITE_REGISTRATION(BinsertTest); 00026 00027 // 00028 // tests implementation 00029 // 00030 void BinsertTest::binsert1() 00031 { 00032 const char* array [] = { "laurie", "jennifer", "leisa" }; 00033 vector<const char*> names; 00034 back_insert_iterator<vector<const char*> > bit(names); 00035 bit = copy(array, array + 3, bit); 00036 00037 CPPUNIT_ASSERT(!strcmp(names[0],array[0])); 00038 CPPUNIT_ASSERT(!strcmp(names[1],array[1])); 00039 CPPUNIT_ASSERT(!strcmp(names[2],array[2])); 00040 00041 copy(array, array + 3, bit); 00042 CPPUNIT_ASSERT(!strcmp(names[3],array[0])); 00043 CPPUNIT_ASSERT(!strcmp(names[4],array[1])); 00044 CPPUNIT_ASSERT(!strcmp(names[5],array[2])); 00045 } 00046 void BinsertTest::binsert2() 00047 { 00048 const char* array [] = { "laurie", "jennifer", "leisa" }; 00049 vector<const char*> names; 00050 copy(array, array + 3, back_inserter(names)); 00051 CPPUNIT_ASSERT(!strcmp(names[0],array[0])); 00052 CPPUNIT_ASSERT(!strcmp(names[1],array[1])); 00053 CPPUNIT_ASSERT(!strcmp(names[2],array[2])); 00054 } Generated on Fri May 25 2012 04:33:47 for ReactOS by
1.7.6.1
|