ocarina/tests/driver.cpp

48 lines
932 B
C++

/*
* Copyright 2014 (c) Anna Schumaker.
*/
#include <driver.h>
#include "test.h"
static TestDriver *DRIVER_NULL = NULL;
static unsigned int eos_count = 0;
void on_eos()
{
eos_count++;
}
void test_driver()
{
TestDriver *driver = (TestDriver *)driver :: get_driver();
const std::string file = "/home/Zelda/Music/Wind Waker/1 - Outset Isle.ogg";
test_not_equal(driver, DRIVER_NULL);
driver->init(0, NULL, on_eos);
driver->load(file);
test_equal(driver->cur_file, file);
driver->play();
test_equal(driver->playing, true);
driver->pause();
test_equal(driver->playing, false);
driver->seek_to(4242);
test_equal(driver->cur_pos, (long)4242);
test_equal(driver->position(), (long)4242);
driver->cur_duration = 424242;
test_equal(driver->duration(), (long)424242);
driver->eos();
test_equal(eos_count, (unsigned)1);
}
int main(int argc, char **argv)
{
run_test("Test Audio Driver", test_driver);
return 0;
}