Skip to content

Commit

Permalink
test: add aufile duration test
Browse files Browse the repository at this point in the history
  • Loading branch information
cspiel1 committed Jun 3, 2024
1 parent 1feddeb commit a1bf0b8
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ include_directories(${RE_INCLUDE_DIRS} ${BARESIP_INCLUDE_DIRS})

add_executable(${PROJECT_NAME}
account.c
aufile.c
call.c
cmd.c
contact.c
Expand Down
36 changes: 36 additions & 0 deletions test/aufile.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* @file test/aufile.c Baresip selftest -- module/aufile
*
* Copyright (C) 2024 commend.com - Christian Spielberger
*/
#include <string.h>
#include <re.h>
#include <rem.h>
#include <baresip.h>
#include "test.h"


int test_aufile_duration(void)
{
struct ausrc_st *ausrc = NULL;
struct ausrc_prm prm;
int err = 0;

err = module_load(".", "aufile");
TEST_ERR(err);

ASSERT_EQ(0, err);

err = ausrc_alloc(&ausrc, baresip_ausrcl(), "aufile",
&prm, "../share/message.wav", NULL, NULL, NULL);
TEST_ERR(err);
ASSERT_EQ(787, prm.duration);
ASSERT_EQ(1, prm.ch);
ASSERT_EQ(8000, prm.srate);
ASSERT_EQ(AUFMT_S16LE, prm.fmt);
ASSERT_EQ(0, prm.ptime);
out:
mem_deref(ausrc);
module_unload("aufile");
return err;
}
1 change: 1 addition & 0 deletions test/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ struct test {
static const struct test tests[] = {
TEST(test_account),
TEST(test_account_uri_complete),
TEST(test_aufile_duration),
TEST(test_call_answer),
TEST(test_call_answer_hangup_a),
TEST(test_call_answer_hangup_b),
Expand Down
1 change: 1 addition & 0 deletions test/test.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ int mock_vidisp_register(struct vidisp **vidispp,

int test_account(void);
int test_account_uri_complete(void);
int test_aufile_duration(void);
int test_aulevel(void);
int test_call_answer(void);
int test_call_answer_hangup_a(void);
Expand Down

0 comments on commit a1bf0b8

Please sign in to comment.