79 lines
1.3 KiB
C++
79 lines
1.3 KiB
C++
|
/*
|
||
|
* Copyright 2013 (c) Anna Schumaker.
|
||
|
*/
|
||
|
#include <deck.h>
|
||
|
#include <print.h>
|
||
|
|
||
|
void test_add_playlist(unsigned int size)
|
||
|
{
|
||
|
Playlist *plist = deck :: create();
|
||
|
for (unsigned i = 0; i < size; i++)
|
||
|
plist->add(i);
|
||
|
}
|
||
|
|
||
|
/* Test creating a deck of playlists */
|
||
|
void test_0()
|
||
|
{
|
||
|
for (unsigned int i = 0; i < 10; i++)
|
||
|
test_add_playlist(10 + i);
|
||
|
print("Test 0:\n");
|
||
|
deck :: print_info();
|
||
|
print("\n");
|
||
|
}
|
||
|
|
||
|
/* Test removing playlists from the deck */
|
||
|
void test_1()
|
||
|
{
|
||
|
print("Test 1:\n");
|
||
|
deck :: remove(3);
|
||
|
deck :: remove(7);
|
||
|
deck :: remove(1);
|
||
|
deck :: remove(5);
|
||
|
deck :: print_info();
|
||
|
print("\n");
|
||
|
}
|
||
|
|
||
|
/* Get a specific playlist from the deck */
|
||
|
void test_2()
|
||
|
{
|
||
|
Playlist *plist;
|
||
|
print("Test 2: ");
|
||
|
|
||
|
plist = deck :: get(3);
|
||
|
print("Playlist { size = %u, flags = %u }", plist->size(), plist->get_flags());
|
||
|
print("\n\n");
|
||
|
}
|
||
|
|
||
|
/* Move a playlist to a new position in the deck */
|
||
|
void test_3()
|
||
|
{
|
||
|
print("Test 3:\n");
|
||
|
deck :: move(4, 0);
|
||
|
deck :: print_info();
|
||
|
print("\n");
|
||
|
deck :: move(5, 1);
|
||
|
deck :: print_info();
|
||
|
print("\n");
|
||
|
deck :: move(2, 5);
|
||
|
deck :: print_info();
|
||
|
print("\n");
|
||
|
deck :: move(3, 4);
|
||
|
deck :: print_info();
|
||
|
print("\n");
|
||
|
deck :: move(4, 3);
|
||
|
deck :: print_info();
|
||
|
print("\n");
|
||
|
deck :: move(4, 4);
|
||
|
deck :: print_info();
|
||
|
print("\n");
|
||
|
}
|
||
|
|
||
|
int main(int argc, char **argv)
|
||
|
{
|
||
|
test_0();
|
||
|
test_1();
|
||
|
test_2();
|
||
|
test_3();
|
||
|
return 0;
|
||
|
}
|