Add basic Shorten tests

This commit is contained in:
Stephen F. Booth 2024-12-08 19:05:58 -06:00
parent ea17b6c638
commit eeedfd8bd4
No known key found for this signature in database
GPG Key ID: 900AAC885063A183
5 changed files with 65 additions and 0 deletions

View File

@ -27,6 +27,7 @@ INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/xm
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/dsf
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/dsdiff
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/shn
)
SET(test_runner_SRCS
@ -74,6 +75,7 @@ SET(test_runner_SRCS
test_speex.cpp
test_dsf.cpp
test_dsdiff.cpp
test_shn.cpp
test_sizes.cpp
test_versionnumber.cpp
)

File diff suppressed because one or more lines are too long

View File

@ -385,6 +385,7 @@ public:
CPPUNIT_ASSERT(extensions.contains("dsf"));
CPPUNIT_ASSERT(extensions.contains("dff"));
CPPUNIT_ASSERT(extensions.contains("dsdiff"));
CPPUNIT_ASSERT(extensions.contains("shn"));
}
void testFileResolver()

44
tests/test_shn.cpp Normal file
View File

@ -0,0 +1,44 @@
#include <string>
#include <cstdio>
#include "tbytevectorlist.h"
#include "tpropertymap.h"
#include "tag.h"
#include "shnfile.h"
#include "plainfile.h"
#include <cppunit/extensions/HelperMacros.h>
#include "utils.h"
using namespace std;
using namespace TagLib;
class TestSHN : public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE(TestSHN);
CPPUNIT_TEST(testBasic);
CPPUNIT_TEST(testTags);
CPPUNIT_TEST_SUITE_END();
public:
void testBasic()
{
SHN::File f(TEST_FILE_PATH_C("2sec-silence.shn"));
CPPUNIT_ASSERT(f.audioProperties());
CPPUNIT_ASSERT_EQUAL(2, f.audioProperties()->lengthInSeconds());
CPPUNIT_ASSERT_EQUAL(2000, f.audioProperties()->lengthInMilliseconds());
CPPUNIT_ASSERT_EQUAL(1411, f.audioProperties()->bitrate());
CPPUNIT_ASSERT_EQUAL(2, f.audioProperties()->channels());
CPPUNIT_ASSERT_EQUAL(44100, f.audioProperties()->sampleRate());
CPPUNIT_ASSERT_EQUAL(2, f.audioProperties()->shortenVersion());
CPPUNIT_ASSERT_EQUAL(5, f.audioProperties()->internalFileType());
CPPUNIT_ASSERT_EQUAL(16, f.audioProperties()->bitsPerSample());
CPPUNIT_ASSERT_EQUAL(static_cast<unsigned long>(88200), f.audioProperties()->sampleFrames());
}
void testTags()
{
}
};
CPPUNIT_TEST_SUITE_REGISTRATION(TestSHN);

View File

@ -92,6 +92,9 @@
#include "rifffile.h"
#include "s3mfile.h"
#include "s3mproperties.h"
#include "shnfile.h"
#include "shnproperties.h"
#include "shntag.h"
#include "speexfile.h"
#include "speexproperties.h"
#include "synchronizedlyricsframe.h"
@ -245,6 +248,9 @@ public:
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::RIFF::WAV::Properties));
CPPUNIT_ASSERT_EQUAL(classSize(2, true), sizeof(TagLib::S3M::File));
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::S3M::Properties));
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::SHN::File));
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::SHN::Properties));
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::SHN::Tag));
CPPUNIT_ASSERT_EQUAL(classSize(1, false), sizeof(TagLib::String));
CPPUNIT_ASSERT_EQUAL(classSize(2, false), sizeof(TagLib::StringList));
CPPUNIT_ASSERT_EQUAL(classSize(0, true), sizeof(TagLib::Tag));