spek

Acoustic spectrum analyser
git clone http://git.hanabi.in/repos/spek.git
Log | Files | Refs | README

commit 9e7c6156b9c6ccc933a8e7b1e8c97e91ba437e8a
parent fa94bf0bf682b167a72c465a87e932d6f24f41fd
Author: Alexander Kojevnikov <alexander@kojevnikov.com>
Date:   Thu,  7 Mar 2013 09:35:43 -0800

Check only the start of the the codec name

Diffstat:
Mtests/test-audio-info.cc | 18++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/tests/test-audio-info.cc b/tests/test-audio-info.cc @@ -37,7 +37,9 @@ static void test_file(const std::string& name, const FileInfo& info) Audio audio; auto file = audio.open(SAMPLES_DIR "/" + name); test("error", AudioError::OK, file->get_error()); - test("codec", info.codec_name, file->get_codec_name()); + test(file->get_codec_name(), true, !file->get_codec_name().compare( + 0, info.codec_name.length(), info.codec_name + )); test("bit rate", info.bit_rate, file->get_bit_rate()); test("sample rate", info.sample_rate, file->get_sample_rate()); test("bps", info.bits_per_sample, file->get_bits_per_sample()); @@ -50,13 +52,13 @@ void test_audio_info() const double MP3_T = 5.0 * 1152 / 44100; // 5 frames * duration per mp3 frame std::map<std::string, FileInfo> files = { - {"1ch-96000Hz-24bps.flac", {"FLAC (Free Lossless Audio Codec)", 0, 96000, 24, 1, 0.1}}, - {"2ch-48000Hz-16bps.flac", {"FLAC (Free Lossless Audio Codec)", 0, 48000, 16, 2, 0.1}}, - {"2ch-44100Hz-16bps.wav", {"PCM signed 16-bit little-endian", 0, 44100, 16, 2, 0.1}}, - {"2ch-44100Hz-128cbr.mp3", {"MP3 (MPEG audio layer 3)", 128000, 44100, 0, 2, MP3_T}}, - {"2ch-44100Hz-320cbr.mp3", {"MP3 (MPEG audio layer 3)", 320000, 44100, 0, 2, MP3_T}}, - {"2ch-44100Hz-V0.mp3", {"MP3 (MPEG audio layer 3)", 112000, 44100, 0, 2, MP3_T}}, - {"2ch-44100Hz-V2.mp3", {"MP3 (MPEG audio layer 3)", 64000, 44100, 0, 2, MP3_T}}, + {"1ch-96000Hz-24bps.flac", {"FLAC", 0, 96000, 24, 1, 0.1}}, + {"2ch-48000Hz-16bps.flac", {"FLAC", 0, 48000, 16, 2, 0.1}}, + {"2ch-44100Hz-16bps.wav", {"PCM", 0, 44100, 16, 2, 0.1}}, + {"2ch-44100Hz-128cbr.mp3", {"MP3", 128000, 44100, 0, 2, MP3_T}}, + {"2ch-44100Hz-320cbr.mp3", {"MP3", 320000, 44100, 0, 2, MP3_T}}, + {"2ch-44100Hz-V0.mp3", {"MP3", 112000, 44100, 0, 2, MP3_T}}, + {"2ch-44100Hz-V2.mp3", {"MP3", 64000, 44100, 0, 2, MP3_T}}, }; for (const auto& item : files) { run(