Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenrawriter_test.cpp
Go to the documentation of this file.
00001 #include <algorithm> 00002 #include <iterator> 00003 #include <memory> 00004 00005 #include "cppunit/cppunit_proxy.h" 00006 00007 #if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) 00008 using namespace std; 00009 #endif 00010 00011 class X 00012 { 00013 public: 00014 X(int i_ = 0) : i(i_) {} 00015 ~X() {} 00016 operator int() const { return i; } 00017 00018 private: 00019 int i; 00020 }; 00021 00022 00023 // 00024 // TestCase class 00025 // 00026 class RawriterTest : public CPPUNIT_NS::TestCase 00027 { 00028 CPPUNIT_TEST_SUITE(RawriterTest); 00029 CPPUNIT_TEST(rawiter1); 00030 CPPUNIT_TEST_SUITE_END(); 00031 00032 protected: 00033 void rawiter1(); 00034 }; 00035 00036 CPPUNIT_TEST_SUITE_REGISTRATION(RawriterTest); 00037 00038 // 00039 // tests implementation 00040 // 00041 void RawriterTest::rawiter1() 00042 { 00043 allocator<X> a; 00044 typedef X* x_pointer; 00045 x_pointer save_p, p; 00046 p = a.allocate(5); 00047 save_p=p; 00048 raw_storage_iterator<X*, X> r(p); 00049 int i; 00050 for(i = 0; i < 5; i++) 00051 *r++ = X(i); 00052 00053 CPPUNIT_ASSERT(*p++ == 0); 00054 CPPUNIT_ASSERT(*p++ == 1); 00055 CPPUNIT_ASSERT(*p++ == 2); 00056 CPPUNIT_ASSERT(*p++ == 3); 00057 CPPUNIT_ASSERT(*p++ == 4); 00058 00059 //#if defined (STLPORT) || defined (__GNUC__) 00060 a.deallocate(save_p, 5); 00061 /* 00062 #else 00063 a.deallocate(save_p); 00064 #endif 00065 */ 00066 } Generated on Sat May 26 2012 04:34:41 for ReactOS by
1.7.6.1
|