[xiph-commits] r14378 - trunk/theora/tests

giles at svn.xiph.org giles at svn.xiph.org
Mon Jan 7 17:08:13 PST 2008


Author: giles
Date: 2008-01-07 17:08:12 -0800 (Mon, 07 Jan 2008)
New Revision: 14378

Added:
   trunk/theora/tests/comment.c
   trunk/theora/tests/comment_theora.c
   trunk/theora/tests/noop_theora.c
Removed:
   trunk/theora/tests/comment-test.c
Modified:
   trunk/theora/tests/Makefile.am
   trunk/theora/tests/noop.c
Log:
Add copies of the noop and comment unit tests using the new style api.
Test the old style api unit tests with both the new and old libraries.


Modified: trunk/theora/tests/Makefile.am
===================================================================
--- trunk/theora/tests/Makefile.am	2008-01-06 06:16:50 UTC (rev 14377)
+++ trunk/theora/tests/Makefile.am	2008-01-08 01:08:12 UTC (rev 14378)
@@ -6,23 +6,49 @@
 
 THEORADIR = ../lib
 THEORA_LIBS = $(THEORADIR)/libtheora.la $(OGG_LIBS)
-
+THEORADEC_LIBS = $(THEORADIR)/libtheoradec.la $(OGG_LIBS)
+THEORAENC_LIBS = $(THEORADIR)/libtheoraenc.la \
+		 $(THEORADIR)/libtheoradec.la $(OGG_LIBS)
 test: check
 
 TESTS_ENVIRONMENT = $(VALGRIND_ENVIRONMENT)
 
-TESTS = noop comment-test granulepos
+TESTS = noop noop_theoraenc noop_theora \
+	comment comment_theoradec comment_theora \
+	granulepos
 
 noinst_PROGRAMS = $(TESTS)
 
+# dummy call tests for the current api
 noop_SOURCES = noop.c
-noop_LDADD = $(THEORA_LIBS)
+noop_LDADD = $(THEORAENC_LIBS)
 noop_CFLAGS = $(OGG_CFLAGS)
 
-comment_test_SOURCES = comment-test.c
-comment_test_LDADD = $(THEORA_LIBS)
-comment_test_CFLAGS = $(OGG_CFLAGS)
+# dummy call tests for the pre-1.0 legacy api with current link line
+noop_theoraenc_SOURCES = noop_theora.c
+noop_theoraenc_LDADD = $(THEORAENC_LIBS)
+noop_theoraenc_CFLAGS = $(OGG_CFLAGS)
 
+# dummy call tests for the pre-1.0 legacy api with legacy link line
+noop_theora_SOURCES = noop_theora.c
+noop_theora_LDADD = $(THEORA_LIBS)
+noop_theora_CFLAGS = $(OGG_CFLAGS)
+
+# comment utilities for the current api
+comment_SOURCES = comment.c
+comment_LDADD = $(THEORADEC_LIBS)
+comment_CFLAGS = $(OGG_CFLAGS)
+
+# comment utilities for the legacy api and current lib
+comment_theoradec_SOURCES = comment.c
+comment_theoradec_LDADD = $(THEORADEC_LIBS)
+comment_theoradec_CFLAGS = $(OGG_CFLAGS)
+
+# comment utilities for the legacy api and legacy lib
+comment_theora_SOURCES = comment_theora.c
+comment_theora_LDADD = $(THEORA_LIBS)
+comment_theora_CFLAGS = $(OGG_CFLAGS)
+
 granulepos_SOURCES = granulepos.c
 granulepos_LDADD = $(THEORA_LIBS)
 granulepos_CFLAGS = $(OGG_CFLAGS)

Deleted: trunk/theora/tests/comment-test.c
===================================================================
--- trunk/theora/tests/comment-test.c	2008-01-06 06:16:50 UTC (rev 14377)
+++ trunk/theora/tests/comment-test.c	2008-01-08 01:08:12 UTC (rev 14378)
@@ -1,91 +0,0 @@
-/********************************************************************
- *                                                                  *
- * THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE.   *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
- *                                                                  *
- * THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2007                *
- * by the Xiph.Org Foundation http://www.xiph.org/                  *
- *                                                                  *
- ********************************************************************
-
-  function: routines for validating comment header code
-  last mod: $Id$
-
- ********************************************************************/
-
-#include <theora/theora.h>
-
-#include <string.h>
-#include "tests.h"
-
-#define ARTIST1 "Bug-eyed Fish"
-#define ARTIST2 "VJ Fugu"
-#define COPYRIGHT "Copyright (C) 2005. Some Rights Reserved."
-#define LICENSE "Creative Commons Attribution-ShareAlike 2.5"
-
-static int
-test_comments ()
-{
-  theora_comment tc;
-  int n;
-  char * value;
-
-  INFO ("+ Initializing theora_comment");
-  theora_comment_init (&tc);
-
-  INFO ("+ Adding ARTIST1");
-  theora_comment_add (&tc, "ARTIST=" ARTIST1);
-
-  INFO ("+ Adding LICENSE by tag");
-  theora_comment_add_tag (&tc, "LICENSE", LICENSE);
-
-  INFO ("+ Adding ARTIST2 by tag");
-  theora_comment_add_tag (&tc, "ARTIST", ARTIST2);
-
-  INFO ("+ Querying value of LICENSE");
-  value = theora_comment_query (&tc, "LICENSE", 0);
-  printf("foo %s\n", value);
-
-  if (strcmp (value, LICENSE))
-    FAIL ("Incorrect value for LICENSE");
-
-  INFO ("+ Querying count of ARTIST comments");
-  n = theora_comment_query_count (&tc, "ARTIST");
-
-  if (n != 2)
-    FAIL ("Incorrect count of ARTIST comments");
-
-  INFO ("+ Querying value of ARTIST index 0");
-  value = theora_comment_query (&tc, "ARTIST", 0);
-  if (strcmp (value, ARTIST1))
-    FAIL ("Incorrect value for ARTIST index 0");
-
-  INFO ("+ Querying value of ARTIST index 1");
-  value = theora_comment_query (&tc, "ARTIST", 1);
-  if (strcmp (value, ARTIST2))
-    FAIL ("Incorrect value for ARTIST index 1");
-
-  INFO ("+ Querying value of ARTIST index 2 (out of bounds)");
-  value = theora_comment_query (&tc, "ARTIST", 2);
-  if (value != NULL)
-    FAIL ("Non-NULL value for ARTIST index 2 (out of bounds)");
-
-  INFO ("+ Querying value of UNDEF index 7 (tag not defined)");
-  value = theora_comment_query (&tc, "UNDEF", 7);
-  if (value != NULL)
-    FAIL ("Non-NULL value for UNDEF index 7 (tag not defined)");
-
-  INFO ("+ Clearing theora_comment");
-  theora_comment_clear (&tc);
-
-  return 0;
-}
-
-int main(int argc, char *argv[])
-{
-  test_comments ();
-
-  exit (0);
-}

Copied: trunk/theora/tests/comment.c (from rev 14376, trunk/theora/tests/comment-test.c)
===================================================================
--- trunk/theora/tests/comment.c	                        (rev 0)
+++ trunk/theora/tests/comment.c	2008-01-08 01:08:12 UTC (rev 14378)
@@ -0,0 +1,91 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE.   *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2007                *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+  function: routines for validating comment header code
+  last mod: $Id$
+
+ ********************************************************************/
+
+#include <theora/theoradec.h>
+
+#include <string.h>
+#include "tests.h"
+
+#define ARTIST1 "Bug-eyed Fish"
+#define ARTIST2 "VJ Fugu"
+#define COPYRIGHT "Copyright (C) 2005. Some Rights Reserved."
+#define LICENSE "Creative Commons Attribution-ShareAlike 2.5"
+
+static int
+test_comments ()
+{
+  th_comment tc;
+  int n;
+  char * value;
+
+  INFO ("+ Initializing th_comment");
+  th_comment_init (&tc);
+
+  INFO ("+ Adding ARTIST1");
+  th_comment_add (&tc, "ARTIST=" ARTIST1);
+
+  INFO ("+ Adding LICENSE by tag");
+  th_comment_add_tag (&tc, "LICENSE", LICENSE);
+
+  INFO ("+ Adding ARTIST2 by tag");
+  th_comment_add_tag (&tc, "ARTIST", ARTIST2);
+
+  INFO ("+ Querying value of LICENSE");
+  value = th_comment_query (&tc, "LICENSE", 0);
+  printf("foo %s\n", value);
+
+  if (strcmp (value, LICENSE))
+    FAIL ("Incorrect value for LICENSE");
+
+  INFO ("+ Querying count of ARTIST comments");
+  n = th_comment_query_count (&tc, "ARTIST");
+
+  if (n != 2)
+    FAIL ("Incorrect count of ARTIST comments");
+
+  INFO ("+ Querying value of ARTIST index 0");
+  value = th_comment_query (&tc, "ARTIST", 0);
+  if (strcmp (value, ARTIST1))
+    FAIL ("Incorrect value for ARTIST index 0");
+
+  INFO ("+ Querying value of ARTIST index 1");
+  value = th_comment_query (&tc, "ARTIST", 1);
+  if (strcmp (value, ARTIST2))
+    FAIL ("Incorrect value for ARTIST index 1");
+
+  INFO ("+ Querying value of ARTIST index 2 (out of bounds)");
+  value = th_comment_query (&tc, "ARTIST", 2);
+  if (value != NULL)
+    FAIL ("Non-NULL value for ARTIST index 2 (out of bounds)");
+
+  INFO ("+ Querying value of UNDEF index 7 (tag not defined)");
+  value = th_comment_query (&tc, "UNDEF", 7);
+  if (value != NULL)
+    FAIL ("Non-NULL value for UNDEF index 7 (tag not defined)");
+
+  INFO ("+ Clearing th_comment");
+  th_comment_clear (&tc);
+
+  return 0;
+}
+
+int main(int argc, char *argv[])
+{
+  test_comments ();
+
+  exit (0);
+}

Copied: trunk/theora/tests/comment_theora.c (from rev 14376, trunk/theora/tests/comment-test.c)
===================================================================
--- trunk/theora/tests/comment_theora.c	                        (rev 0)
+++ trunk/theora/tests/comment_theora.c	2008-01-08 01:08:12 UTC (rev 14378)
@@ -0,0 +1,91 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE.   *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2007                *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+  function: routines for validating comment header code
+  last mod: $Id$
+
+ ********************************************************************/
+
+#include <theora/theora.h>
+
+#include <string.h>
+#include "tests.h"
+
+#define ARTIST1 "Bug-eyed Fish"
+#define ARTIST2 "VJ Fugu"
+#define COPYRIGHT "Copyright (C) 2005. Some Rights Reserved."
+#define LICENSE "Creative Commons Attribution-ShareAlike 2.5"
+
+static int
+test_comments ()
+{
+  theora_comment tc;
+  int n;
+  char * value;
+
+  INFO ("+ Initializing theora_comment");
+  theora_comment_init (&tc);
+
+  INFO ("+ Adding ARTIST1");
+  theora_comment_add (&tc, "ARTIST=" ARTIST1);
+
+  INFO ("+ Adding LICENSE by tag");
+  theora_comment_add_tag (&tc, "LICENSE", LICENSE);
+
+  INFO ("+ Adding ARTIST2 by tag");
+  theora_comment_add_tag (&tc, "ARTIST", ARTIST2);
+
+  INFO ("+ Querying value of LICENSE");
+  value = theora_comment_query (&tc, "LICENSE", 0);
+  printf("foo %s\n", value);
+
+  if (strcmp (value, LICENSE))
+    FAIL ("Incorrect value for LICENSE");
+
+  INFO ("+ Querying count of ARTIST comments");
+  n = theora_comment_query_count (&tc, "ARTIST");
+
+  if (n != 2)
+    FAIL ("Incorrect count of ARTIST comments");
+
+  INFO ("+ Querying value of ARTIST index 0");
+  value = theora_comment_query (&tc, "ARTIST", 0);
+  if (strcmp (value, ARTIST1))
+    FAIL ("Incorrect value for ARTIST index 0");
+
+  INFO ("+ Querying value of ARTIST index 1");
+  value = theora_comment_query (&tc, "ARTIST", 1);
+  if (strcmp (value, ARTIST2))
+    FAIL ("Incorrect value for ARTIST index 1");
+
+  INFO ("+ Querying value of ARTIST index 2 (out of bounds)");
+  value = theora_comment_query (&tc, "ARTIST", 2);
+  if (value != NULL)
+    FAIL ("Non-NULL value for ARTIST index 2 (out of bounds)");
+
+  INFO ("+ Querying value of UNDEF index 7 (tag not defined)");
+  value = theora_comment_query (&tc, "UNDEF", 7);
+  if (value != NULL)
+    FAIL ("Non-NULL value for UNDEF index 7 (tag not defined)");
+
+  INFO ("+ Clearing theora_comment");
+  theora_comment_clear (&tc);
+
+  return 0;
+}
+
+int main(int argc, char *argv[])
+{
+  test_comments ();
+
+  exit (0);
+}

Modified: trunk/theora/tests/noop.c
===================================================================
--- trunk/theora/tests/noop.c	2008-01-06 06:16:50 UTC (rev 14377)
+++ trunk/theora/tests/noop.c	2008-01-08 01:08:12 UTC (rev 14378)
@@ -15,67 +15,46 @@
 
  ********************************************************************/
 
-#include <theora/theora.h>
+#include <theora/theoraenc.h>
 
 #include "tests.h"
 
 static int
 noop_test_encode ()
 {
-  theora_info ti;
-  theora_state th;
+  th_info ti;
+  th_enc_ctx *te;
 
   INFO ("+ Initializing theora_info struct");
-  theora_info_init (&ti);
+  th_info_init (&ti);
 
-  INFO ("+ Initializing theora_state for encoding");
-  if (theora_encode_init (&th, &ti) != OC_DISABLED) {
-    INFO ("+ Clearing theora_state");
-    theora_clear (&th);
-  }
+  INFO ("+ Allocating encoder context");
+  te = th_encode_alloc(&ti);
+  if (te == NULL)
+    FAIL("td_encode_alloc returned a null pointer");
 
   INFO ("+ Clearing theora_info struct");
-  theora_info_clear (&ti);
+  th_info_clear (&ti);
 
-  return 0;
-}
+  INFO ("+ Freeing encoder context");
+  th_encode_free(te);
 
-static int
-noop_test_decode ()
-{
-  theora_info ti;
-  theora_state th;
-
-  INFO ("+ Initializing theora_info struct");
-  theora_info_init (&ti);
-
-  INFO ("+ Initializing theora_state for decoding");
-  theora_decode_init (&th, &ti);
-
-  INFO ("+ Clearing theora_state");
-  theora_clear (&th);
-
-  INFO ("+ Clearing theora_info struct");
-  theora_info_clear (&ti);
-
   return 0;
 }
 
 static int
 noop_test_comments ()
 {
-  theora_comment tc;
+  th_comment tc;
 
-  theora_comment_init (&tc);
-  theora_comment_clear (&tc);
+  th_comment_init (&tc);
+  th_comment_clear (&tc);
 
   return 0;
 }
 
 int main(int argc, char *argv[])
 {
-  /*noop_test_decode ();*/
-
   noop_test_encode ();
 
   noop_test_comments ();

Copied: trunk/theora/tests/noop_theora.c (from rev 14377, trunk/theora/tests/noop.c)
===================================================================
--- trunk/theora/tests/noop_theora.c	                        (rev 0)
+++ trunk/theora/tests/noop_theora.c	2008-01-08 01:08:12 UTC (rev 14378)
@@ -0,0 +1,84 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE.   *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2007                *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+  function: routines for validating codec initialization
+  last mod: $Id$
+
+ ********************************************************************/
+
+#include <theora/theora.h>
+
+#include "tests.h"
+
+static int
+noop_test_encode ()
+{
+  theora_info ti;
+  theora_state th;
+
+  INFO ("+ Initializing theora_info struct");
+  theora_info_init (&ti);
+
+  INFO ("+ Initializing theora_state for encoding");
+  if (theora_encode_init (&th, &ti) != OC_DISABLED) {
+    INFO ("+ Clearing theora_state");
+    theora_clear (&th);
+  }
+
+  INFO ("+ Clearing theora_info struct");
+  theora_info_clear (&ti);
+
+  return 0;
+}
+
+static int
+noop_test_decode ()
+{
+  theora_info ti;
+  theora_state th;
+
+  INFO ("+ Initializing theora_info struct");
+  theora_info_init (&ti);
+
+  INFO ("+ Initializing theora_state for decoding");
+  theora_decode_init (&th, &ti);
+
+  INFO ("+ Clearing theora_state");
+  theora_clear (&th);
+
+  INFO ("+ Clearing theora_info struct");
+  theora_info_clear (&ti);
+
+  return 0;
+}
+
+static int
+noop_test_comments ()
+{
+  theora_comment tc;
+
+  theora_comment_init (&tc);
+  theora_comment_clear (&tc);
+
+  return 0;
+}
+
+int main(int argc, char *argv[])
+{
+  /*noop_test_decode ();*/
+
+  noop_test_encode ();
+
+  noop_test_comments ();
+
+  exit (0);
+}



More information about the commits mailing list