| 1 | /*************************************************************************** |
| 2 | copyright : (C) 2023 Scott Wheeler |
| 3 | email : [email protected] |
| 4 | ***************************************************************************/ |
| 5 | |
| 6 | /*************************************************************************** |
| 7 | * This library is free software; you can redistribute it and/or modify * |
| 8 | * it under the terms of the GNU Lesser General Public License version * |
| 9 | * 2.1 as published by the Free Software Foundation. * |
| 10 | * * |
| 11 | * This library is distributed in the hope that it will be useful, but * |
| 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * |
| 14 | * Lesser General Public License for more details. * |
| 15 | * * |
| 16 | * You should have received a copy of the GNU Lesser General Public * |
| 17 | * License along with this library; if not, write to the Free Software * |
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * |
| 19 | * 02110-1301 USA * |
| 20 | * * |
| 21 | * Alternatively, this file is available under the Mozilla Public * |
| 22 | * License Version 1.1. You may obtain a copy of the License at * |
| 23 | * http://www.mozilla.org/MPL/ * |
| 24 | ***************************************************************************/ |
| 25 | |
| 26 | #include <cstring> |
| 27 | |
| 28 | #include "taglib_config.h" |
| 29 | #include "tag.h" |
| 30 | #include "tbytevector.h" |
| 31 | #include "tbytevectorlist.h" |
| 32 | #include "tbytevectorstream.h" |
| 33 | #include "tdebuglistener.h" |
| 34 | #include "tfile.h" |
| 35 | #include "tfilestream.h" |
| 36 | #include "tiostream.h" |
| 37 | #include "tlist.h" |
| 38 | #include "tmap.h" |
| 39 | #include "tpropertymap.h" |
| 40 | #include "tstring.h" |
| 41 | #include "tstringlist.h" |
| 42 | #include "fileref.h" |
| 43 | #include "mpegfile.h" |
| 44 | #include "mpegheader.h" |
| 45 | #include "mpegproperties.h" |
| 46 | #include "xingheader.h" |
| 47 | #include "id3v1tag.h" |
| 48 | #include "id3v2extendedheader.h" |
| 49 | #include "id3v2footer.h" |
| 50 | #include "id3v2frame.h" |
| 51 | #include "id3v2framefactory.h" |
| 52 | #include "id3v2header.h" |
| 53 | #include "id3v2tag.h" |
| 54 | #include "attachedpictureframe.h" |
| 55 | #include "audioproperties.h" |
| 56 | #include "chapterframe.h" |
| 57 | #include "commentsframe.h" |
| 58 | #include "eventtimingcodesframe.h" |
| 59 | #include "generalencapsulatedobjectframe.h" |
| 60 | #include "ownershipframe.h" |
| 61 | #include "podcastframe.h" |
| 62 | #include "popularimeterframe.h" |
| 63 | #include "privateframe.h" |
| 64 | #include "relativevolumeframe.h" |
| 65 | #include "synchronizedlyricsframe.h" |
| 66 | #include "tableofcontentsframe.h" |
| 67 | #include "textidentificationframe.h" |
| 68 | #include "uniquefileidentifierframe.h" |
| 69 | #include "unknownframe.h" |
| 70 | #include "unsynchronizedlyricsframe.h" |
| 71 | #include "urllinkframe.h" |
| 72 | #ifdef TAGLIB_WITH_RIFF |
| 73 | #include "aifffile.h" |
| 74 | #include "aiffproperties.h" |
| 75 | #include "infotag.h" |
| 76 | #include "rifffile.h" |
| 77 | #include "wavfile.h" |
| 78 | #include "wavproperties.h" |
| 79 | #endif |
| 80 | #ifdef TAGLIB_WITH_APE |
| 81 | #include "apefile.h" |
| 82 | #include "apefooter.h" |
| 83 | #include "apeitem.h" |
| 84 | #include "apeproperties.h" |
| 85 | #include "apetag.h" |
| 86 | #include "mpcfile.h" |
| 87 | #include "mpcproperties.h" |
| 88 | #include "wavpackfile.h" |
| 89 | #include "wavpackproperties.h" |
| 90 | #endif |
| 91 | #ifdef TAGLIB_WITH_ASF |
| 92 | #include "asfattribute.h" |
| 93 | #include "asffile.h" |
| 94 | #include "asfpicture.h" |
| 95 | #include "asfproperties.h" |
| 96 | #include "asftag.h" |
| 97 | #endif |
| 98 | #ifdef TAGLIB_WITH_DSF |
| 99 | #include "dsffile.h" |
| 100 | #include "dsfproperties.h" |
| 101 | #include "dsdifffile.h" |
| 102 | #include "dsdiffproperties.h" |
| 103 | #endif |
| 104 | #ifdef TAGLIB_WITH_VORBIS |
| 105 | #include "flacfile.h" |
| 106 | #include "flacmetadatablock.h" |
| 107 | #include "flacunknownmetadatablock.h" |
| 108 | #include "flacpicture.h" |
| 109 | #include "flacproperties.h" |
| 110 | #include "oggfile.h" |
| 111 | #include "oggflacfile.h" |
| 112 | #include "oggpage.h" |
| 113 | #include "oggpageheader.h" |
| 114 | #include "opusfile.h" |
| 115 | #include "opusproperties.h" |
| 116 | #include "speexfile.h" |
| 117 | #include "speexproperties.h" |
| 118 | #include "vorbisfile.h" |
| 119 | #include "vorbisproperties.h" |
| 120 | #include "xiphcomment.h" |
| 121 | #endif |
| 122 | #ifdef TAGLIB_WITH_MOD |
| 123 | #include "itfile.h" |
| 124 | #include "itproperties.h" |
| 125 | #include "modfile.h" |
| 126 | #include "modfilebase.h" |
| 127 | #include "modproperties.h" |
| 128 | #include "modtag.h" |
| 129 | #include "s3mfile.h" |
| 130 | #include "s3mproperties.h" |
| 131 | #include "xmfile.h" |
| 132 | #include "xmproperties.h" |
| 133 | #endif |
| 134 | #ifdef TAGLIB_WITH_MP4 |
| 135 | #include "mp4coverart.h" |
| 136 | #include "mp4file.h" |
| 137 | #include "mp4item.h" |
| 138 | #include "mp4itemfactory.h" |
| 139 | #include "mp4properties.h" |
| 140 | #include "mp4tag.h" |
| 141 | #endif |
| 142 | #ifdef TAGLIB_WITH_SHORTEN |
| 143 | #include "shortenfile.h" |
| 144 | #include "shortenproperties.h" |
| 145 | #include "shortentag.h" |
| 146 | #endif |
| 147 | #ifdef TAGLIB_WITH_TRUEAUDIO |
| 148 | #include "trueaudiofile.h" |
| 149 | #include "trueaudioproperties.h" |
| 150 | #endif |
| 151 | #ifdef TAGLIB_WITH_MATROSKA |
| 152 | #include "matroskaattachedfile.h" |
| 153 | #include "matroskaattachments.h" |
| 154 | #include "matroskachapteredition.h" |
| 155 | #include "matroskachapters.h" |
| 156 | #include "matroskafile.h" |
| 157 | #include "matroskaproperties.h" |
| 158 | #include "matroskatag.h" |
| 159 | #endif |
| 160 | |
| 161 | #include <cppunit/extensions/HelperMacros.h> |
| 162 | |
| 163 | using namespace std; |
| 164 | using namespace TagLib; |
| 165 | |
| 166 | class TestSizes : public CppUnit::TestFixture |
| 167 | { |
| 168 | CPPUNIT_TEST_SUITE(TestSizes); |
| 169 | CPPUNIT_TEST(testSizes); |
| 170 | CPPUNIT_TEST_SUITE_END(); |
| 171 | |
| 172 | public: |
| 173 | void testSizes() |
| 174 | { |
| 175 | // Class list was built by generating XML docs with Doxygen, and then running: |
| 176 | // $ grep kind=\"class\" index.xml | sed -E -e 's/(.*<name>|<\/name>.*)//g' |
| 177 | |
| 178 | CPPUNIT_ASSERT_EQUAL(classSize(0, true), sizeof(TagLib::AudioProperties)); |
| 179 | CPPUNIT_ASSERT_EQUAL(classSize(0, false), sizeof(TagLib::ByteVector)); |
| 180 | CPPUNIT_ASSERT_EQUAL(classSize(2, false), sizeof(TagLib::ByteVectorList)); |
| 181 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::ByteVectorStream)); |
| 182 | CPPUNIT_ASSERT_EQUAL(classSize(0, true), sizeof(TagLib::DebugListener)); |
| 183 | CPPUNIT_ASSERT_EQUAL(classSize(0, true), sizeof(TagLib::File)); |
| 184 | CPPUNIT_ASSERT_EQUAL(classSize(1, false), sizeof(TagLib::FileRef)); |
| 185 | CPPUNIT_ASSERT_EQUAL(classSize(0, true), sizeof(TagLib::FileRef::FileTypeResolver)); |
| 186 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::FileRef::StreamTypeResolver)); |
| 187 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::FileStream)); |
| 188 | CPPUNIT_ASSERT_EQUAL(classSize(0, true), sizeof(TagLib::ID3v1::StringHandler)); |
| 189 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::ID3v1::Tag)); |
| 190 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::ID3v2::AttachedPictureFrame)); |
| 191 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::ID3v2::AttachedPictureFrameV22)); |
| 192 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::ID3v2::ChapterFrame)); |
| 193 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::ID3v2::CommentsFrame)); |
| 194 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::ID3v2::EventTimingCodesFrame)); |
| 195 | CPPUNIT_ASSERT_EQUAL(classSize(0, false), sizeof(TagLib::ID3v2::ExtendedHeader)); |
| 196 | CPPUNIT_ASSERT_EQUAL(classSize(0, false), sizeof(TagLib::ID3v2::Footer)); |
| 197 | CPPUNIT_ASSERT_EQUAL(classSize(0, true), sizeof(TagLib::ID3v2::Frame)); |
| 198 | CPPUNIT_ASSERT_EQUAL(classSize(0, true), sizeof(TagLib::ID3v2::FrameFactory)); |
| 199 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::ID3v2::GeneralEncapsulatedObjectFrame)); |
| 200 | CPPUNIT_ASSERT_EQUAL(classSize(0, false), sizeof(TagLib::ID3v2::Header)); |
| 201 | CPPUNIT_ASSERT_EQUAL(classSize(0, true), sizeof(TagLib::ID3v2::Latin1StringHandler)); |
| 202 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::ID3v2::OwnershipFrame)); |
| 203 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::ID3v2::PodcastFrame)); |
| 204 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::ID3v2::PopularimeterFrame)); |
| 205 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::ID3v2::PrivateFrame)); |
| 206 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::ID3v2::RelativeVolumeFrame)); |
| 207 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::ID3v2::SynchronizedLyricsFrame)); |
| 208 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::ID3v2::TableOfContentsFrame)); |
| 209 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::ID3v2::Tag)); |
| 210 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::ID3v2::TextIdentificationFrame)); |
| 211 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::ID3v2::UniqueFileIdentifierFrame)); |
| 212 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::ID3v2::UnknownFrame)); |
| 213 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::ID3v2::UnsynchronizedLyricsFrame)); |
| 214 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::ID3v2::UrlLinkFrame)); |
| 215 | CPPUNIT_ASSERT_EQUAL(classSize(2, true), sizeof(TagLib::ID3v2::UserTextIdentificationFrame)); |
| 216 | CPPUNIT_ASSERT_EQUAL(classSize(2, true), sizeof(TagLib::ID3v2::UserUrlLinkFrame)); |
| 217 | CPPUNIT_ASSERT_EQUAL(classSize(0, true), sizeof(TagLib::IOStream)); |
| 218 | CPPUNIT_ASSERT_EQUAL(classSize(1, false), sizeof(TagLib::List<int>)); |
| 219 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::MPEG::File)); |
| 220 | CPPUNIT_ASSERT_EQUAL(classSize(1, false), sizeof(TagLib::MPEG::Header)); |
| 221 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::MPEG::Properties)); |
| 222 | CPPUNIT_ASSERT_EQUAL(classSize(0, false), sizeof(TagLib::MPEG::XingHeader)); |
| 223 | CPPUNIT_ASSERT_EQUAL(classSize(1, false), sizeof(TagLib::Map<int, int>)); |
| 224 | CPPUNIT_ASSERT_EQUAL(classSize(2, false), sizeof(TagLib::PropertyMap)); |
| 225 | CPPUNIT_ASSERT_EQUAL(classSize(1, false), sizeof(TagLib::String)); |
| 226 | CPPUNIT_ASSERT_EQUAL(classSize(2, false), sizeof(TagLib::StringList)); |
| 227 | CPPUNIT_ASSERT_EQUAL(classSize(0, true), sizeof(TagLib::Tag)); |
| 228 | #ifdef TAGLIB_WITH_APE |
| 229 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::APE::File)); |
| 230 | CPPUNIT_ASSERT_EQUAL(classSize(0, false), sizeof(TagLib::APE::Footer)); |
| 231 | CPPUNIT_ASSERT_EQUAL(classSize(0, false), sizeof(TagLib::APE::Item)); |
| 232 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::APE::Properties)); |
| 233 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::APE::Tag)); |
| 234 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::MPC::File)); |
| 235 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::MPC::Properties)); |
| 236 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::WavPack::File)); |
| 237 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::WavPack::Properties)); |
| 238 | #endif |
| 239 | #ifdef TAGLIB_WITH_ASF |
| 240 | CPPUNIT_ASSERT_EQUAL(classSize(1, false), sizeof(TagLib::ASF::Attribute)); |
| 241 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::ASF::File)); |
| 242 | CPPUNIT_ASSERT_EQUAL(classSize(1, false), sizeof(TagLib::ASF::Picture)); |
| 243 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::ASF::Properties)); |
| 244 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::ASF::Tag)); |
| 245 | #endif |
| 246 | #ifdef TAGLIB_WITH_DSF |
| 247 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::DSDIFF::DIIN::Tag)); |
| 248 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::DSDIFF::File)); |
| 249 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::DSDIFF::Properties)); |
| 250 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::DSF::File)); |
| 251 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::DSF::Properties)); |
| 252 | #endif |
| 253 | #ifdef TAGLIB_WITH_VORBIS |
| 254 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::FLAC::File)); |
| 255 | CPPUNIT_ASSERT_EQUAL(classSize(0, true), sizeof(TagLib::FLAC::MetadataBlock)); |
| 256 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::FLAC::Picture)); |
| 257 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::FLAC::Properties)); |
| 258 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::FLAC::UnknownMetadataBlock)); |
| 259 | CPPUNIT_ASSERT_EQUAL(classSize(2, true), sizeof(TagLib::Ogg::FLAC::File)); |
| 260 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::Ogg::File)); |
| 261 | CPPUNIT_ASSERT_EQUAL(classSize(2, true), sizeof(TagLib::Ogg::Opus::File)); |
| 262 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::Ogg::Opus::Properties)); |
| 263 | CPPUNIT_ASSERT_EQUAL(classSize(0, false), sizeof(TagLib::Ogg::Page)); |
| 264 | CPPUNIT_ASSERT_EQUAL(classSize(0, false), sizeof(TagLib::Ogg::PageHeader)); |
| 265 | CPPUNIT_ASSERT_EQUAL(classSize(2, true), sizeof(TagLib::Ogg::Speex::File)); |
| 266 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::Ogg::Speex::Properties)); |
| 267 | CPPUNIT_ASSERT_EQUAL(classSize(2, true), sizeof(TagLib::Ogg::Vorbis::File)); |
| 268 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::Ogg::Vorbis::Properties)); |
| 269 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::Ogg::XiphComment)); |
| 270 | #endif |
| 271 | #ifdef TAGLIB_WITH_MOD |
| 272 | CPPUNIT_ASSERT_EQUAL(classSize(2, true), sizeof(TagLib::IT::File)); |
| 273 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::IT::Properties)); |
| 274 | CPPUNIT_ASSERT_EQUAL(classSize(2, true), sizeof(TagLib::Mod::File)); |
| 275 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::Mod::FileBase)); |
| 276 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::Mod::Properties)); |
| 277 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::Mod::Tag)); |
| 278 | CPPUNIT_ASSERT_EQUAL(classSize(2, true), sizeof(TagLib::S3M::File)); |
| 279 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::S3M::Properties)); |
| 280 | CPPUNIT_ASSERT_EQUAL(classSize(2, true), sizeof(TagLib::XM::File)); |
| 281 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::XM::Properties)); |
| 282 | CPPUNIT_ASSERT_EQUAL(classSize(1, false), sizeof(TagLib::Variant)); |
| 283 | #endif |
| 284 | #ifdef TAGLIB_WITH_MP4 |
| 285 | CPPUNIT_ASSERT_EQUAL(classSize(1, false), sizeof(TagLib::MP4::CoverArt)); |
| 286 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::MP4::File)); |
| 287 | CPPUNIT_ASSERT_EQUAL(classSize(1, false), sizeof(TagLib::MP4::Item)); |
| 288 | CPPUNIT_ASSERT_EQUAL(classSize(0, true), sizeof(TagLib::MP4::ItemFactory)); |
| 289 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::MP4::Properties)); |
| 290 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::MP4::Tag)); |
| 291 | #endif |
| 292 | #ifdef TAGLIB_WITH_RIFF |
| 293 | CPPUNIT_ASSERT_EQUAL(classSize(2, true), sizeof(TagLib::RIFF::AIFF::File)); |
| 294 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::RIFF::AIFF::Properties)); |
| 295 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::RIFF::File)); |
| 296 | CPPUNIT_ASSERT_EQUAL(classSize(0, true), sizeof(TagLib::RIFF::Info::StringHandler)); |
| 297 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::RIFF::Info::Tag)); |
| 298 | CPPUNIT_ASSERT_EQUAL(classSize(2, true), sizeof(TagLib::RIFF::WAV::File)); |
| 299 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::RIFF::WAV::Properties)); |
| 300 | #endif |
| 301 | #ifdef TAGLIB_WITH_SHORTEN |
| 302 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::Shorten::File)); |
| 303 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::Shorten::Properties)); |
| 304 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::Shorten::Tag)); |
| 305 | #endif |
| 306 | #ifdef TAGLIB_WITH_TRUEAUDIO |
| 307 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::TrueAudio::File)); |
| 308 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::TrueAudio::Properties)); |
| 309 | #endif |
| 310 | #ifdef TAGLIB_WITH_MATROSKA |
| 311 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::Matroska::File)); |
| 312 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::Matroska::Properties)); |
| 313 | CPPUNIT_ASSERT_EQUAL(classSize(3, true), sizeof(TagLib::Matroska::Tag)); |
| 314 | CPPUNIT_ASSERT_EQUAL(classSize(0, true), sizeof(TagLib::Matroska::Element)); |
| 315 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::Matroska::Attachments)); |
| 316 | CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::Matroska::Chapters)); |
| 317 | CPPUNIT_ASSERT_EQUAL(classSize(0, false), sizeof(TagLib::Matroska::ChapterEdition)); |
| 318 | CPPUNIT_ASSERT_EQUAL(classSize(0, false), sizeof(TagLib::Matroska::Chapter)); |
| 319 | CPPUNIT_ASSERT_EQUAL(classSize(0, false), sizeof(TagLib::Matroska::Chapter::Display)); |
| 320 | CPPUNIT_ASSERT_EQUAL(classSize(0, false), sizeof(TagLib::Matroska::SimpleTag)); |
| 321 | CPPUNIT_ASSERT_EQUAL(classSize(0, false), sizeof(TagLib::Matroska::AttachedFile)); |
| 322 | #endif |
| 323 | } |
| 324 | |
| 325 | private: |
| 326 | constexpr size_t classSize(int baseClasses, bool isVirtual) |
| 327 | { |
| 328 | return sizeof(void *) * (baseClasses + static_cast<int>(isVirtual) + 1); |
| 329 | } |
| 330 | }; |
| 331 | |
| 332 | CPPUNIT_TEST_SUITE_REGISTRATION(TestSizes); |