2 * Copyright (C) 2012,2013 Toni Gundogdu <legatvs@gmail.com>
4 * This file is part of libquvi-scripts <http://quvi.sourceforge.net>.
6 * This program is free software: you can redistribute it and/or
7 * modify it under the terms of the GNU Affero General Public
8 * License as published by the Free Software Foundation, either
9 * version 3 of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
16 * You should have received a copy of the GNU Affero General
17 * Public License along with this program. If not, see
18 * <http://www.gnu.org/licenses/>.
26 gboolean
chk_env(const gchar
*, const gchar
*);
27 gboolean
chk_skip(const gchar
*);
28 void chk_verbose(gpointer
);
29 gboolean
chk_geoblocked();
30 gboolean
chk_complete();
36 struct qm_test_exact_s
41 typedef struct qm_test_exact_s
*qm_test_exact_t
;
45 struct /* String value length >0 */
60 struct /* >0 (numeric) */
66 gboolean bitrate_kbit_s
;
72 gboolean bitrate_kbit_s
;
75 gboolean start_time_ms
;
79 typedef struct qm_test_opts_s
*qm_test_opts_t
;
81 /* Compare media property string values. */
82 #define qm_cmp_s(qmp, e)\
85 quvi_media_get(qm, qmp, &s);\
86 g_assert_cmpint(quvi_errcode(q), ==, QUVI_OK);\
88 g_test_message("%s=%s", #qmp, s);\
89 g_assert_cmpstr(s, ==, e);\
92 /* Media property string value length >0 */
93 #define qm_chk_l(qmp)\
96 quvi_media_get(qm, qmp, &s);\
97 g_assert_cmpint(quvi_errcode(q), ==, QUVI_OK);\
99 g_test_message("%s=%s", #qmp, s);\
100 g_assert_cmpint(strlen(s), >, 0);\
103 /* Media property value (double) >0 */
104 #define qm_chk_gt0(qmp)\
107 quvi_media_get(qm, qmp, &v);\
108 g_assert_cmpint(quvi_errcode(q), ==, QUVI_OK);\
109 g_test_message("%s=%g", #qmp, v);\
110 g_assert_cmpfloat(v, >, 0);\
113 void qm_test(const gchar
*, const gchar
*,
114 const qm_test_exact_t
, const qm_test_opts_t
);
118 struct qp_test_exact_s
122 typedef struct qp_test_exact_s
*qp_test_exact_t
;
124 struct qp_test_opts_s
132 gboolean thumbnail_url
;
139 gboolean duration_ms
;
143 typedef struct qp_test_opts_s
*qp_test_opts_t
;
145 /* Compare playlist property string values. */
146 #define qp_cmp_s(qpp, e)\
149 quvi_playlist_get(qp, qpp, &s);\
150 g_assert_cmpint(quvi_errcode(q), ==, QUVI_OK);\
151 g_assert(s != NULL);\
152 g_test_message("%s=%s", #qpp, s);\
153 g_assert_cmpstr(s, ==, e);\
156 /* Playlist property string value length >0 */
157 #define qp_chk_l(qpp)\
160 quvi_playlist_get(qp, qpp, &s);\
161 g_assert_cmpint(quvi_errcode(q), ==, QUVI_OK);\
162 g_assert(s != NULL);\
163 g_test_message("%s=%s", #qpp, s);\
164 g_assert_cmpint(strlen(s), >, 0);\
167 /* Playlist property value (double) >0 */
168 #define qp_chk_gt0(qpp)\
171 quvi_playlist_get(qp, qpp, &v);\
172 g_assert_cmpint(quvi_errcode(q), ==, QUVI_OK);\
173 g_test_message("%s=%g", #qpp, v);\
174 g_assert_cmpfloat(v, >, 0);\
177 void qp_test(const gchar
*, const gchar
*,
178 const qp_test_exact_t
, const qp_test_opts_t
);
182 struct qs_test_exact_s
185 const gint n
; /* Expected no. of returned media URLs. */
187 typedef struct qs_test_exact_s
*qs_test_exact_t
;
189 void qs_test(const gchar
*, qs_test_exact_t
);
193 /* Subtitle type property value (double) length >0 */
194 #define qsub_chk_type_gt0(qsp)\
197 quvi_subtitle_type_get(qst, qsp, &v);\
198 g_assert_cmpint(quvi_errcode(q), ==, QUVI_OK);\
199 g_test_message("%s=%g", #qsp, v);\
200 g_assert_cmpfloat(v, >, 0);\
203 /* Subtitle lang property string value >0 */
204 #define qsub_chk_lang_l(qsp)\
207 quvi_subtitle_lang_get(qsl, qsp, &s);\
208 g_assert_cmpint(quvi_errcode(q), ==, QUVI_OK);\
209 g_assert(s != NULL);\
210 g_test_message("%s=%s", #qsp, s);\
211 g_assert_cmpint(strlen(s), >, 0);\
214 struct qsub_test_opts_s
237 typedef struct qsub_test_opts_s
*qsub_test_opts_t
;
239 void qsub_test(const gchar
*, const gchar
*, qsub_test_opts_t
);
250 typedef struct capture_s
*capture_t
;
252 capture_t
capture_new(const gchar
*, const gchar
*, const GRegexCompileFlags
);
253 gchar
*capture_fetch(capture_t
, const gint
);
254 gboolean
capture_matches(capture_t
);
255 gboolean
capture_next(capture_t
);
256 void capture_free(capture_t
);
258 gboolean
match(const gchar
*, const gchar
*);
259 gchar
*fetch(const gchar
*);
261 void slist_free_full(GSList
*, const GFunc
);
265 /* vim: set ts=2 sw=2 tw=72 expandtab: */