30 lines
766 B
C++
30 lines
766 B
C++
|
#include <boost/test/unit_test.hpp>
|
||
|
|
||
|
#include "StackToQueue.h"
|
||
|
|
||
|
using namespace Kylin;
|
||
|
|
||
|
class StackToQueueTest {
|
||
|
public:
|
||
|
StackToQueue<size_t> queue{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
|
||
|
};
|
||
|
|
||
|
BOOST_FIXTURE_TEST_CASE(Size, StackToQueueTest) { BOOST_CHECK_EQUAL(queue.size(), 10); }
|
||
|
|
||
|
BOOST_FIXTURE_TEST_CASE(Head, StackToQueueTest) { BOOST_CHECK_EQUAL(queue.head(), 0); }
|
||
|
|
||
|
BOOST_FIXTURE_TEST_CASE(Enqueue, StackToQueueTest) {
|
||
|
queue.enqueue(10);
|
||
|
BOOST_CHECK_EQUAL(queue.size(), 11);
|
||
|
}
|
||
|
|
||
|
BOOST_FIXTURE_TEST_CASE(Dequeue, StackToQueueTest) {
|
||
|
BOOST_CHECK_EQUAL(queue.dequeue(), 0);
|
||
|
BOOST_CHECK_EQUAL(queue.size(), 9);
|
||
|
}
|
||
|
|
||
|
BOOST_FIXTURE_TEST_CASE(Clear, StackToQueueTest) {
|
||
|
queue.clear();
|
||
|
BOOST_CHECK_EQUAL(queue.size(), 0);
|
||
|
}
|