From ed4d777f3987b40986be27eaa11b32c2941cdf79 Mon Sep 17 00:00:00 2001 From: Dmitry Marakasov Date: Sun, 24 Jan 2016 22:57:16 +0300 Subject: [PATCH] Add some AudioSpec tests to test_wav --- tests/test_wav.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/test_wav.cc b/tests/test_wav.cc index 5137e73..eeb0bcb 100644 --- a/tests/test_wav.cc +++ b/tests/test_wav.cc @@ -10,9 +10,10 @@ BEGIN_TEST(int, char*[]) Wav wav(TESTDATA_DIR "/test.wav"); { + // Wav tests EXPECT_EQUAL(wav.GetLength(), (Uint32)121044); EXPECT_TRUE(wav.GetBuffer() != nullptr); - EXPECT_TRUE((const Uint8*)wav.GetBuffer() == (Uint8*)wav.GetBuffer()); + EXPECT_TRUE(wav.GetBuffer() == const_cast(wav).GetBuffer()); const AudioSpec& spec = wav.GetSpec(); @@ -20,6 +21,15 @@ BEGIN_TEST(int, char*[]) EXPECT_EQUAL((int)spec.Get()->channels, 2); } + { + const AudioSpec& spec = wav.GetSpec(); + + // Audiospec tests + AudioSpec spec2(spec.Get()->freq, spec.Get()->format, spec.Get()->channels, spec.Get()->samples); + + EXPECT_TRUE(spec.IsSameFormat(spec2)); + } + { // Move tests Uint8* buf = wav.GetBuffer();