diff --git a/test/aupos.c b/test/aupos.c index 4887fda43..9cd159a97 100644 --- a/test/aupos.c +++ b/test/aupos.c @@ -19,7 +19,7 @@ int test_auposition(void) struct aufile *af = NULL; struct aufile_prm prm; char path[256]; - uint8_t buffer[128]; + uint8_t buffer[512]; re_snprintf(path, sizeof(path), "%s/beep.wav", test_datapath()); @@ -29,13 +29,30 @@ int test_auposition(void) err = aufile_set_position(af, &prm, 67); TEST_ERR(err); - /* That file is 67 ms long, so we shouldn't read anything */ + /* That file is exactly 67 ms long, so we shouldn't read anything */ size_t size = sizeof(buffer); err = aufile_read(af, buffer, &size); TEST_ERR(err); TEST_EQUALS(0, size); + af = mem_deref(af); + + err = aufile_open(&af, &prm, path, AUFILE_READ); + TEST_ERR(err); + + err = aufile_set_position(af, &prm, 37); + TEST_ERR(err); + + size = sizeof(buffer); + err = aufile_read(af, buffer, &size); + TEST_ERR(err); + + /* 30 ms should be left, at 8000Hz/s, one channels and 16 bit samples + that's 480 bytes */ + TEST_EQUALS(480, size); + + out: mem_deref(af);