1 /********************************************************************
3 * THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE. *
4 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8 * THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2007 *
9 * by the Xiph.Org Foundation http://www.xiph.org/ *
11 ********************************************************************
13 function: routines for validating comment header code
16 ********************************************************************/
18 #include <theora/theoradec.h>
23 #define ARTIST1 "Bug-eyed Fish"
24 #define ARTIST2 "VJ Fugu"
25 #define COPYRIGHT "Copyright (C) 2005. Some Rights Reserved."
26 #define LICENSE "Creative Commons Attribution-ShareAlike 2.5"
35 INFO ("+ Initializing th_comment");
36 th_comment_init (&tc
);
38 INFO ("+ Adding ARTIST1");
39 th_comment_add (&tc
, "ARTIST=" ARTIST1
);
41 INFO ("+ Adding LICENSE by tag");
42 th_comment_add_tag (&tc
, "LICENSE", LICENSE
);
44 INFO ("+ Adding ARTIST2 by tag");
45 th_comment_add_tag (&tc
, "ARTIST", ARTIST2
);
47 INFO ("+ Querying value of LICENSE");
48 value
= th_comment_query (&tc
, "LICENSE", 0);
49 printf("foo %s\n", value
);
51 if (strcmp (value
, LICENSE
))
52 FAIL ("Incorrect value for LICENSE");
54 INFO ("+ Querying count of ARTIST comments");
55 n
= th_comment_query_count (&tc
, "ARTIST");
58 FAIL ("Incorrect count of ARTIST comments");
60 INFO ("+ Querying value of ARTIST index 0");
61 value
= th_comment_query (&tc
, "ARTIST", 0);
62 if (strcmp (value
, ARTIST1
))
63 FAIL ("Incorrect value for ARTIST index 0");
65 INFO ("+ Querying value of ARTIST index 1");
66 value
= th_comment_query (&tc
, "ARTIST", 1);
67 if (strcmp (value
, ARTIST2
))
68 FAIL ("Incorrect value for ARTIST index 1");
70 INFO ("+ Querying value of ARTIST index 2 (out of bounds)");
71 value
= th_comment_query (&tc
, "ARTIST", 2);
73 FAIL ("Non-NULL value for ARTIST index 2 (out of bounds)");
75 INFO ("+ Querying value of UNDEF index 7 (tag not defined)");
76 value
= th_comment_query (&tc
, "UNDEF", 7);
78 FAIL ("Non-NULL value for UNDEF index 7 (tag not defined)");
80 INFO ("+ Clearing th_comment");
81 th_comment_clear (&tc
);
86 int main(int argc
, char *argv
[])