Files
libxmp/test-dev/test_api_free_context.c
Claudio Matsuoka 90ef6ded4d [test] Improve test coverage
Add state checks and extra player parameters setting and retrieval.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2013-06-15 10:30:20 -03:00

32 lines
785 B
C

#include "test.h"
TEST(test_api_free_context)
{
xmp_context ctx;
int state, ret;
ctx = xmp_create_context();
fail_unless(ctx != 0, "returned NULL");
state = xmp_get_player(ctx, XMP_PLAYER_STATE);
fail_unless(state == XMP_STATE_UNLOADED, "state error");
/* load module */
ret = xmp_load_module(ctx, "data/test.xm");
fail_unless(ret == 0, "load file");
state = xmp_get_player(ctx, XMP_PLAYER_STATE);
fail_unless(state == XMP_STATE_LOADED, "state error");
/* start playing */
ret = xmp_start_player(ctx, 44100, 0);
fail_unless(ret == 0, "min sample rate failed");
state = xmp_get_player(ctx, XMP_PLAYER_STATE);
fail_unless(state == XMP_STATE_PLAYING, "state error");
/* Free context while playing */
xmp_free_context(ctx);
}
END_TEST