It appears Solaris's cc is ignoring the signedness of bitfield types.
[xiph/unicode.git] / theora / tests / comment.c
blob4f2ad1744134f5e429dd0282d5428dbdbfeac264
1 /********************************************************************
2 * *
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. *
7 * *
8 * THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2007 *
9 * by the Xiph.Org Foundation http://www.xiph.org/ *
10 * *
11 ********************************************************************
13 function: routines for validating comment header code
14 last mod: $Id$
16 ********************************************************************/
18 #include <theora/theoradec.h>
20 #include <string.h>
21 #include "tests.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"
28 static int
29 test_comments ()
31 th_comment tc;
32 int n;
33 char * value;
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");
57 if (n != 2)
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);
72 if (value != NULL)
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);
77 if (value != NULL)
78 FAIL ("Non-NULL value for UNDEF index 7 (tag not defined)");
80 INFO ("+ Clearing th_comment");
81 th_comment_clear (&tc);
83 return 0;
86 int main(int argc, char *argv[])
88 test_comments ();
90 exit (0);