2014-04-13 12:26:32 -04:00
|
|
|
/*
|
|
|
|
* Copyright 2014 (c) Anna Schumaker.
|
|
|
|
*/
|
|
|
|
#include <queue.h>
|
|
|
|
#include "test.h"
|
|
|
|
|
2014-04-13 18:38:49 -04:00
|
|
|
|
2014-04-13 12:26:32 -04:00
|
|
|
class TestQueue : public Queue
|
|
|
|
{
|
|
|
|
public:
|
2014-04-13 18:38:49 -04:00
|
|
|
TestQueue() : Queue() {}
|
|
|
|
TestQueue(unsigned int f) : Queue(f) {}
|
2014-04-13 12:26:32 -04:00
|
|
|
unsigned int get_cur() { return _cur; }
|
|
|
|
unsigned int get_flags() { return _flags; }
|
|
|
|
unsigned int get_length() { return _length; }
|
|
|
|
std::list <sort_info> get_sorder() { return _sort_order; };
|
|
|
|
};
|
|
|
|
|
2014-04-13 18:38:49 -04:00
|
|
|
|
2014-04-13 12:26:32 -04:00
|
|
|
void test_default()
|
|
|
|
{
|
|
|
|
TestQueue q;
|
|
|
|
|
|
|
|
test :: equal(q.get_cur(), (unsigned)-1);
|
|
|
|
test :: equal(q.get_flags(), (unsigned)0);
|
|
|
|
test :: equal(q.get_length(), (unsigned)0);
|
|
|
|
test :: equal(q.get_sorder().size(), (size_t)0);
|
|
|
|
test :: equal(q.next(), (Track *)NULL);
|
|
|
|
}
|
|
|
|
|
2014-04-13 18:38:49 -04:00
|
|
|
void test_constructor(unsigned int flags)
|
|
|
|
{
|
|
|
|
TestQueue q(flags | (1 << 30));
|
|
|
|
|
|
|
|
test :: equal(q.get_cur(), (unsigned)-1);
|
|
|
|
test :: equal(q.get_flags(), flags);
|
|
|
|
test :: equal(q.get_length(), (unsigned)0);
|
|
|
|
test :: equal(q.get_sorder().size(), (size_t)0);
|
|
|
|
test :: equal(q.next(), (Track *)NULL);
|
|
|
|
}
|
|
|
|
|
2014-04-13 12:26:32 -04:00
|
|
|
int main(int argc, char **argv)
|
|
|
|
{
|
|
|
|
test_default();
|
2014-04-13 18:38:49 -04:00
|
|
|
test_constructor(Q_ENABLED | Q_RANDOM);
|
2014-04-13 12:26:32 -04:00
|
|
|
return 0;
|
|
|
|
}
|