libSDL2pp/tests/test_wav.cc
Dmitry Marakasov 24482d85f6 Follow SDL2 include path conventions
Though these are broken and error prone, as they ignore the possibility
of conflicts between SDL, SDL2 and wrappers thereof discarding useful
include path prefix (SDL2/), since SDL and satellite libraries follow
these it's too hard to stay away.

So don't use prefixes for SDL include paths any longer.
2017-02-08 13:19:04 +03:00

36 lines
765 B
C++

#include <SDL_main.h>
#include <SDL2pp/Wav.hh>
#include "testing.h"
#include "movetest.hh"
using namespace SDL2pp;
BEGIN_TEST(int, char*[])
Wav wav(TESTDATA_DIR "/test.wav");
MOVE_TEST(Wav, wav, GetBuffer, nullptr);
{
// Wav tests
EXPECT_EQUAL(wav.GetLength(), (Uint32)121044);
EXPECT_TRUE(wav.GetBuffer() != nullptr);
EXPECT_TRUE(wav.GetBuffer() == const_cast<const Wav&>(wav).GetBuffer());
const AudioSpec& spec = wav.GetSpec();
EXPECT_EQUAL(spec.Get()->freq, 44100);
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));
}
END_TEST()