From a3117d0b6a9e79f11e69362c42205bc548f6c754 Mon Sep 17 00:00:00 2001
From: Kent Fredric <kentnl@gentoo.org>
Date: Fri, 13 Oct 2017 09:43:01 +1300
Subject: Rework test suite to be useful
Bug:
https://rt.cpan.org/Ticket/Display.html?id=31547
---
MANIFEST | 2 +-
t/basic.t | 23 +++++++++++++++++++++++
test.pl | 60 ------------------------------------------------------------
3 files changed, 24 insertions(+), 61 deletions(-)
create mode 100644 t/basic.t
delete mode 100644 test.pl
diff --git a/MANIFEST b/MANIFEST
index d15c4ab..b713e9a 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -5,6 +5,6 @@ Mix.c
Mix.h
Mixer.pm
Mixer.xs
-test.pl
+t/basic.t
eg/volume.pl
README
diff --git a/t/basic.t b/t/basic.t
new file mode 100644
index 0000000..53448d2
--- /dev/null
+++ b/t/basic.t
@@ -0,0 +1,23 @@
+use strict;
+use warnings;
+
+use Test::More tests => 7;
+
+require_ok("Audio::Mixer");
+
+is( Audio::Mixer::init_mixer(), 0, "Initialize Mixer" );
+
+my ( @old ) = Audio::Mixer::get_cval('vol');
+cmp_ok( scalar @old, ">", 0 , "Got existing volume levels");
+
+Audio::Mixer::set_cval('vol', 50);
+my ( @new ) = Audio::Mixer::get_cval('vol');
+is( $new[0], 50, "Set left channel to 50");
+is( $new[1], 50, "Set right channel to 50");
+
+Audio::Mixer::set_cval('vol', $old[0], $old[1]);
+my ( @final ) = Audio::Mixer::get_cval('vol');
+is( $final[0], $old[0], "Restored left channel");
+is( $final[1], $old[1], "Restored right channel");
+
+done_testing;
diff --git a/test.pl b/test.pl
deleted file mode 100644
index af1f214..0000000
--
2.14.2