Code

refactor redrawing code into pen_redraw_all; cancel current unfinished path, inctead...
[inkscape.git] / src / extract-uri-test.cpp
1 #include <utest/utest.h>
2 #include "extract-uri.h"
3 #include <string.h>
4 #include <glib.h>
6 struct Case {
7     char const *input;
8     char const *exp;
9 };
11 static void test_extract_uri_case(Case const &c)
12 {
13     char * const p = extract_uri(c.input);
14     UTEST_TEST(c.input) {
15         UTEST_ASSERT( ( p == NULL ) == ( c.exp == NULL ) );
16         if (p) {
17             UTEST_ASSERT( strcmp(p, c.exp) == 0 );
18         }
19     }
20     g_free(p);
21 }
23 int main(int argc, char *argv[])
24 {
25     utest_start("extract_uri");
27     Case const cases[] = {
28         { "url(#foo)", "#foo" },
29         { "url  foo  ", "foo" },
30         { "url", NULL },
31         { "url ", NULL },
32         { "url()", NULL },
33         { "url ( ) ", NULL },
34         { "url foo bar ", "foo bar" }
35     };
37     for(unsigned i = 0; i < G_N_ELEMENTS(cases); ++i) {
38         Case const &c = cases[i];
39         test_extract_uri_case(c);
40     }
42     return ( utest_end()
43              ? EXIT_SUCCESS
44              : EXIT_FAILURE );
45 }
47 /*
48   Local Variables:
49   mode:c++
50   c-file-style:"stroustrup"
51   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
52   indent-tabs-mode:nil
53   fill-column:99
54   End:
55 */
56 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :