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
25 #include <curl/curl.h>
29 gboolean
chk_env(const gchar
*w
, const gchar
*m
)
31 const gchar
*s
= g_getenv(w
);
32 if (s
== NULL
|| strlen(s
) == 0)
35 g_test_message("%s", m
);
41 gboolean
chk_geoblocked()
43 return (chk_env("TEST_GEOBLOCKED", "SKIP: Set TEST_GEOBLOCKED to enable"));
48 return (chk_env("TEST_NSFW", "SKIP: Set TEST_NSFW to enable"));
53 return (chk_env("TEST_FIXME", "SKIP: Set TEST_FIXME to enable"));
56 void chk_verbose(quvi_t q
)
59 if (chk_env("TEST_VERBOSE", NULL
) == TRUE
)
62 quvi_get(q
, QUVI_INFO_CURL_HANDLE
, &c
);
63 curl_easy_setopt(c
, CURLOPT_VERBOSE
, 1L);
67 static gboolean
chk_level(const gchar
*s
)
69 const gchar
*e
= g_getenv("TEST_LEVEL");
71 if (e
== NULL
|| strlen(e
) == 0)
74 return ((g_strcmp0(e
, s
) == 0) ? TRUE
:FALSE
);
77 gboolean
chk_complete()
79 return (chk_level("complete"));
82 gboolean
chk_skip(const gchar
*test
)
84 const gchar
*e
= g_getenv("TEST_SKIP");
87 if (e
== NULL
|| strlen(e
) == 0)
90 gchar
**s
= g_strsplit(e
, ",", 0);
93 while (s
!= NULL
&& s
[++i
] != NULL
)
95 if (match(test
, s
[i
]) == TRUE
)
97 g_test_message("SKIP: Remove '%s' from TEST_SKIP to enable",
109 /* vim: set ts=2 sw=2 tw=72 expandtab: */