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
26 static void test_quvi()
32 if (chk_skip(__func__
) == TRUE
)
37 g_assert_cmpint(qerr(q
), ==, QUVI_OK
);
39 g_assert_cmpstr(quvi_errmsg(q
), ==, "No error");
43 quvi_get(q
, QUVI_INFO_RESPONSE_CODE
-1, &n
);
44 g_assert_cmpint(n
, ==, 0);
46 quvi_get(q
, QUVI_INFO_RESPONSE_CODE
-1, &p
);
49 quvi_get(q
, QUVI_INFO_ERROR_CODE
+1, &n
);
50 g_assert_cmpint(n
, ==, 0);
52 quvi_get(q
, QUVI_INFO_ERROR_CODE
+1, &p
);
55 quvi_get(q
, QUVI_INFO_CURL_HANDLE
, &p
);
59 quvi_get(q
, QUVI_INFO_CURL_HANDLE
+1, &p
);
64 quvi_set(q
, QUVI_OPTION_MEDIA_SCRIPT_PROTOCOL_CATEGORY
-1, 0);
65 g_assert_cmpint(qerr(q
), ==, QUVI_ERROR_INVALID_ARG
);
67 quvi_set(q
, QUVI_OPTION_AUTOPROXY
+1, 0);
68 g_assert_cmpint(qerr(q
), ==, QUVI_ERROR_INVALID_ARG
);
73 static void test_version()
75 if (chk_skip(__func__
) == TRUE
)
78 if (g_test_trap_fork(0,
79 G_TEST_TRAP_SILENCE_STDOUT
|G_TEST_TRAP_SILENCE_STDERR
))
81 g_print("%s", quvi_version(QUVI_VERSION
));
82 g_printerr("%s", quvi_version(QUVI_VERSION_SCRIPTS
));
85 g_test_trap_assert_passed();
86 g_test_trap_assert_stdout("v?.?.?*");
87 g_test_trap_assert_stderr("v?.?*");
89 g_assert_cmpstr(quvi_version(QUVI_VERSION_SCRIPTS
+1),
90 ==, quvi_version(QUVI_VERSION
));
92 g_assert_cmpstr(quvi_version(QUVI_VERSION
-1),
93 ==, quvi_version(QUVI_VERSION
));
96 gint
main(gint argc
, gchar
**argv
)
98 g_test_init(&argc
, &argv
, NULL
);
99 g_test_add_func("/quvi", test_quvi
);
100 g_test_add_func("/quvi/version", test_version
);
101 return (g_test_run());
104 /* vim: set ts=2 sw=2 tw=72 expandtab: */