2 * Copyright (C) 2012 Toni Gundogdu <legatvs@gmail.com>
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
30 quvi_t q
= quvi_new();
32 g_assert_cmpint(qerr(q
), ==, QUVI_OK
);
37 static void chk_results(quvi_scan_t qs
)
41 while ((s
= quvi_scan_next_media_url(qs
)) != NULL
)
43 g_assert_cmpint(strlen(s
), >, 0);
46 g_assert_cmpint(i
, >=, 1);
49 static void test_scan()
51 static const gchar URL
[] =
52 "http://www.fangoria.com/index.php/home/all-news/1-latest-news/"
53 "6981-new-qprometheusq-trailer-has-landed";
58 if (chk_internet() == FALSE
)
61 if (chk_skip(__func__
) == TRUE
)
66 qs
= quvi_scan_new(q
, URL
);
67 g_assert_cmpint(qerr_m(q
, URL
), ==, QUVI_OK
);
75 static void test_scan_short()
77 static const gchar URL
[] = "http://is.gd/gQ4pYW";
82 if (chk_internet() == FALSE
)
85 if (chk_skip(__func__
) == TRUE
)
90 qs
= quvi_scan_new(q
, URL
);
91 g_assert_cmpint(qerr_m(q
, URL
), ==, QUVI_OK
);
99 static void test_scan_noresults()
101 static const gchar URL
[] = "http://example.com/";
106 if (chk_internet() == FALSE
)
109 if (chk_skip(__func__
) == TRUE
)
114 qs
= quvi_scan_new(q
, URL
);
115 g_assert_cmpint(qerr_m(q
, URL
), ==, QUVI_OK
);
116 g_assert(qs
!= NULL
);
117 g_assert(quvi_scan_next_media_url(qs
) == NULL
);
123 gint
main(gint argc
, gchar
**argv
)
125 g_test_init(&argc
, &argv
, NULL
);
126 g_test_add_func("/quvi/scan", test_scan
);
127 g_test_add_func("/quvi/scan (short)", test_scan_short
);
128 g_test_add_func("/quvi/scan (noresults)", test_scan_noresults
);
129 return (g_test_run());
132 /* vim: set ts=2 sw=2 tw=72 expandtab: */