<commit_before>/*
 * testapi.c - libvlc smoke test
 *
 * $Id$
 */

/**********************************************************************
 *  Copyright (C) 2007 <NAME>.                           *
 *  This program is free software; you can redistribute and/or modify *
 *  it under the terms of the GNU General Public License as published *
 *  by the Free Software Foundation; version 2 of the license, or (at *
 *  your option) any later version.                                   *
 *                                                                    *
 *  This program is distributed in the hope that it will be useful,   *
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of    *
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.              *
 *  See the GNU General Public License for more details.              *
 *                                                                    *
 *  You should have received a copy of the GNU General Public License *
 *  along with this program; if not, you can get it from:             *
 *  http://www.gnu.org/copyleft/gpl.html                              *
 **********************************************************************/

#include <vlc/libvlc.h>

#undef NDEBUG
#include <assert.h>

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

static libvlc_exception_t ex;

static void catch (void)
{
    if (libvlc_exception_raised (&ex))
    {
         fprintf (stderr, "Exception: %s\n",
                  libvlc_exception_get_message (&ex));
         abort ();
    }

    assert (libvlc_exception_get_message (&ex) == NULL);
    libvlc_exception_clear (&ex);
}

int main (int argc, char *argv[])
{
    libvlc_instance_t *vlc;
    const char *args[argc + 3];

    alarm (30); /* Make sure "make check" does not get stuck */

    args[0] = "-vvv";
    args[1] = "-I";
    args[2] = "-dummy";
    args[3] = "--plugin-path=..";
    for (int i = 1; i < argc; i++)
        args[i + 3] = argv[i];

    libvlc_exception_init (&ex);
    vlc = libvlc_new (sizeof (args) / sizeof (args[0]), args, &ex);
    catch ();

    libvlc_destroy (vlc, &ex);
    catch ();
    return 0;
}
<commit_msg>Also test libvlc_playlist_clear and libvlc_playlist_add_extended<commit_after>/*
 * testapi.c - libvlc smoke test
 *
 * $Id$
 */

/**********************************************************************
 *  Copyright (C) 2007 <NAME>.                           *
 *  This program is free software; you can redistribute and/or modify *
 *  it under the terms of the GNU General Public License as published *
 *  by the Free Software Foundation; version 2 of the license, or (at *
 *  your option) any later version.                                   *
 *                                                                    *
 *  This program is distributed in the hope that it will be useful,   *
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of    *
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.              *
 *  See the GNU General Public License for more details.              *
 *                                                                    *
 *  You should have received a copy of the GNU General Public License *
 *  along with this program; if not, you can get it from:             *
 *  http://www.gnu.org/copyleft/gpl.html                              *
 **********************************************************************/

#include <vlc/libvlc.h>

#undef NDEBUG
#include <assert.h>

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

static libvlc_exception_t ex;

static void catch (void)
{
    if (libvlc_exception_raised (&ex))
    {
         fprintf (stderr, "Exception: %s\n",
                  libvlc_exception_get_message (&ex));
         abort ();
    }

    assert (libvlc_exception_get_message (&ex) == NULL);
    libvlc_exception_clear (&ex);
}

int main (int argc, char *argv[])
{
    libvlc_instance_t *vlc;
    const char *args[argc + 3];
    int id;

    alarm (30); /* Make sure "make check" does not get stuck */

    args[0] = "-vvv";
    args[1] = "-I";
    args[2] = "-dummy";
    args[3] = "--plugin-path=..";
    for (int i = 1; i < argc; i++)
        args[i + 3] = argv[i];

    libvlc_exception_init (&ex);
    vlc = libvlc_new (sizeof (args) / sizeof (args[0]), args, &ex);
    catch ();

    libvlc_playlist_clear (vlc, &ex);
    catch ();

    id = libvlc_playlist_add_extended (vlc, "/dev/null", "Test", 0, NULL,
                                       &ex);
    catch ();

    libvlc_playlist_clear (vlc, &ex);
    catch ();

    libvlc_destroy (vlc, &ex);
    catch ();
    return 0;
}

{'fraction_non_alphanumeric': 0.1693600517129929, 'fraction_numerical': 0.007110536522301228, 'mean_word_length': 1.990979381443299, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 11, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3268313', 'n_tokens_mistral': 1374, 'n_tokens_neox': 1323, 'n_words': 429}