[vlc-devel] commit: Meta test: ( Rafaël Carré )

git version control git at videolan.org
Sat Apr 19 14:37:24 CEST 2008


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Sat Apr 19 14:38:24 2008 +0200| [6c0e4396dfb0205342d19abe777e79a52f6f406b]

Meta test:

Precise a comment
Wrap a long line
Rework the assertions:
    Do it in the right order
    Do not put str*cmp-that-could-be-a-ugly-glibc-macro in assert()

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6c0e4396dfb0205342d19abe777e79a52f6f406b
---

 test/libvlc/meta.c |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/test/libvlc/meta.c b/test/libvlc/meta.c
index 9bad756..d1d7895 100644
--- a/test/libvlc/meta.c
+++ b/test/libvlc/meta.c
@@ -38,21 +38,31 @@ static void test_meta (const char ** argv, int argc)
     media = libvlc_media_new (vlc, "samples/meta.sample", &ex);
     catch ();
 
-    /* Tell that we are interested in this precise meta data */
+    /* Tell that we are interested in this precise meta data
+     * This is needed to trigger meta data reading
+     * (the first calls return NULL) */
     artist = libvlc_media_get_meta (media, libvlc_meta_Artist, &ex);
     catch ();
 
     free (artist);
 
     /* Wait for the meta */
-    while (!libvlc_media_is_preparsed (media, &ex)) { catch (); msleep (10000); }
+    while (!libvlc_media_is_preparsed (media, &ex))
+    {
+        catch ();
+        msleep (10000);
+    }
 
     artist = libvlc_media_get_meta (media, libvlc_meta_Artist, &ex);
     catch ();
 
-    assert (artist && !strncmp (artist, "mike", 4));
+    const char *expected_artist = "mike";
 
-    log ("+ got '%s' as Artist\n", artist);
+    assert (artist);
+    log ("+ got '%s' as Artist, expecting %s\n", artist, expected_artist);
+
+    int string_compare = strcmp (artist, expected_artist);
+    assert (!string_compare);
 
     free (artist);
     libvlc_media_release (media);




More information about the vlc-devel mailing list