2 * Copyright (C) 2012 Toni Gundogdu <legatvs@gmail.com>
4 * This file is part of libquvi <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/>.
32 quvi_http_metainfo_get(qv, p, &s);\
34 g_test_message("%s=%s", #p, s);\
35 g_assert_cmpint(strlen(s), >, 1);\
41 quvi_http_metainfo_get(qv, p, &n);\
42 g_test_message("%s=%f", #p, n);\
43 g_assert_cmpfloat(n, >, 0);\
46 static void test_http_metainfo()
48 static const gchar URL
[] = "http://is.gd/SKyg8m";
50 quvi_http_metainfo_t qv
;
54 if (chk_internet() == FALSE
|| chk_skip(__func__
) == TRUE
)
59 g_assert_cmpint(quvi_errcode(q
), ==, QUVI_OK
);
63 qv
= quvi_http_metainfo_new(q
, URL
);
64 g_assert_cmpint(qerr_m(q
, URL
), ==, QUVI_OK
);
67 quvi_http_metainfo_get(qv
, QUVI_HTTP_METAINFO_PROPERTY_FILE_EXTENSION
-1,&v
);
68 g_assert_cmpint(quvi_errcode(q
), ==, QUVI_ERROR_INVALID_ARG
);
70 quvi_http_metainfo_get(qv
, QUVI_HTTP_METAINFO_PROPERTY_LENGTH_BYTES
+1, &v
);
71 g_assert_cmpint(quvi_errcode(q
), ==, QUVI_ERROR_INVALID_ARG
);
73 chk_len(QUVI_HTTP_METAINFO_PROPERTY_FILE_EXTENSION
);
74 chk_len(QUVI_HTTP_METAINFO_PROPERTY_CONTENT_TYPE
);
76 chk_val(QUVI_HTTP_METAINFO_PROPERTY_LENGTH_BYTES
);
78 quvi_http_metainfo_free(qv
);
82 gint
main(gint argc
, gchar
**argv
)
84 g_test_init(&argc
, &argv
, NULL
);
85 g_test_add_func("/quvi/http_metainfo", test_http_metainfo
);
86 return (g_test_run());
89 /* vim: set ts=2 sw=2 tw=72 expandtab: */