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

finsert_test.cpp
Go to the documentation of this file.
00001 #include <vector>
00002 #include <algorithm>
00003 #include <deque>
00004 
00005 #include "cppunit/cppunit_proxy.h"
00006 
00007 #if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
00008 using namespace std;
00009 #endif
00010 
00011 //
00012 // TestCase class
00013 //
00014 class FinsertTest : public CPPUNIT_NS::TestCase
00015 {
00016   CPPUNIT_TEST_SUITE(FinsertTest);
00017   CPPUNIT_TEST(finsert1);
00018   CPPUNIT_TEST(finsert2);
00019   CPPUNIT_TEST_SUITE_END();
00020 
00021 protected:
00022   void finsert1();
00023   void finsert2();
00024 };
00025 
00026 CPPUNIT_TEST_SUITE_REGISTRATION(FinsertTest);
00027 
00028 //
00029 // tests implementation
00030 //
00031 void FinsertTest::finsert1()
00032 {
00033   char const* array [] = { "laurie", "jennifer", "leisa" };
00034   deque<char const*> names;
00035   front_insert_iterator<deque<char const*> > fit(names);
00036   fit = copy(array, array + 3, front_insert_iterator<deque <char const*> >(names));
00037 
00038   CPPUNIT_ASSERT(names[0]==array[2]);
00039   CPPUNIT_ASSERT(names[1]==array[1]);
00040   CPPUNIT_ASSERT(names[2]==array[0]);
00041 
00042   copy(array, array + 3, fit);
00043   CPPUNIT_ASSERT(names[3]==array[2]);
00044   CPPUNIT_ASSERT(names[4]==array[1]);
00045   CPPUNIT_ASSERT(names[5]==array[0]);
00046 }
00047 
00048 void FinsertTest::finsert2()
00049 {
00050   char const* array [] = { "laurie", "jennifer", "leisa" };
00051 
00052   deque<char const*> names;
00053   copy(array, array + 3, front_inserter(names));
00054 
00055   CPPUNIT_ASSERT(names[0]==array[2]);
00056   CPPUNIT_ASSERT(names[1]==array[1]);
00057   CPPUNIT_ASSERT(names[2]==array[0]);
00058 }

Generated on Sat May 26 2012 04:34: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.