summaryrefslogtreecommitdiff
path: root/src/sound.test.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sound.test.c')
-rw-r--r--src/sound.test.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/sound.test.c b/src/sound.test.c
new file mode 100644
index 0000000..60dcdd1
--- /dev/null
+++ b/src/sound.test.c
@@ -0,0 +1,31 @@
+#include "test/mossrose-test.h"
+
+#include "sound.c"
+
+
+void test_sound_copy()
+{
+ struct mossrose_sound_t src, dest;
+ float left[] = { 0.1, 0.2, 0.3 };
+ float right[] = { 0.0, 0.5, 1.0 };
+ src.left = left;
+ src.right = right;
+ src.len = 3;
+
+ dest.left = NULL;
+ dest.right = NULL;
+
+ sound_copy(&dest, &src);
+
+ lily_assert_int_equal(dest.len, 3);
+ lily_assert_not_null(dest.left);
+ lily_assert_memory_equal(dest.left, left, 3*sizeof(float));
+ lily_assert_not_null(dest.right);
+ lily_assert_memory_equal(dest.right, right, 3*sizeof(float));
+}
+
+
+void suite_sound()
+{
+ lily_run_test(test_sound_copy);
+}