[cvs-annodex] commit (/annodex): liboggz/trunk/src/tests/seek-stress.c

conrad nobody at lists.annodex.net
Wed Feb 2 12:06:58 EST 2005


Update of /annodex (new revision 818)

Modified files:
   liboggz/trunk/src/tests/seek-stress.c

Log Message:
improve verbose output of seek-stress


Modified: liboggz/trunk/src/tests/seek-stress.c
===================================================================
--- liboggz/trunk/src/tests/seek-stress.c	2005-02-01 22:10:47 UTC (rev 817)
+++ liboggz/trunk/src/tests/seek-stress.c	2005-02-02 01:06:57 UTC (rev 818)
@@ -35,6 +35,8 @@
 #include <string.h>
 #include <oggz/oggz.h>
 
+#include "oggz_tests.h"
+
 static int has_skeleton = 0;
 static int verbose = 0;
 
@@ -59,11 +61,31 @@
 static ogg_int64_t
 try_seek_units (OGGZ * oggz, ogg_int64_t units)
 {
+  ogg_int64_t result, diff;
+
   if (verbose)
     printf ("\tAttempt seek to %lld ms:\n", units);
-  units = oggz_seek_units (oggz, units, SEEK_SET);
+  result = oggz_seek_units (oggz, units, SEEK_SET);
+
+  if (result < 0) {
+    FAIL ("Seek failure\n");
+  }
+
+  if (result != oggz_tell_units (oggz))
+    FAIL ("oggz_seek_units() result != oggz_tell_units()\n");
+
+  if (units == 0 && result != 0)
+    FAIL ("Failed seeking to 0");
+
+  diff = result - units;
+
+  if (diff < 0)
+    FAIL ("Seek result too early");
+
   if (verbose)
-    printf ("\t%08lx: %lld ms\n", oggz_tell (oggz), oggz_tell_units (oggz));
+    printf ("\t%08lx: %lld ms (+%lld ms)\n",
+	    oggz_tell (oggz), oggz_tell_units (oggz), diff);
+
   return units;
 }
 


-- 
conrad



More information about the cvs-annodex mailing list