mirror of
https://github.com/taglib/taglib.git
synced 2025-07-19 05:24:25 -04:00
Refactoring of the Musepack SV8 properties code
This commit is contained in:
@ -9,6 +9,7 @@ INCLUDE_DIRECTORIES(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/mpeg/id3v2
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/mpeg/id3v2/frames
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/mpeg
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/mpc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/mp4
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/riff
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/riff/aiff
|
||||
@ -59,6 +60,7 @@ SET(test_runner_SRCS
|
||||
test_s3m.cpp
|
||||
test_it.cpp
|
||||
test_xm.cpp
|
||||
test_mpc.cpp
|
||||
)
|
||||
|
||||
ADD_EXECUTABLE(test_runner ${test_runner_SRCS})
|
||||
|
BIN
tests/data/sv4_header.mpc
Normal file
BIN
tests/data/sv4_header.mpc
Normal file
Binary file not shown.
BIN
tests/data/sv5_header.mpc
Normal file
BIN
tests/data/sv5_header.mpc
Normal file
Binary file not shown.
BIN
tests/data/sv8_header.mpc
Normal file
BIN
tests/data/sv8_header.mpc
Normal file
Binary file not shown.
62
tests/test_mpc.cpp
Normal file
62
tests/test_mpc.cpp
Normal file
@ -0,0 +1,62 @@
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
#include <string>
|
||||
#include <stdio.h>
|
||||
#include <tag.h>
|
||||
#include <tstringlist.h>
|
||||
#include <tbytevectorlist.h>
|
||||
#include <mpcfile.h>
|
||||
#include "utils.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace TagLib;
|
||||
|
||||
class TestMPC : public CppUnit::TestFixture
|
||||
{
|
||||
CPPUNIT_TEST_SUITE(TestMPC);
|
||||
CPPUNIT_TEST(testPropertiesSV8);
|
||||
CPPUNIT_TEST(testPropertiesSV7);
|
||||
CPPUNIT_TEST(testPropertiesSV5);
|
||||
CPPUNIT_TEST(testPropertiesSV4);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
public:
|
||||
|
||||
void testPropertiesSV8()
|
||||
{
|
||||
MPC::File f(TEST_FILE_PATH_C("sv8_header.mpc"));
|
||||
CPPUNIT_ASSERT_EQUAL(1, f.audioProperties()->length());
|
||||
CPPUNIT_ASSERT_EQUAL(0, f.audioProperties()->bitrate());
|
||||
CPPUNIT_ASSERT_EQUAL(2, f.audioProperties()->channels());
|
||||
CPPUNIT_ASSERT_EQUAL(44100, f.audioProperties()->sampleRate());
|
||||
}
|
||||
|
||||
void testPropertiesSV7()
|
||||
{
|
||||
MPC::File f(TEST_FILE_PATH_C("click.mpc"));
|
||||
CPPUNIT_ASSERT_EQUAL(0, f.audioProperties()->length());
|
||||
CPPUNIT_ASSERT_EQUAL(0, f.audioProperties()->bitrate());
|
||||
CPPUNIT_ASSERT_EQUAL(2, f.audioProperties()->channels());
|
||||
CPPUNIT_ASSERT_EQUAL(44100, f.audioProperties()->sampleRate());
|
||||
}
|
||||
|
||||
void testPropertiesSV5()
|
||||
{
|
||||
MPC::File f(TEST_FILE_PATH_C("sv5_header.mpc"));
|
||||
CPPUNIT_ASSERT_EQUAL(26, f.audioProperties()->length());
|
||||
CPPUNIT_ASSERT_EQUAL(0, f.audioProperties()->bitrate());
|
||||
CPPUNIT_ASSERT_EQUAL(2, f.audioProperties()->channels());
|
||||
CPPUNIT_ASSERT_EQUAL(44100, f.audioProperties()->sampleRate());
|
||||
}
|
||||
|
||||
void testPropertiesSV4()
|
||||
{
|
||||
MPC::File f(TEST_FILE_PATH_C("sv4_header.mpc"));
|
||||
CPPUNIT_ASSERT_EQUAL(26, f.audioProperties()->length());
|
||||
CPPUNIT_ASSERT_EQUAL(0, f.audioProperties()->bitrate());
|
||||
CPPUNIT_ASSERT_EQUAL(2, f.audioProperties()->channels());
|
||||
CPPUNIT_ASSERT_EQUAL(44100, f.audioProperties()->sampleRate());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(TestMPC);
|
Reference in New Issue
Block a user