34 lines
871 B
C++
34 lines
871 B
C++
#include "QueueToStack.h"
|
|
#include <boost/test/unit_test.hpp>
|
|
|
|
using namespace Kylin;
|
|
|
|
class QueueToStackTest {
|
|
public:
|
|
QueueToStack<size_t> stack{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
|
|
};
|
|
|
|
BOOST_AUTO_TEST_SUITE(QueueToStackTestCase)
|
|
BOOST_FIXTURE_TEST_CASE(Push, QueueToStackTest) {
|
|
stack.push(123);
|
|
BOOST_CHECK_EQUAL(stack.size(), 11);
|
|
}
|
|
|
|
BOOST_FIXTURE_TEST_CASE(Pop, QueueToStackTest) {
|
|
BOOST_CHECK_EQUAL(stack.pop(), 9);
|
|
BOOST_CHECK_EQUAL(stack.size(), 9);
|
|
}
|
|
|
|
BOOST_FIXTURE_TEST_CASE(Top, QueueToStackTest) {
|
|
BOOST_CHECK_EQUAL(stack.top(), 9);
|
|
BOOST_CHECK_EQUAL(stack.size(), 10);
|
|
}
|
|
|
|
BOOST_FIXTURE_TEST_CASE(Size, QueueToStackTest) { BOOST_CHECK_EQUAL(stack.size(), 10); }
|
|
|
|
BOOST_FIXTURE_TEST_CASE(Clear, QueueToStackTest) {
|
|
stack.clear();
|
|
BOOST_CHECK_EQUAL(stack.size(), 0);
|
|
}
|
|
BOOST_AUTO_TEST_SUITE_END()
|