[xiph-commits] r16125 - branches/theora-thusnelda/tests

giles at svn.xiph.org giles at svn.xiph.org
Sun Jun 14 03:09:55 PDT 2009


Author: giles
Date: 2009-06-14 03:09:55 -0700 (Sun, 14 Jun 2009)
New Revision: 16125

Modified:
   branches/theora-thusnelda/tests/noop.c
Log:
Add some negative tests for th_decode_init().

We can't really noop test the decoder; the only way to generate
a th_setup struct is to hand it headers to parse.

Modified: branches/theora-thusnelda/tests/noop.c
===================================================================
--- branches/theora-thusnelda/tests/noop.c	2009-06-14 10:09:53 UTC (rev 16124)
+++ branches/theora-thusnelda/tests/noop.c	2009-06-14 10:09:55 UTC (rev 16125)
@@ -16,6 +16,7 @@
  ********************************************************************/
 
 #include <theora/theoraenc.h>
+#include <theora/theoradec.h>
 
 #include "tests.h"
 
@@ -56,7 +57,7 @@
   INFO ("+ Initializing th_info struct");
   th_info_init (&ti);
 
-  INFO ("+ Allocating encoder context with empty th_info");
+  INFO ("+ Testing encoder context with empty th_info");
   te = th_encode_alloc(&ti);
   if (te != NULL)
     FAIL("td_encode_alloc accepted an unconfigured th_info");
@@ -79,6 +80,31 @@
   return 0;
 }
 
+static int
+noop_test_decode ()
+{
+  th_info ti;
+  th_dec_ctx *td;
+
+  INFO ("+ Testing decoder context with null info and setup");
+  td = th_decode_alloc(NULL, NULL);
+  if (td != NULL)
+    FAIL("td_decode_alloc accepted null info pointers");
+
+  INFO ("+ Initializing th_info struct");
+  th_info_init (&ti);
+
+  INFO ("+ Testing decoder context with empty info and null setup");
+  td = th_decode_alloc(&ti, NULL);
+  if (td != NULL)
+    FAIL("td_decode_alloc accepted null info pointers");
+
+  INFO ("+ Clearing th_info struct");
+  th_info_clear (&ti);
+
+  return 0;
+}
+
 int main(int argc, char *argv[])
 {
   noop_test_info ();
@@ -87,5 +113,7 @@
 
   noop_test_encode ();
 
+  noop_test_decode ();
+
   exit (0);
 }



More information about the commits mailing list