reactos/lib/3rdparty/stlport/test/unit/stack_test.cpp
Amine Khaldi 4efda499f7 [CMAKE]
Jerome Gardou:
- Add STLport 5.2.1 (yes, STLport, the c++ stl implementation) to build. For now, it works only in user mode.
- Link some c++ executables to it
- sol.exe : one step towards a complete and modern OS.
- Dedicated to Amine for his patience and his help.
- Might Break Things! (tm)

svn path=/branches/cmake-bringup/; revision=49046
2010-10-07 22:09:31 +00:00

61 lines
1 KiB
C++

#include <algorithm>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include "cppunit/cppunit_proxy.h"
#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
using namespace std;
#endif
//
// TestCase class
//
class StackTest : public CPPUNIT_NS::TestCase
{
CPPUNIT_TEST_SUITE(StackTest);
CPPUNIT_TEST(stack1);
CPPUNIT_TEST(stack2);
CPPUNIT_TEST_SUITE_END();
protected:
void stack1();
void stack2();
};
CPPUNIT_TEST_SUITE_REGISTRATION(StackTest);
//
// tests implementation
//
void StackTest::stack1()
{
stack<int, deque<int> > s;
s.push(42);
s.push(101);
s.push(69);
CPPUNIT_ASSERT(s.top()==69);
s.pop();
CPPUNIT_ASSERT(s.top()==101);
s.pop();
CPPUNIT_ASSERT(s.top()==42);
s.pop();
CPPUNIT_ASSERT(s.empty());
}
void StackTest::stack2()
{
stack<int, list<int> > s;
s.push(42);
s.push(101);
s.push(69);
CPPUNIT_ASSERT(s.top()==69);
s.pop();
CPPUNIT_ASSERT(s.top()==101);
s.pop();
CPPUNIT_ASSERT(s.top()==42);
s.pop();
CPPUNIT_ASSERT(s.empty());
}