Added a program to test the == and < operator of media_format_description.

Revealed some bugs in our previous implementation.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6235 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2004-01-23 06:41:19 +00:00
parent b7d3f36edc
commit db95389956
2 changed files with 67 additions and 0 deletions
+4
View File
@@ -13,6 +13,10 @@ SimpleTest mediaFormats :
mediaFormats.cpp
: media ;
SimpleTest mediaDescriptions :
mediaDescriptions.cpp
: media ;
SubInclude OBOS_TOP src tests kits media media_decoder ;
SubInclude OBOS_TOP src tests kits media notificationtest ;
SubInclude OBOS_TOP src tests kits media nodetest ;
@@ -0,0 +1,63 @@
/*
** Copyright 2004, Axel Dörfler, [email protected]. All rights reserved.
** Distributed under the terms of the OpenBeOS License.
*/
#include <MediaFormats.h>
#include <stdio.h>
int
main(int argc, char **argv)
{
media_format_description a;
a.family = B_AVI_FORMAT_FAMILY;
a.u.avi.codec = 'DIVX';
media_format_description b;
printf("avi/divx == empty? %s\n", a == b ? "yes" : "no");
b.family = a.family;
printf("avi/divx == same family, no codec? %s\n", a == b ? "yes" : "no");
a.family = B_QUICKTIME_FORMAT_FAMILY;
a.u.quicktime.vendor = 5;
a.u.quicktime.codec = 5;
b.family = B_QUICKTIME_FORMAT_FAMILY;
b.u.quicktime.vendor = 6;
b.u.quicktime.codec = 5;
printf("qt(5,5) < qt(6, 5)? %s\n", a < b ? "yes" : "no");
b.u.quicktime.vendor = 4;
printf("qt(5,5) < qt(4, 5)? %s\n", a < b ? "yes" : "no");
b.u.quicktime.vendor = 5;
b.u.quicktime.codec = 6;
printf("qt(5,5) < qt(5, 6)? %s\n", a < b ? "yes" : "no");
b.u.quicktime.codec = 4;
printf("qt(5,5) < qt(5, 4)? %s\n", a < b ? "yes" : "no");
a.family = B_MISC_FORMAT_FAMILY;
a.u.misc.file_format = 5;
a.u.misc.codec = 5;
b.family = B_MISC_FORMAT_FAMILY;
b.u.misc.file_format = 6;
b.u.misc.codec = 5;
printf("misc(5,5) < misc(6, 5)? %s\n", a < b ? "yes" : "no");
b.u.misc.file_format = 4;
printf("misc(5,5) < qt(4, 5)? %s\n", a < b ? "yes" : "no");
b.u.misc.file_format = 5;
b.u.misc.codec = 6;
printf("misc(5,5) < misc(5, 6)? %s\n", a < b ? "yes" : "no");
b.u.misc.codec = 4;
printf("misc(5,5) < misc(5, 4)? %s\n", a < b ? "yes" : "no");
return 0;
}