~ubuntu-branches/ubuntu/trusty/apr-util/trusty

« back to all changes in this revision

Viewing changes to test/testxml.c

  • Committer: Bazaar Package Importer
  • Author(s): Ryan Niebur
  • Date: 2009-03-26 22:25:48 UTC
  • mto: (4.1.1 squeeze) (20.1.2 sid)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20090326222548-v103269kb84vo0ub
Tags: upstream-1.3.4+dfsg
ImportĀ upstreamĀ versionĀ 1.3.4+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
 
31
31
    rv = apr_file_mktemp(fd, template, APR_CREATE | APR_TRUNCATE | APR_DELONCLOSE |
32
32
                         APR_READ | APR_WRITE | APR_EXCL, p);
33
 
    ABTS_INT_EQUAL(tc, rv, APR_SUCCESS);
 
33
    ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
34
34
 
35
35
    if (rv != APR_SUCCESS)
36
36
        return rv;
38
38
    rv = apr_file_puts("<?xml version=\"1.0\" ?>\n<maryx>"
39
39
                       "<had a=\"little\"/><lamb its='fleece "
40
40
                       "was white as snow' />\n", *fd);
41
 
    ABTS_INT_EQUAL(tc, rv, APR_SUCCESS);
 
41
    ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
42
42
 
43
43
    for (i = 0; i < 5000; i++) {
44
44
        rv = apr_file_puts("<hmm roast=\"lamb\" "
45
45
                           "for=\"dinner\">yummy</hmm>\n", *fd);
46
 
        ABTS_INT_EQUAL(tc, rv, APR_SUCCESS);
 
46
        ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
47
47
    }
48
48
 
49
49
    rv = apr_file_puts("</mary>\n", *fd);
50
 
    ABTS_INT_EQUAL(tc, rv, APR_SUCCESS);
 
50
    ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
51
51
 
52
52
    rv = apr_file_seek(*fd, APR_SET, &off);
53
 
    ABTS_INT_EQUAL(tc, rv, APR_SUCCESS);
 
53
    ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
54
54
 
55
55
    return rv;
56
56
}
65
65
 
66
66
    rv = apr_file_mktemp(fd, template, APR_CREATE | APR_TRUNCATE | APR_DELONCLOSE |
67
67
                         APR_READ | APR_WRITE | APR_EXCL, p);
68
 
    ABTS_INT_EQUAL(tc, rv, APR_SUCCESS);
 
68
    ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
69
69
 
70
70
    if (rv != APR_SUCCESS)
71
71
        return rv;
72
72
 
73
73
    rv = apr_file_puts("<?xml version=\"1.0\" ?>\n<mary>\n", *fd);
74
 
    ABTS_INT_EQUAL(tc, rv, APR_SUCCESS);
 
74
    ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
75
75
 
76
76
    for (i = 0; i < 5000; i++) {
77
77
        rv = apr_file_puts("<hmm roast=\"lamb\" "
78
78
                           "for=\"dinner\">yummy</hmm>\n", *fd);
79
 
        ABTS_INT_EQUAL(tc, rv, APR_SUCCESS);
 
79
        ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
80
80
    }
81
81
 
82
82
    rv = apr_file_puts("</mary>\n", *fd);
83
 
    ABTS_INT_EQUAL(tc, rv, APR_SUCCESS);
 
83
    ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
84
84
 
85
85
    rv = apr_file_seek(*fd, APR_SET, &off);
86
 
    ABTS_INT_EQUAL(tc, rv, APR_SUCCESS);
 
86
    ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
87
87
 
88
88
    return rv;
89
89
}
94
94
    apr_xml_elem *ec;
95
95
 
96
96
    if (level == 0) {
97
 
        ABTS_STR_EQUAL(tc, e->name, "mary");
 
97
        ABTS_STR_EQUAL(tc, "mary", e->name);
98
98
    } else {
99
 
        ABTS_STR_EQUAL(tc, e->name, "hmm");
 
99
        ABTS_STR_EQUAL(tc, "hmm", e->name);
100
100
    }
101
101
 
102
102
    if (e->attr) {
103
103
        a = e->attr;
104
104
        ABTS_PTR_NOTNULL(tc, a);
105
 
        ABTS_STR_EQUAL(tc, a->name, "for");
106
 
        ABTS_STR_EQUAL(tc, a->value, "dinner");
 
105
        ABTS_STR_EQUAL(tc, "for", a->name);
 
106
        ABTS_STR_EQUAL(tc, "dinner", a->value);
107
107
        a = a->next;
108
108
        ABTS_PTR_NOTNULL(tc, a);
109
 
        ABTS_STR_EQUAL(tc, a->name, "roast");
110
 
        ABTS_STR_EQUAL(tc, a->value, "lamb");
 
109
        ABTS_STR_EQUAL(tc, "roast", a->name);
 
110
        ABTS_STR_EQUAL(tc, "lamb", a->value);
111
111
    }
112
112
    if (e->first_child) {
113
113
        ec = e->first_child;
126
126
    apr_status_t rv;
127
127
 
128
128
    rv = create_dummy_file(tc, p, &fd);
129
 
    ABTS_INT_EQUAL(tc, rv, APR_SUCCESS);
 
129
    ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
130
130
 
131
131
    if (rv != APR_SUCCESS)
132
132
        return;
133
133
 
134
134
    rv = apr_xml_parse_file(p, &parser, &doc, fd, 2000);
135
 
    ABTS_INT_EQUAL(tc, rv, APR_SUCCESS);
 
135
    ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
136
136
 
137
137
    dump_xml(tc, doc->root, 0);
138
138
 
139
139
    rv = apr_file_close(fd);
140
 
    ABTS_INT_EQUAL(tc, rv, APR_SUCCESS);
 
140
    ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
141
141
 
142
142
    rv = create_dummy_file_error(tc, p, &fd);
143
 
    ABTS_INT_EQUAL(tc, rv, APR_SUCCESS);
 
143
    ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
144
144
 
145
145
    if (rv != APR_SUCCESS)
146
146
        return;