mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
advio: add unit test for large download
This commit is contained in:
parent
ec48dbd5ef
commit
e8a5a431a3
1 changed files with 30 additions and 0 deletions
|
@ -27,6 +27,8 @@
|
|||
|
||||
#include <villas/utils.h>
|
||||
#include <villas/advio.h>
|
||||
#include <villas/sample.h>
|
||||
#include <villas/sample_io.h>
|
||||
|
||||
/** This URI points to a Sciebo share which contains some test files.
|
||||
* The Sciebo share is read/write accessible via WebDAV. */
|
||||
|
@ -68,6 +70,34 @@ Test(advio, download)
|
|||
cr_assert_eq(ret, 0, "Failed to close file");
|
||||
}
|
||||
|
||||
Test(advio, download_large)
|
||||
{
|
||||
AFILE *af;
|
||||
int ret, len = 16;
|
||||
|
||||
struct sample *smp = alloc(SAMPLE_LEN(len));
|
||||
smp->capacity = len;
|
||||
|
||||
af = afopen(BASE_URI "/download-large" , "r");
|
||||
cr_assert(af, "Failed to download file");
|
||||
|
||||
ret = sample_io_villas_fscan(af->file, smp, NULL);
|
||||
cr_assert_eq(ret, 0);
|
||||
|
||||
cr_assert_eq(smp->sequence, 0);
|
||||
cr_assert_eq(smp->length, 4);
|
||||
cr_assert_eq(smp->ts.origin.tv_sec, 1497710378);
|
||||
cr_assert_eq(smp->ts.origin.tv_nsec, 863332240);
|
||||
|
||||
float data[] = { 0.022245, 0.000000, -1.000000, 1.000000 };
|
||||
|
||||
for (int i = 0; i < smp->length; i++)
|
||||
cr_assert_float_eq(smp->data[i].f, data[i], 1e-5);
|
||||
|
||||
ret = afclose(af);
|
||||
cr_assert_eq(ret, 0, "Failed to close file");
|
||||
}
|
||||
|
||||
Test(advio, resume)
|
||||
{
|
||||
int ret;
|
||||
|
|
Loading…
Add table
Reference in a new issue