2 ** Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3 ** Distributed under the terms of the MIT License.
7 #include "FormatDescriptions.h"
9 #include <MediaFormats.h>
11 #include <cppunit/TestCaller.h>
12 #include <cppunit/TestSuite.h>
15 FormatDescriptionsTest::FormatDescriptionsTest()
20 FormatDescriptionsTest::~FormatDescriptionsTest()
26 FormatDescriptionsTest::TestCompare()
28 media_format_description a
;
29 a
.family
= B_AVI_FORMAT_FAMILY
;
30 a
.u
.avi
.codec
= 'DIVX';
32 media_format_description b
;
33 CPPUNIT_ASSERT(!(a
== b
));
36 CPPUNIT_ASSERT(!(a
== b
));
38 a
.family
= B_QUICKTIME_FORMAT_FAMILY
;
39 a
.u
.quicktime
.vendor
= 5;
40 a
.u
.quicktime
.codec
= 5;
42 b
.family
= B_QUICKTIME_FORMAT_FAMILY
;
43 b
.u
.quicktime
.vendor
= 6;
44 b
.u
.quicktime
.codec
= 5;
45 CPPUNIT_ASSERT(a
< b
);
47 b
.u
.quicktime
.vendor
= 4;
48 CPPUNIT_ASSERT(b
< a
);
50 b
.u
.quicktime
.vendor
= 5;
51 b
.u
.quicktime
.codec
= 6;
52 CPPUNIT_ASSERT(a
< b
);
54 b
.u
.quicktime
.codec
= 4;
55 CPPUNIT_ASSERT(b
< a
);
57 a
.family
= B_MISC_FORMAT_FAMILY
;
58 a
.u
.misc
.file_format
= 5;
61 b
.family
= B_MISC_FORMAT_FAMILY
;
62 b
.u
.misc
.file_format
= 6;
64 CPPUNIT_ASSERT(a
< b
);
66 b
.u
.misc
.file_format
= 4;
67 CPPUNIT_ASSERT(b
< a
);
70 b
.u
.misc
.file_format
= 5;
72 CPPUNIT_ASSERT(a
< b
);
75 CPPUNIT_ASSERT(b
< a
);
80 FormatDescriptionsTest::AddTests(BTestSuite
& parent
)
82 CppUnit::TestSuite
& suite
= *new CppUnit::TestSuite("FormatDescriptionsTest");
84 suite
.addTest(new CppUnit::TestCaller
<FormatDescriptionsTest
>(
85 "FormatDescriptionsTest::TestCompare",
86 &FormatDescriptionsTest::TestCompare
));
88 parent
.addTest("FormatDescriptionsTest", &suite
);