Add some AudioSpec tests to test_wav

This commit is contained in:
Dmitry Marakasov 2016-01-24 22:57:16 +03:00
parent 3018902475
commit ed4d777f39

View File

@ -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<const Wav&>(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();