Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenstack_test.cpp
Go to the documentation of this file.
00001 #include <algorithm> 00002 #include <list> 00003 #include <queue> 00004 #include <deque> 00005 #include <stack> 00006 00007 #include "cppunit/cppunit_proxy.h" 00008 00009 #if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) 00010 using namespace std; 00011 #endif 00012 00013 // 00014 // TestCase class 00015 // 00016 class StackTest : public CPPUNIT_NS::TestCase 00017 { 00018 CPPUNIT_TEST_SUITE(StackTest); 00019 CPPUNIT_TEST(stack1); 00020 CPPUNIT_TEST(stack2); 00021 CPPUNIT_TEST_SUITE_END(); 00022 00023 protected: 00024 void stack1(); 00025 void stack2(); 00026 }; 00027 00028 CPPUNIT_TEST_SUITE_REGISTRATION(StackTest); 00029 00030 // 00031 // tests implementation 00032 // 00033 void StackTest::stack1() 00034 { 00035 stack<int, deque<int> > s; 00036 s.push(42); 00037 s.push(101); 00038 s.push(69); 00039 CPPUNIT_ASSERT(s.top()==69); 00040 s.pop(); 00041 CPPUNIT_ASSERT(s.top()==101); 00042 s.pop(); 00043 CPPUNIT_ASSERT(s.top()==42); 00044 s.pop(); 00045 CPPUNIT_ASSERT(s.empty()); 00046 } 00047 void StackTest::stack2() 00048 { 00049 stack<int, list<int> > s; 00050 s.push(42); 00051 s.push(101); 00052 s.push(69); 00053 CPPUNIT_ASSERT(s.top()==69); 00054 s.pop(); 00055 CPPUNIT_ASSERT(s.top()==101); 00056 s.pop(); 00057 CPPUNIT_ASSERT(s.top()==42); 00058 s.pop(); 00059 CPPUNIT_ASSERT(s.empty()); 00060 } Generated on Sat May 26 2012 04:34:45 for ReactOS by
1.7.6.1
|